Captcha should steal focus from submit button or body only.
This commit is contained in:
parent
f0d76d8ef7
commit
d6e16c8eac
@ -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
|
@nodes.input.focus() if focus and d.activeElement in [QR.nodes.status, d.body]
|
||||||
|
|
||||||
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 not QR.inBubble()
|
@nodes.counter.focus() if focus and d.activeElement in [QR.nodes.status, d.body]
|
||||||
if @timeouts.destroy
|
if @timeouts.destroy
|
||||||
clearTimeout @timeouts.destroy
|
clearTimeout @timeouts.destroy
|
||||||
delete @timeouts.destroy
|
delete @timeouts.destroy
|
||||||
@ -213,7 +213,7 @@ Captcha.v2 =
|
|||||||
@captchas = @captchas[i..]
|
@captchas = @captchas[i..]
|
||||||
@count()
|
@count()
|
||||||
$.set 'captchas', @captchas
|
$.set 'captchas', @captchas
|
||||||
@setup(d.activeElement is QR.nodes.status)
|
@setup true
|
||||||
|
|
||||||
count: ->
|
count: ->
|
||||||
@nodes.counter.textContent = "Captchas: #{@captchas.length}"
|
@nodes.counter.textContent = "Captchas: #{@captchas.length}"
|
||||||
|
|||||||
@ -773,7 +773,7 @@ QR =
|
|||||||
QR.cooldown.addMute seconds
|
QR.cooldown.addMute seconds
|
||||||
else
|
else
|
||||||
QR.cooldown.addDelay post, seconds
|
QR.cooldown.addDelay post, seconds
|
||||||
QR.captcha.setup (d.activeElement is QR.nodes.status)
|
QR.captcha.setup true
|
||||||
else # stop auto-posting
|
else # stop auto-posting
|
||||||
QR.cooldown.auto = false
|
QR.cooldown.auto = false
|
||||||
QR.status()
|
QR.status()
|
||||||
@ -815,7 +815,7 @@ QR =
|
|||||||
QR.close()
|
QR.close()
|
||||||
else
|
else
|
||||||
post.rm()
|
post.rm()
|
||||||
QR.captcha.setup(d.activeElement is QR.nodes.status)
|
QR.captcha.setup true
|
||||||
|
|
||||||
QR.cooldown.add threadID, postID
|
QR.cooldown.add threadID, postID
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user