diff --git a/4chan_x.user.js b/4chan_x.user.js
index f2f69ce0e..6732f86d8 100644
--- a/4chan_x.user.js
+++ b/4chan_x.user.js
@@ -1310,7 +1310,7 @@
$.set('captchas', captchas);
el.value = '';
Recaptcha.reload();
- return el.nextSibling.textContent = captchas.length + ' captchas';
+ return captchaLength(captchas);
},
captchaShift: function() {
var captcha, captchas, cutoff;
@@ -1322,9 +1322,13 @@
}
}
$.set('captchas', captchas);
- $('#cl', QR.qr).textContent = captchas.length + ' captchas';
+ captchaLength(captchas);
return captcha;
},
+ captchaLength: function(captchas) {
+ captchas || (captchas = $.get('captchas', []));
+ return $('#cl', QR.qr).textContent = captchas.length + ' captchas';
+ },
change: function(e) {
if (this.files[0].size > QR.MAX_FILE_SIZE) {
alert('Error: File too large.');
@@ -1373,12 +1377,13 @@
QR.qr = qr = ui.dialog('qr', {
top: '0',
left: '0'
- }, " X
Quick Reply
");
+ }, " X Quick Reply
");
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.captchaLength();
if (conf['Cooldown']) {
QR.cooldown();
}
diff --git a/script.coffee b/script.coffee
index 0da5193e2..70c753aaf 100644
--- a/script.coffee
+++ b/script.coffee
@@ -1025,7 +1025,7 @@ QR =
$.set 'captchas', captchas
el.value = ''
Recaptcha.reload()
- el.nextSibling.textContent = captchas.length + ' captchas'
+ captchaLength captchas
captchaShift: ->
captchas = $.get 'captchas', []
cutoff = Date.now() - 5*HOUR + 5*MINUTE
@@ -1033,8 +1033,11 @@ QR =
if captcha.time > cutoff
break
$.set 'captchas', captchas
- $('#cl', QR.qr).textContent = captchas.length + ' captchas'
+ captchaLength captchas
captcha
+ captchaLength: (captchas) ->
+ captchas or= $.get 'captchas', []
+ $('#cl', QR.qr).textContent = captchas.length + ' captchas'
change: (e) ->
if @files[0].size > QR.MAX_FILE_SIZE
alert 'Error: File too large.'
@@ -1075,7 +1078,7 @@ QR =
- #{$.get('captchas', []).length} captchas
+
#{QR.file}
@@ -1088,6 +1091,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.captchaLength()
QR.cooldown() if conf['Cooldown']
$.bind $('.close', qr), 'click', QR.close
$.bind $('form', qr), 'submit', QR.submit