This commit is contained in:
James Campos 2011-09-21 20:03:19 -07:00
parent e64730652a
commit ad3af8c087
2 changed files with 24 additions and 14 deletions

View File

@ -1270,7 +1270,8 @@
return $.rm(this.parentNode); return $.rm(this.parentNode);
}); });
$.add(files, box); $.add(files, box);
return file.click(); file.click();
return QR.stats();
}, },
captchaNode: function(e) { captchaNode: function(e) {
QR.captcha = { QR.captcha = {
@ -1297,7 +1298,7 @@
$.set('captchas', captchas); $.set('captchas', captchas);
el.value = ''; el.value = '';
QR.captchaReload(); QR.captchaReload();
return QR.captchaLength(captchas); return QR.stats(captchas);
}, },
captchaShift: function() { captchaShift: function() {
var captcha, captchas, cutoff; var captcha, captchas, cutoff;
@ -1309,12 +1310,15 @@
} }
} }
$.set('captchas', captchas); $.set('captchas', captchas);
QR.captchaLength(captchas); QR.stats(captchas);
return captcha; return captcha;
}, },
captchaLength: function(captchas) { stats: function(captchas) {
var images, qr;
qr = QR.qr;
captchas || (captchas = $.get('captchas', [])); 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() { captchaReload: function() {
return window.location = 'javascript:Recaptcha.reload()'; return window.location = 'javascript:Recaptcha.reload()';
@ -1371,7 +1375,7 @@
text = ''; text = '';
} }
tid || (tid = g.THREAD_ID || ''); tid || (tid = g.THREAD_ID || '');
QR.qr = qr = ui.dialog('qr', 'top: 0; right: 0;', " <div class=move> <span id=stats></span> <input type=checkbox id=autohide title=autohide> <a class=close>X</a> </div> <div> <button>File</button> <input form=qr_form placeholder=Name name=name> <input form=qr_form placeholder=Email name=email> <input form=qr_form placeholder=Subject name=sub> </div> <div class=autohide> <textarea form=qr_form placeholder=Comment name=com></textarea> <ul id=files></ul> <form enctype=multipart/form-data method=post action=http://sys.4chan.org/" + g.BOARD + "/post target=iframe id=qr_form> <div hidden> <input name=pwd> <input name=mode value=regist> <input name=recaptcha_challenge_field id=challenge> <input name=recaptcha_response_field id=response> </div> <div id=captcha> <div><img></div> <span id=cl>120 Captchas</span> <input id=recaptcha_response_field autocomplete=off> </div> <div> <button>Submit</button> " + (g.REPLY ? "<label>[<input type=checkbox id=autopost title=autopost> Autopost]</label>" : '') + " <input form=qr_form placeholder=Thread name=resto value=" + tid + " " + (g.REPLY ? 'hidden' : '') + "> " + QR.spoiler + " </div> </form> </div> <a class=error></a> "); QR.qr = qr = ui.dialog('qr', 'top: 0; right: 0;', " <div class=move> <span id=qr_stats></span> <input type=checkbox id=autohide title=autohide> <a class=close>X</a> </div> <div> <button>File</button> <input form=qr_form placeholder=Name name=name> <input form=qr_form placeholder=Email name=email> <input form=qr_form placeholder=Subject name=sub> </div> <div class=autohide> <textarea form=qr_form placeholder=Comment name=com></textarea> <ul id=files></ul> <form enctype=multipart/form-data method=post action=http://sys.4chan.org/" + g.BOARD + "/post target=iframe id=qr_form> <div hidden> <input name=pwd> <input name=mode value=regist> <input name=recaptcha_challenge_field id=challenge> <input name=recaptcha_response_field id=response> </div> <div id=captcha> <div><img></div> <input id=recaptcha_response_field autocomplete=off> </div> <div> <button>Submit</button> " + (g.REPLY ? "<label>[<input type=checkbox id=autopost title=autopost> Autopost]</label>" : '') + " <input form=qr_form placeholder=Thread name=resto value=" + tid + " " + (g.REPLY ? 'hidden' : '') + "> " + QR.spoiler + " </div> </form> </div> <a class=error></a> ");
c = d.cookie; c = d.cookie;
$('[name=name]', qr).value = (m = c.match(/4chan_name=([^;]+)/)) ? decodeURIComponent(m[1]) : ''; $('[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=email]', qr).value = (m = c.match(/4chan_email=([^;]+)/)) ? decodeURIComponent(m[1]) : '';
@ -1385,7 +1389,7 @@
$.bind($('form', qr), 'submit', QR.submit); $.bind($('form', qr), 'submit', QR.submit);
$.bind($('#recaptcha_response_field', qr), 'keydown', QR.keydown); $.bind($('#recaptcha_response_field', qr), 'keydown', QR.keydown);
QR.captchaImg(); QR.captchaImg();
QR.captchaLength(); QR.stats();
$.add(d.body, qr); $.add(d.body, qr);
ta = $('textarea', qr); ta = $('textarea', qr);
l = text.length; l = text.length;
@ -1453,6 +1457,7 @@
if (row) { if (row) {
$.rm(row); $.rm(row);
} }
QR.stats();
setTimeout(QR.submit, 1000); setTimeout(QR.submit, 1000);
} else if (tc === 'You seem to have mistyped the verification.') { } else if (tc === 'You seem to have mistyped the verification.') {
setTimeout(QR.submit, 1000); setTimeout(QR.submit, 1000);
@ -1462,6 +1467,7 @@
if (row) { if (row) {
$.rm(row); $.rm(row);
} }
QR.stats();
if (conf['Persistent QR'] || ((_ref2 = $('#files input', qr)) != null ? _ref2.files.length : void 0)) { if (conf['Persistent QR'] || ((_ref2 = $('#files input', qr)) != null ? _ref2.files.length : void 0)) {
QR.reset(); QR.reset();
} else { } else {

View File

@ -980,6 +980,7 @@ QR =
$.bind $('.x', box), 'click', -> $.rm @parentNode $.bind $('.x', box), 'click', -> $.rm @parentNode
$.add files, box $.add files, box
file.click() file.click()
QR.stats()
captchaNode: (e) -> captchaNode: (e) ->
QR.captcha = QR.captcha =
challenge: e.target.value challenge: e.target.value
@ -998,7 +999,7 @@ QR =
$.set 'captchas', captchas $.set 'captchas', captchas
el.value = '' el.value = ''
QR.captchaReload() QR.captchaReload()
QR.captchaLength captchas QR.stats captchas
captchaShift: -> captchaShift: ->
captchas = $.get 'captchas', [] captchas = $.get 'captchas', []
cutoff = Date.now() - 5*HOUR + 5*MINUTE cutoff = Date.now() - 5*HOUR + 5*MINUTE
@ -1006,11 +1007,13 @@ QR =
if captcha.time > cutoff if captcha.time > cutoff
break break
$.set 'captchas', captchas $.set 'captchas', captchas
QR.captchaLength captchas QR.stats captchas
captcha captcha
captchaLength: (captchas) -> stats: (captchas) ->
{qr} = QR
captchas or= $.get 'captchas', [] captchas or= $.get 'captchas', []
$('#cl', QR.qr).textContent = captchas.length + ' captchas' images = $$ '#files input', qr
$('#qr_stats', qr).textContent = "#{images.length} / #{captchas.length}"
captchaReload: -> captchaReload: ->
window.location = 'javascript:Recaptcha.reload()' window.location = 'javascript:Recaptcha.reload()'
change: (e) -> change: (e) ->
@ -1049,7 +1052,7 @@ QR =
tid or= g.THREAD_ID or '' tid or= g.THREAD_ID or ''
QR.qr = qr = ui.dialog 'qr', 'top: 0; right: 0;', " QR.qr = qr = ui.dialog 'qr', 'top: 0; right: 0;', "
<div class=move> <div class=move>
<span id=stats></span> <span id=qr_stats></span>
<input type=checkbox id=autohide title=autohide> <input type=checkbox id=autohide title=autohide>
<a class=close>X</a> <a class=close>X</a>
</div> </div>
@ -1071,7 +1074,6 @@ QR =
</div> </div>
<div id=captcha> <div id=captcha>
<div><img></div> <div><img></div>
<span id=cl>120 Captchas</span>
<input id=recaptcha_response_field autocomplete=off> <input id=recaptcha_response_field autocomplete=off>
</div> </div>
<div> <div>
@ -1096,7 +1098,7 @@ QR =
$.bind $('form', qr), 'submit', QR.submit $.bind $('form', qr), 'submit', QR.submit
$.bind $('#recaptcha_response_field', qr), 'keydown', QR.keydown $.bind $('#recaptcha_response_field', qr), 'keydown', QR.keydown
QR.captchaImg() QR.captchaImg()
QR.captchaLength() QR.stats()
$.add d.body, qr $.add d.body, qr
ta = $ 'textarea', qr ta = $ 'textarea', qr
l = text.length l = text.length
@ -1147,11 +1149,13 @@ QR =
tc = data.textContent tc = data.textContent
if tc is 'Error: Duplicate file entry detected.' if tc is 'Error: Duplicate file entry detected.'
$.rm row if row $.rm row if row
QR.stats()
setTimeout QR.submit, 1000 setTimeout QR.submit, 1000
else if tc is 'You seem to have mistyped the verification.' else if tc is 'You seem to have mistyped the verification.'
setTimeout QR.submit, 1000 setTimeout QR.submit, 1000
return return
$.rm row if row $.rm row if row
QR.stats()
if conf['Persistent QR'] or $('#files input', qr)?.files.length if conf['Persistent QR'] or $('#files input', qr)?.files.length
QR.reset() QR.reset()
else else