Captcha should steal focus from submit button or body only.

This commit is contained in:
ccd0 2015-11-17 20:10:19 -08:00
parent f0d76d8ef7
commit d6e16c8eac
3 changed files with 5 additions and 5 deletions

View File

@ -95,7 +95,7 @@ Captcha.v1 =
setup: (focus, force) ->
return unless @isEnabled and (force or @needed())
@create()
@nodes.input.focus() if focus
@nodes.input.focus() if focus and d.activeElement in [QR.nodes.status, d.body]
afterSetup: ->
return unless challenge = $.id 'recaptcha_challenge_field_holder'

View File

@ -73,7 +73,7 @@ Captcha.v2 =
setup: (focus, 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
clearTimeout @timeouts.destroy
delete @timeouts.destroy
@ -213,7 +213,7 @@ Captcha.v2 =
@captchas = @captchas[i..]
@count()
$.set 'captchas', @captchas
@setup(d.activeElement is QR.nodes.status)
@setup true
count: ->
@nodes.counter.textContent = "Captchas: #{@captchas.length}"

View File

@ -773,7 +773,7 @@ QR =
QR.cooldown.addMute seconds
else
QR.cooldown.addDelay post, seconds
QR.captcha.setup (d.activeElement is QR.nodes.status)
QR.captcha.setup true
else # stop auto-posting
QR.cooldown.auto = false
QR.status()
@ -815,7 +815,7 @@ QR =
QR.close()
else
post.rm()
QR.captcha.setup(d.activeElement is QR.nodes.status)
QR.captcha.setup true
QR.cooldown.add threadID, postID