diff --git a/4chan_x.user.js b/4chan_x.user.js index d53686af7..1cbfe38b7 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1270,7 +1270,8 @@ return $.rm(this.parentNode); }); $.add(files, box); - return file.click(); + file.click(); + return QR.stats(); }, captchaNode: function(e) { QR.captcha = { @@ -1297,7 +1298,7 @@ $.set('captchas', captchas); el.value = ''; QR.captchaReload(); - return QR.captchaLength(captchas); + return QR.stats(captchas); }, captchaShift: function() { var captcha, captchas, cutoff; @@ -1309,12 +1310,15 @@ } } $.set('captchas', captchas); - QR.captchaLength(captchas); + QR.stats(captchas); return captcha; }, - captchaLength: function(captchas) { + stats: function(captchas) { + var images, qr; + qr = QR.qr; captchas || (captchas = $.get('captchas', [])); - return $('#cl', QR.qr).textContent = captchas.length + ' captchas'; + images = $$('#files input', qr); + return $('#qr_stats', qr).textContent = "" + images.length + " / " + captchas.length; }, captchaReload: function() { return window.location = 'javascript:Recaptcha.reload()'; @@ -1371,7 +1375,7 @@ text = ''; } tid || (tid = g.THREAD_ID || ''); - QR.qr = qr = ui.dialog('qr', 'top: 0; right: 0;', "
X
120 Captchas
" + (g.REPLY ? "" : '') + " " + QR.spoiler + "
"); + QR.qr = qr = ui.dialog('qr', 'top: 0; right: 0;', "
X
" + (g.REPLY ? "" : '') + " " + QR.spoiler + "
"); 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]) : ''; @@ -1385,7 +1389,7 @@ $.bind($('form', qr), 'submit', QR.submit); $.bind($('#recaptcha_response_field', qr), 'keydown', QR.keydown); QR.captchaImg(); - QR.captchaLength(); + QR.stats(); $.add(d.body, qr); ta = $('textarea', qr); l = text.length; @@ -1453,6 +1457,7 @@ if (row) { $.rm(row); } + QR.stats(); setTimeout(QR.submit, 1000); } else if (tc === 'You seem to have mistyped the verification.') { setTimeout(QR.submit, 1000); @@ -1462,6 +1467,7 @@ if (row) { $.rm(row); } + QR.stats(); if (conf['Persistent QR'] || ((_ref2 = $('#files input', qr)) != null ? _ref2.files.length : void 0)) { QR.reset(); } else { diff --git a/script.coffee b/script.coffee index e5005d4a6..ffcba0909 100644 --- a/script.coffee +++ b/script.coffee @@ -980,6 +980,7 @@ QR = $.bind $('.x', box), 'click', -> $.rm @parentNode $.add files, box file.click() + QR.stats() captchaNode: (e) -> QR.captcha = challenge: e.target.value @@ -998,7 +999,7 @@ QR = $.set 'captchas', captchas el.value = '' QR.captchaReload() - QR.captchaLength captchas + QR.stats captchas captchaShift: -> captchas = $.get 'captchas', [] cutoff = Date.now() - 5*HOUR + 5*MINUTE @@ -1006,11 +1007,13 @@ QR = if captcha.time > cutoff break $.set 'captchas', captchas - QR.captchaLength captchas + QR.stats captchas captcha - captchaLength: (captchas) -> + stats: (captchas) -> + {qr} = QR captchas or= $.get 'captchas', [] - $('#cl', QR.qr).textContent = captchas.length + ' captchas' + images = $$ '#files input', qr + $('#qr_stats', qr).textContent = "#{images.length} / #{captchas.length}" captchaReload: -> window.location = 'javascript:Recaptcha.reload()' change: (e) -> @@ -1049,7 +1052,7 @@ QR = tid or= g.THREAD_ID or '' QR.qr = qr = ui.dialog 'qr', 'top: 0; right: 0;', "
- + X
@@ -1071,7 +1074,6 @@ QR =
- 120 Captchas
@@ -1096,7 +1098,7 @@ QR = $.bind $('form', qr), 'submit', QR.submit $.bind $('#recaptcha_response_field', qr), 'keydown', QR.keydown QR.captchaImg() - QR.captchaLength() + QR.stats() $.add d.body, qr ta = $ 'textarea', qr l = text.length @@ -1147,11 +1149,13 @@ QR = tc = data.textContent if tc is 'Error: Duplicate file entry detected.' $.rm row if row + QR.stats() setTimeout QR.submit, 1000 else if tc is 'You seem to have mistyped the verification.' setTimeout QR.submit, 1000 return $.rm row if row + QR.stats() if conf['Persistent QR'] or $('#files input', qr)?.files.length QR.reset() else