Fix captcha going below bottom of page due to delay in iframe loading.

This commit is contained in:
ccd0 2015-11-23 23:39:04 -08:00
parent 34dfa8116c
commit 8734faf4c2

View File

@ -135,15 +135,19 @@ Captcha.v2 =
setupIFrame: (iframe) ->
Captcha.replace.iframe iframe
$.addClass QR.nodes.el, 'captcha-open'
if QR.nodes.el.getBoundingClientRect().bottom > doc.clientHeight
QR.nodes.el.style.top = null
QR.nodes.el.style.bottom = '0px'
@fixQRPosition()
$.on iframe, 'load', @fixQRPosition
iframe.focus() if d.activeElement is @nodes.counter
# XXX Stop Recaptcha from changing focus from iframe -> body -> iframe on submit.
$.global ->
f = document.querySelector('#qr iframe')
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) ->
$.one textarea, 'input', => @save true