Fix captcha going below bottom of page due to delay in iframe loading.
This commit is contained in:
parent
34dfa8116c
commit
8734faf4c2
@ -135,15 +135,19 @@ Captcha.v2 =
|
|||||||
setupIFrame: (iframe) ->
|
setupIFrame: (iframe) ->
|
||||||
Captcha.replace.iframe iframe
|
Captcha.replace.iframe iframe
|
||||||
$.addClass QR.nodes.el, 'captcha-open'
|
$.addClass QR.nodes.el, 'captcha-open'
|
||||||
if QR.nodes.el.getBoundingClientRect().bottom > doc.clientHeight
|
@fixQRPosition()
|
||||||
QR.nodes.el.style.top = null
|
$.on iframe, 'load', @fixQRPosition
|
||||||
QR.nodes.el.style.bottom = '0px'
|
|
||||||
iframe.focus() if d.activeElement is @nodes.counter
|
iframe.focus() if d.activeElement is @nodes.counter
|
||||||
# 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')
|
||||||
f.focus = f.blur = ->
|
f.focus = f.blur = ->
|
||||||
|
|
||||||
|
fixQRPosition: ->
|
||||||
|
if QR.nodes.el.getBoundingClientRect().bottom > doc.clientHeight
|
||||||
|
QR.nodes.el.style.top = null
|
||||||
|
QR.nodes.el.style.bottom = '0px'
|
||||||
|
|
||||||
setupTextArea: (textarea) ->
|
setupTextArea: (textarea) ->
|
||||||
$.one textarea, 'input', => @save true
|
$.one textarea, 'input', => @save true
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user