diff --git a/4chan_x.js b/4chan_x.js index 25395feba..0e5f6eeef 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -85,7 +85,7 @@ 'Sauce': [true, 'Add sauce to images'] }, post: { - 'Cooldown': [false, 'Prevent \'flood detected\' errors (buggy)'], + 'Cooldown': [true, 'Prevent \'flood detected\' errors (buggy)'], 'Quick Reply': [true, 'Reply without leaving the page'], 'Persistent QR': [false, 'Quick reply won\'t disappear after posting. Only in replies.'] }, @@ -1128,21 +1128,15 @@ return qr.duration = duration; }, cooldownCB: function() { - var submit, submits, _i, _len; - qr.duration = qr.duration - 1; + var submit, submits, _i, _len, _results; + qr.duration--; submits = $$('#com_submit'); + _results = []; for (_i = 0, _len = submits.length; _i < _len; _i++) { submit = submits[_i]; - if (qr.duration === 0) { - submit.disabled = false; - submit.value = 'Submit'; - } else { - submit.value = qr.duration; - } - } - if (qr.duration === 0) { - return clearInterval(qr.cooldownIntervalID); + _results.push(qr.duration ? submit.value = qr.duration : (submit.disabled = false, submit.value = 'Submit', window.clearInterval(qr.cooldownIntervalID))); } + return _results; }, dialog: function(link) { var MAX_FILE_SIZE, THREAD_ID, c, challenge, dialog, html, m, mail, name, pass, spoiler, src; diff --git a/script.coffee b/script.coffee index 5fb8513cb..674613be3 100644 --- a/script.coffee +++ b/script.coffee @@ -26,7 +26,7 @@ config = 'Image Preloading': [false, 'Preload Images'] 'Sauce': [true, 'Add sauce to images'] post: - 'Cooldown': [false, 'Prevent \'flood detected\' errors (buggy)'] + 'Cooldown': [true, 'Prevent \'flood detected\' errors (buggy)'] 'Quick Reply': [true, 'Reply without leaving the page'] 'Persistent QR': [false, 'Quick reply won\'t disappear after posting. Only in replies.'] quote: @@ -887,18 +887,16 @@ qr = qr.duration = duration cooldownCB: -> - qr.duration = qr.duration - 1 + qr.duration-- submits = $$ '#com_submit' for submit in submits - if qr.duration == 0 + if qr.duration + submit.value = qr.duration + else submit.disabled = false submit.value = 'Submit' - else - submit.value = qr.duration - - if qr.duration == 0 - clearInterval qr.cooldownIntervalID + window.clearInterval qr.cooldownIntervalID dialog: (link) -> #maybe should be global