diff --git a/4chan_x.user.js b/4chan_x.user.js index 6732f86d8..3cc5f1c32 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1291,15 +1291,20 @@ } }, captchaNode: function(e) { - var c; - c = e.target.value; - if (QR.qr) { - $('img', QR.qr).src = "http://www.google.com/recaptcha/api/image?c=" + c; - } - return QR.captcha = { - challenge: c, + QR.captcha = { + challenge: e.target.value, time: Date.now() }; + return QR.captchaImg(); + }, + captchaImg: function() { + var c, qr; + qr = QR.qr; + if (!qr) { + return; + } + c = QR.captcha.challenge; + return $('img', qr).src = "http://www.google.com/recaptcha/api/image?c=" + c; }, captchaPush: function(el) { var captcha, captchas; @@ -1377,12 +1382,13 @@ QR.qr = qr = ui.dialog('qr', { top: '0', left: '0' - }, " X
Quick Reply
" + QR.spoiler + "
" + QR.file + "
attach another file
"); + }, " X
Quick Reply
" + QR.spoiler + "
" + QR.file + "
attach another file
"); c = d.cookie; $('[name=name]', qr).value = (m = c.match(/4chan_name=([^;]+)/)) ? decodeURIComponent(m[1]) : ''; $('[name=email]', qr).value = (m = c.match(/4chan_email=([^;]+)/)) ? decodeURIComponent(m[1]) : ''; $('[name=pwd]', qr).value = (m = c.match(/4chan_pass=([^;]+)/)) ? decodeURIComponent(m[1]) : $('input[name=pwd]').value; $('textarea', qr).value = text; + QR.captchaImg(); QR.captchaLength(); if (conf['Cooldown']) { QR.cooldown(); diff --git a/script.coffee b/script.coffee index c2d3fd591..040b91457 100644 --- a/script.coffee +++ b/script.coffee @@ -1013,11 +1013,15 @@ QR = else QR.resetFile old captchaNode: (e) -> - c = e.target.value - $('img', QR.qr).src = "http://www.google.com/recaptcha/api/image?c=#{c}" if QR.qr QR.captcha = - challenge: c + challenge: e.target.value time: Date.now() + QR.captchaImg() + captchaImg: -> + {qr} = QR + return unless qr + c = QR.captcha.challenge + $('img', qr).src = "http://www.google.com/recaptcha/api/image?c=#{c}" captchaPush: (el) -> {captcha} = QR captcha.response = el.value @@ -1078,7 +1082,7 @@ QR =
#{QR.spoiler}
-
+
#{QR.file}
@@ -1092,6 +1096,7 @@ QR = $('[name=email]', qr).value = if m = c.match(/4chan_email=([^;]+)/) then decodeURIComponent m[1] else '' $('[name=pwd]', qr).value = if m = c.match(/4chan_pass=([^;]+)/) then decodeURIComponent m[1] else $('input[name=pwd]').value $('textarea', qr).value = text + QR.captchaImg() QR.captchaLength() QR.cooldown() if conf['Cooldown'] $.bind $('.close', qr), 'click', QR.close