Fix reloading bug.
This commit is contained in:
parent
e206c90751
commit
183f878f0c
@ -1,6 +1,7 @@
|
|||||||
Captcha.noscript =
|
Captcha.noscript =
|
||||||
lifetime: 120 * $.SECOND
|
lifetime: 120 * $.SECOND
|
||||||
iframeURL: '//www.google.com/recaptcha/api/fallback?k=<%= meta.recaptchaKey %>'
|
iframeURL: '//www.google.com/recaptcha/api/fallback?k=<%= meta.recaptchaKey %>'
|
||||||
|
timers: {}
|
||||||
|
|
||||||
init: ->
|
init: ->
|
||||||
return if d.cookie.indexOf('pass_enabled=1') >= 0
|
return if d.cookie.indexOf('pass_enabled=1') >= 0
|
||||||
@ -159,7 +160,8 @@ Captcha.noscript =
|
|||||||
img.src = src
|
img.src = src
|
||||||
input.value = ''
|
input.value = ''
|
||||||
@clear()
|
@clear()
|
||||||
setTimeout @reload.bind(@), @lifetime
|
clearTimeout @timers.reload
|
||||||
|
@timers.reload = setTimeout @reload.bind(@), @lifetime
|
||||||
|
|
||||||
count: ->
|
count: ->
|
||||||
count = if @captchas then @captchas.length else 0
|
count = if @captchas then @captchas.length else 0
|
||||||
@ -173,11 +175,12 @@ Captcha.noscript =
|
|||||||
" (#{count} cached captchas)"
|
" (#{count} cached captchas)"
|
||||||
@nodes.input.placeholder = placeholder
|
@nodes.input.placeholder = placeholder
|
||||||
@nodes.input.alt = count # For XTRM RICE.
|
@nodes.input.alt = count # For XTRM RICE.
|
||||||
clearTimeout @timeout
|
clearTimeout @timers.clear
|
||||||
if @captchas.length
|
if @captchas.length
|
||||||
@timeout = setTimeout @clear.bind(@), @captchas[0].timeout - Date.now()
|
@timers.clear = setTimeout @clear.bind(@), @captchas[0].timeout - Date.now()
|
||||||
|
|
||||||
reload: (focus) ->
|
reload: (focus) ->
|
||||||
|
return unless @nodes.iframe
|
||||||
@nodes.iframe.src = @iframeURL
|
@nodes.iframe.src = @iframeURL
|
||||||
delete @iframeUsed
|
delete @iframeUsed
|
||||||
@nodes.input.focus() if focus
|
@nodes.input.focus() if focus
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user