Testing current focus in setup() wasn't flexible enough.
This commit is contained in:
parent
6254601b5d
commit
9231c8e9dc
@ -95,7 +95,7 @@ Captcha.v1 =
|
|||||||
setup: (focus, force) ->
|
setup: (focus, force) ->
|
||||||
return unless @isEnabled and (force or @needed())
|
return unless @isEnabled and (force or @needed())
|
||||||
@create()
|
@create()
|
||||||
@nodes.input.focus() if focus and d.activeElement in [QR.nodes.status, d.body]
|
@nodes.input.focus() if focus
|
||||||
|
|
||||||
afterSetup: ->
|
afterSetup: ->
|
||||||
return unless challenge = $.id 'recaptcha_challenge_field_holder'
|
return unless challenge = $.id 'recaptcha_challenge_field_holder'
|
||||||
|
|||||||
@ -73,7 +73,7 @@ Captcha.v2 =
|
|||||||
|
|
||||||
setup: (focus, force) ->
|
setup: (focus, force) ->
|
||||||
return unless @isEnabled and (@needed() or force)
|
return unless @isEnabled and (@needed() or force)
|
||||||
@nodes.counter.focus() if focus and d.activeElement in [QR.nodes.status, d.body]
|
@nodes.counter.focus() if focus
|
||||||
if @timeouts.destroy
|
if @timeouts.destroy
|
||||||
clearTimeout @timeouts.destroy
|
clearTimeout @timeouts.destroy
|
||||||
delete @timeouts.destroy
|
delete @timeouts.destroy
|
||||||
@ -214,7 +214,7 @@ Captcha.v2 =
|
|||||||
@captchas = @captchas[i..]
|
@captchas = @captchas[i..]
|
||||||
@count()
|
@count()
|
||||||
$.set 'captchas', @captchas
|
$.set 'captchas', @captchas
|
||||||
@setup true
|
@setup(d.activeElement is QR.nodes.status)
|
||||||
|
|
||||||
count: ->
|
count: ->
|
||||||
@nodes.counter.textContent = "Captchas: #{@captchas.length}"
|
@nodes.counter.textContent = "Captchas: #{@captchas.length}"
|
||||||
|
|||||||
@ -633,7 +633,7 @@ QR =
|
|||||||
captcha = QR.captcha.getOne()
|
captcha = QR.captcha.getOne()
|
||||||
unless captcha
|
unless captcha
|
||||||
err = 'No valid captcha.'
|
err = 'No valid captcha.'
|
||||||
QR.captcha.setup true
|
QR.captcha.setup(!QR.cooldown.auto or d.activeElement is QR.nodes.status)
|
||||||
|
|
||||||
QR.cleanNotifications()
|
QR.cleanNotifications()
|
||||||
if err
|
if err
|
||||||
@ -769,7 +769,7 @@ QR =
|
|||||||
QR.cooldown.addDelay post, seconds
|
QR.cooldown.addDelay post, seconds
|
||||||
else # stop auto-posting
|
else # stop auto-posting
|
||||||
QR.cooldown.auto = false
|
QR.cooldown.auto = false
|
||||||
QR.captcha.setup QR.cooldown.auto
|
QR.captcha.setup(QR.cooldown.auto and d.activeElement is QR.nodes.status)
|
||||||
QR.cooldown.auto = false if QR.captcha.isEnabled and !QR.captcha.captchas.length
|
QR.cooldown.auto = false if QR.captcha.isEnabled and !QR.captcha.captchas.length
|
||||||
QR.status()
|
QR.status()
|
||||||
QR.error err
|
QR.error err
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user