Replace shouldFocus flag with focus on counter.
This commit is contained in:
parent
dc75f6fb0e
commit
f0d76d8ef7
@ -42,7 +42,6 @@ Captcha.v2 =
|
|||||||
conn = new Connection window.parent, "#{location.protocol}//boards.4chan.org"
|
conn = new Connection window.parent, "#{location.protocol}//boards.4chan.org"
|
||||||
conn.send {token}
|
conn.send {token}
|
||||||
|
|
||||||
shouldFocus: false
|
|
||||||
timeouts: {}
|
timeouts: {}
|
||||||
postsCount: 0
|
postsCount: 0
|
||||||
|
|
||||||
@ -74,17 +73,16 @@ Captcha.v2 =
|
|||||||
|
|
||||||
setup: (focus, force) ->
|
setup: (focus, force) ->
|
||||||
return unless @isEnabled and (@needed() or force)
|
return unless @isEnabled and (@needed() or force)
|
||||||
@shouldFocus = true if focus and not QR.inBubble()
|
@nodes.counter.focus() if focus and not QR.inBubble()
|
||||||
if @timeouts.destroy
|
if @timeouts.destroy
|
||||||
clearTimeout @timeouts.destroy
|
clearTimeout @timeouts.destroy
|
||||||
delete @timeouts.destroy
|
delete @timeouts.destroy
|
||||||
return @reload()
|
return @reload()
|
||||||
|
|
||||||
if @nodes.container
|
if @nodes.container
|
||||||
if @shouldFocus and iframe = $ 'iframe', @nodes.container
|
if d.activeElement is @nodes.counter and (iframe = $ 'iframe', @nodes.container)
|
||||||
iframe.focus()
|
iframe.focus()
|
||||||
QR.focus() # Event handler not fired in Firefox
|
QR.focus() # Event handler not fired in Firefox
|
||||||
delete @shouldFocus
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@nodes.container = $.el 'div', className: 'captcha-container'
|
@nodes.container = $.el 'div', className: 'captcha-container'
|
||||||
@ -143,8 +141,7 @@ Captcha.v2 =
|
|||||||
if QR.nodes.el.getBoundingClientRect().bottom > doc.clientHeight
|
if QR.nodes.el.getBoundingClientRect().bottom > doc.clientHeight
|
||||||
QR.nodes.el.style.top = null
|
QR.nodes.el.style.top = null
|
||||||
QR.nodes.el.style.bottom = '0px'
|
QR.nodes.el.style.bottom = '0px'
|
||||||
iframe.focus() if @shouldFocus
|
iframe.focus() if d.activeElement is @nodes.counter
|
||||||
@shouldFocus = false
|
|
||||||
# XXX Stop Recaptcha from changing focus from iframe -> body -> iframe on submit.
|
# XXX Stop Recaptcha from changing focus from iframe -> body -> iframe on submit.
|
||||||
$.global ->
|
$.global ->
|
||||||
f = document.querySelector('#qr iframe')
|
f = document.querySelector('#qr iframe')
|
||||||
@ -193,7 +190,7 @@ Captcha.v2 =
|
|||||||
if @needed()
|
if @needed()
|
||||||
if focus
|
if focus
|
||||||
if QR.cooldown.auto or Conf['Post on Captcha Completion']
|
if QR.cooldown.auto or Conf['Post on Captcha Completion']
|
||||||
@shouldFocus = true
|
@nodes.counter.focus()
|
||||||
else
|
else
|
||||||
QR.nodes.status.focus()
|
QR.nodes.status.focus()
|
||||||
@reload()
|
@reload()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user