diff --git a/src/Posting/Captcha.noscript.coffee b/src/Posting/Captcha.noscript.coffee index b710606cb..4d62ca118 100644 --- a/src/Posting/Captcha.noscript.coffee +++ b/src/Posting/Captcha.noscript.coffee @@ -1,6 +1,7 @@ Captcha.noscript = lifetime: 120 * $.SECOND iframeURL: '//www.google.com/recaptcha/api/fallback?k=<%= meta.recaptchaKey %>' + timers: {} init: -> return if d.cookie.indexOf('pass_enabled=1') >= 0 @@ -159,7 +160,8 @@ Captcha.noscript = img.src = src input.value = '' @clear() - setTimeout @reload.bind(@), @lifetime + clearTimeout @timers.reload + @timers.reload = setTimeout @reload.bind(@), @lifetime count: -> count = if @captchas then @captchas.length else 0 @@ -173,11 +175,12 @@ Captcha.noscript = " (#{count} cached captchas)" @nodes.input.placeholder = placeholder @nodes.input.alt = count # For XTRM RICE. - clearTimeout @timeout + clearTimeout @timers.clear if @captchas.length - @timeout = setTimeout @clear.bind(@), @captchas[0].timeout - Date.now() + @timers.clear = setTimeout @clear.bind(@), @captchas[0].timeout - Date.now() reload: (focus) -> + return unless @nodes.iframe @nodes.iframe.src = @iframeURL delete @iframeUsed @nodes.input.focus() if focus