From 4e08b758953fb2984d63c13ab8608c4f2f6d7a8b Mon Sep 17 00:00:00 2001 From: James Campos Date: Tue, 12 Oct 2010 03:24:57 -0700 Subject: [PATCH] clear captcha on submit --- 4chan_x.coffee | 9 +++++---- 4chan_x.js | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/4chan_x.coffee b/4chan_x.coffee index 7a928ee28..948e844d7 100644 --- a/4chan_x.coffee +++ b/4chan_x.coffee @@ -426,6 +426,7 @@ iframeLoad = -> qr.appendChild(span) else if REPLY and getConfig('Persistent QR') $('textarea', qr).value = '' + $('input[name=recaptcha_response_field]', qr).value = '' else remove qr @@ -435,8 +436,10 @@ iframeLoad = -> submit = (e) -> if span = @nextSibling remove(span) - recaptcha = $('#recaptcha_response_field', this) - if not recaptcha.value + recaptcha = $('input[name=recaptcha_response_field]', this) + if recaptcha.value + $('#qr input[title=autohide]:not(:checked)')?.click() + else e.preventDefault() span = n 'span', { className: 'error' @@ -445,8 +448,6 @@ submit = (e) -> @parentNode.appendChild span alert 'You forgot to type in the verification.' recaptcha.focus() - else - $('#qr input[title=autohide]:not(:checked)')?.click() autohide = -> diff --git a/4chan_x.js b/4chan_x.js index f9b9817a8..5601b2282 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -466,6 +466,7 @@ qr.appendChild(span); } else if (REPLY && getConfig('Persistent QR')) { $('textarea', qr).value = ''; + $('input[name=recaptcha_response_field]', qr).value = ''; } else { remove(qr); } @@ -476,8 +477,10 @@ if (span = this.nextSibling) { remove(span); } - recaptcha = $('#recaptcha_response_field', this); - if (!recaptcha.value) { + recaptcha = $('input[name=recaptcha_response_field]', this); + if (recaptcha.value) { + return (typeof (_ref3 = ((_ref2 = $('#qr input[title=autohide]:not(:checked)')))) === "undefined" || _ref3 === null) ? undefined : _ref3.click(); + } else { e.preventDefault(); span = n('span', { className: 'error', @@ -486,8 +489,6 @@ this.parentNode.appendChild(span); alert('You forgot to type in the verification.'); return recaptcha.focus(); - } else { - return (typeof (_ref3 = ((_ref2 = $('#qr input[title=autohide]:not(:checked)')))) === "undefined" || _ref3 === null) ? undefined : _ref3.click(); } }; autohide = function() {