Fix cooldown.

This commit is contained in:
Nicolas Stepien 2011-05-24 18:14:13 +02:00
parent 7c6eafe358
commit de96f66451
2 changed files with 12 additions and 20 deletions

View File

@ -85,7 +85,7 @@
'Sauce': [true, 'Add sauce to images'] 'Sauce': [true, 'Add sauce to images']
}, },
post: { post: {
'Cooldown': [false, 'Prevent \'flood detected\' errors (buggy)'], 'Cooldown': [true, 'Prevent \'flood detected\' errors (buggy)'],
'Quick Reply': [true, 'Reply without leaving the page'], 'Quick Reply': [true, 'Reply without leaving the page'],
'Persistent QR': [false, 'Quick reply won\'t disappear after posting. Only in replies.'] 'Persistent QR': [false, 'Quick reply won\'t disappear after posting. Only in replies.']
}, },
@ -1128,21 +1128,15 @@
return qr.duration = duration; return qr.duration = duration;
}, },
cooldownCB: function() { cooldownCB: function() {
var submit, submits, _i, _len; var submit, submits, _i, _len, _results;
qr.duration = qr.duration - 1; qr.duration--;
submits = $$('#com_submit'); submits = $$('#com_submit');
_results = [];
for (_i = 0, _len = submits.length; _i < _len; _i++) { for (_i = 0, _len = submits.length; _i < _len; _i++) {
submit = submits[_i]; submit = submits[_i];
if (qr.duration === 0) { _results.push(qr.duration ? submit.value = qr.duration : (submit.disabled = false, submit.value = 'Submit', window.clearInterval(qr.cooldownIntervalID)));
submit.disabled = false;
submit.value = 'Submit';
} else {
submit.value = qr.duration;
}
}
if (qr.duration === 0) {
return clearInterval(qr.cooldownIntervalID);
} }
return _results;
}, },
dialog: function(link) { dialog: function(link) {
var MAX_FILE_SIZE, THREAD_ID, c, challenge, dialog, html, m, mail, name, pass, spoiler, src; var MAX_FILE_SIZE, THREAD_ID, c, challenge, dialog, html, m, mail, name, pass, spoiler, src;

View File

@ -26,7 +26,7 @@ config =
'Image Preloading': [false, 'Preload Images'] 'Image Preloading': [false, 'Preload Images']
'Sauce': [true, 'Add sauce to images'] 'Sauce': [true, 'Add sauce to images']
post: post:
'Cooldown': [false, 'Prevent \'flood detected\' errors (buggy)'] 'Cooldown': [true, 'Prevent \'flood detected\' errors (buggy)']
'Quick Reply': [true, 'Reply without leaving the page'] 'Quick Reply': [true, 'Reply without leaving the page']
'Persistent QR': [false, 'Quick reply won\'t disappear after posting. Only in replies.'] 'Persistent QR': [false, 'Quick reply won\'t disappear after posting. Only in replies.']
quote: quote:
@ -887,18 +887,16 @@ qr =
qr.duration = duration qr.duration = duration
cooldownCB: -> cooldownCB: ->
qr.duration = qr.duration - 1 qr.duration--
submits = $$ '#com_submit' submits = $$ '#com_submit'
for submit in submits for submit in submits
if qr.duration == 0 if qr.duration
submit.value = qr.duration
else
submit.disabled = false submit.disabled = false
submit.value = 'Submit' submit.value = 'Submit'
else window.clearInterval qr.cooldownIntervalID
submit.value = qr.duration
if qr.duration == 0
clearInterval qr.cooldownIntervalID
dialog: (link) -> dialog: (link) ->
#maybe should be global #maybe should be global