Provide a visual indication that the captcha is loading.
This commit is contained in:
parent
6a3f0f44bb
commit
c85aebbceb
@ -37,6 +37,7 @@ Captcha.cache =
|
|||||||
if !$.event('RequestCaptcha', {isReply})
|
if !$.event('RequestCaptcha', {isReply})
|
||||||
@prerequested = true
|
@prerequested = true
|
||||||
@submitCB = @save.bind(@)
|
@submitCB = @save.bind(@)
|
||||||
|
@updateCount()
|
||||||
|
|
||||||
haveCookie: ->
|
haveCookie: ->
|
||||||
/\b_ct=/.test(d.cookie) and QR.posts[0].thread isnt 'new'
|
/\b_ct=/.test(d.cookie) and QR.posts[0].thread isnt 'new'
|
||||||
@ -53,17 +54,21 @@ Captcha.cache =
|
|||||||
request: (isReply) ->
|
request: (isReply) ->
|
||||||
if !@submitCB
|
if !@submitCB
|
||||||
return if $.event('RequestCaptcha', {isReply})
|
return if $.event('RequestCaptcha', {isReply})
|
||||||
(cb) => @submitCB = cb
|
(cb) =>
|
||||||
|
@submitCB = cb
|
||||||
|
@updateCount()
|
||||||
|
|
||||||
abort: ->
|
abort: ->
|
||||||
if @submitCB
|
if @submitCB
|
||||||
delete @submitCB
|
delete @submitCB
|
||||||
$.event 'AbortCaptcha'
|
$.event 'AbortCaptcha'
|
||||||
|
@updateCount()
|
||||||
|
|
||||||
saveAPI: (captcha) ->
|
saveAPI: (captcha) ->
|
||||||
if (cb = @submitCB)
|
if (cb = @submitCB)
|
||||||
delete @submitCB
|
delete @submitCB
|
||||||
cb captcha
|
cb captcha
|
||||||
|
@updateCount()
|
||||||
else
|
else
|
||||||
@save captcha
|
@save captcha
|
||||||
|
|
||||||
@ -74,6 +79,7 @@ Captcha.cache =
|
|||||||
QR.captcha.setup(d.activeElement is QR.nodes.status)
|
QR.captcha.setup(d.activeElement is QR.nodes.status)
|
||||||
delete @submitCB
|
delete @submitCB
|
||||||
cb()
|
cb()
|
||||||
|
@updateCount()
|
||||||
|
|
||||||
save: (captcha) ->
|
save: (captcha) ->
|
||||||
if (cb = @submitCB)
|
if (cb = @submitCB)
|
||||||
@ -97,4 +103,7 @@ Captcha.cache =
|
|||||||
clearTimeout @timer
|
clearTimeout @timer
|
||||||
if @captchas.length
|
if @captchas.length
|
||||||
@timer = setTimeout @clear.bind(@), @captchas[0].timeout - Date.now()
|
@timer = setTimeout @clear.bind(@), @captchas[0].timeout - Date.now()
|
||||||
|
@updateCount()
|
||||||
|
|
||||||
|
updateCount: ->
|
||||||
$.event 'CaptchaCount', @captchas.length
|
$.event 'CaptchaCount', @captchas.length
|
||||||
|
|||||||
@ -181,7 +181,8 @@ Captcha.v2 =
|
|||||||
|
|
||||||
count: ->
|
count: ->
|
||||||
count = Captcha.cache.getCount()
|
count = Captcha.cache.getCount()
|
||||||
@nodes.counter.textContent = "Captchas: #{count}"
|
loading = if Captcha.cache.submitCB then '...' else ''
|
||||||
|
@nodes.counter.textContent = "Captchas: #{count}#{loading}"
|
||||||
@moreNeeded()
|
@moreNeeded()
|
||||||
|
|
||||||
reload: ->
|
reload: ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user