diff --git a/src/Posting/Captcha.v2.coffee b/src/Posting/Captcha.v2.coffee index 1e0e8c75b..14a45faf8 100644 --- a/src/Posting/Captcha.v2.coffee +++ b/src/Posting/Captcha.v2.coffee @@ -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