diff --git a/4chan_x.coffee b/4chan_x.coffee index 7bf6b3ec0..06e6e5a14 100644 --- a/4chan_x.coffee +++ b/4chan_x.coffee @@ -444,7 +444,7 @@ submit = (e) -> alert 'You forgot to type in the verification.' recaptcha.focus() else - @style.visibility = 'collapse' + $('#qr input[title=autohide]:not(:checked)')?.click() autohide = -> @@ -503,7 +503,10 @@ quickReply = (e) -> } clone.appendChild(input) qr.appendChild(clone) - document.body.appendChild(qr) + inBefore(document.body.firstChild, qr) + #XXX - put qr first in body, so `Recaptcha.reload()`, + # when using document.getElementById, sees and focuses this + # instead of the original. if e e.preventDefault() @@ -739,10 +742,6 @@ if getConfig('Quick Reply') quote.addEventListener('click', quickReply, true) ) - #hack - nuke the original recaptcha's id so it doesn't grab focus - # when reloading - $('form[name=post] input[name=recaptcha_response_field]').id = '' - if getConfig('Quick Report') callbacks.push((root) -> diff --git a/4chan_x.js b/4chan_x.js index fab6bdb46..e751c7c70 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -470,7 +470,7 @@ } }; submit = function(e) { - var recaptcha, span; + var _ref2, _ref3, recaptcha, span; if (span = this.nextSibling) { remove(span); } @@ -485,7 +485,7 @@ alert('You forgot to type in the verification.'); return recaptcha.focus(); } else { - return (this.style.visibility = 'collapse'); + return (typeof (_ref3 = ((_ref2 = $('#qr input[title=autohide]:not(:checked)')))) === "undefined" || _ref3 === null) ? undefined : _ref3.click(); } }; autohide = function() { @@ -545,7 +545,7 @@ clone.appendChild(input); } qr.appendChild(clone); - document.body.appendChild(qr); + inBefore(document.body.firstChild, qr); } if (e) { e.preventDefault(); @@ -822,7 +822,6 @@ } return _result; }); - $('form[name=post] input[name=recaptcha_response_field]').id = ''; } if (getConfig('Quick Report')) { callbacks.push(function(root) {