diff --git a/4chan_x.user.js b/4chan_x.user.js index 4baaab5c9..416d632bc 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1184,6 +1184,9 @@ start: function() { var submit, _i, _len, _ref; cooldown.duration = Math.ceil(($.get(g.BOARD + '/cooldown', 0) - Date.now()) / 1000); + if (!(cooldown.duration > 0)) { + return; + } _ref = $$('#com_submit'); for (_i = 0, _len = _ref.length; _i < _len; _i++) { submit = _ref[_i]; @@ -1195,7 +1198,7 @@ cb: function() { var submit, submits, _i, _j, _len, _len2, _results; submits = $$('#com_submit'); - if (--cooldown.duration > 0) { + if (--cooldown.duration) { setTimeout(cooldown.cb, 1000); _results = []; for (_i = 0, _len = submits.length; _i < _len; _i++) { diff --git a/script.coffee b/script.coffee index 3eb5e1083..d4b25512d 100644 --- a/script.coffee +++ b/script.coffee @@ -939,6 +939,7 @@ cooldown = start: -> cooldown.duration = Math.ceil ($.get(g.BOARD+'/cooldown', 0) - Date.now()) / 1000 + return unless cooldown.duration > 0 for submit in $$ '#com_submit' submit.value = cooldown.duration submit.disabled = true @@ -946,7 +947,7 @@ cooldown = cb: -> submits = $$ '#com_submit' - if --cooldown.duration > 0 + if --cooldown.duration setTimeout cooldown.cb, 1000 for submit in submits submit.value = cooldown.duration