Merge branch 'master' of github.com:aeosynth/4chan-x

This commit is contained in:
James Campos 2011-05-24 21:58:00 -07:00
commit 979fc45284
2 changed files with 32 additions and 28 deletions

View File

@ -85,7 +85,7 @@
'Sauce': [true, 'Add sauce to images'] 'Sauce': [true, 'Add sauce to images']
}, },
post: { post: {
'Cooldown': [false, 'Prevent \'flood detected\' errors (buggy)'], 'Cooldown': [true, 'Prevent \'flood detected\' errors'],
'Quick Reply': [true, 'Reply without leaving the page'], 'Quick Reply': [true, 'Reply without leaving the page'],
'Persistent QR': [false, 'Quick reply won\'t disappear after posting. Only in replies.'] 'Persistent QR': [false, 'Quick reply won\'t disappear after posting. Only in replies.']
}, },
@ -1129,32 +1129,34 @@
}, },
cooldownCB: function() { cooldownCB: function() {
var submit, submits, _i, _len; var submit, submits, _i, _len;
qr.duration = qr.duration - 1; qr.duration--;
submits = $$('#com_submit'); submits = $$('#com_submit');
for (_i = 0, _len = submits.length; _i < _len; _i++) { for (_i = 0, _len = submits.length; _i < _len; _i++) {
submit = submits[_i]; submit = submits[_i];
if (qr.duration === 0) { if (qr.duration) {
submit.value = qr.duration;
} else {
submit.disabled = false; submit.disabled = false;
submit.value = 'Submit'; submit.value = 'Submit';
} else {
submit.value = qr.duration;
} }
} }
if (qr.duration === 0) { if (!qr.duration) {
return clearInterval(qr.cooldownIntervalID); return window.clearInterval(qr.cooldownIntervalID);
} }
}, },
dialog: function(link) { dialog: function(link) {
var MAX_FILE_SIZE, THREAD_ID, c, challenge, dialog, html, m, mail, name, pass, spoiler, src; var MAX_FILE_SIZE, THREAD_ID, c, challenge, dialog, html, m, mail, name, pass, spoiler, src, submitDisabled, submitValue;
MAX_FILE_SIZE = $('input[name="MAX_FILE_SIZE"]').value; MAX_FILE_SIZE = $('input[name="MAX_FILE_SIZE"]').value;
submitValue = $('#com_submit').value;
submitDisabled = $('#com_submit').disabled ? 'disabled' : '';
THREAD_ID = g.THREAD_ID || $.x('ancestor::div[@class="thread"]/div', link).id; THREAD_ID = g.THREAD_ID || $.x('ancestor::div[@class="thread"]/div', link).id;
challenge = $('input[name=recaptcha_challenge_field]').value; challenge = $('input[name=recaptcha_challenge_field]').value;
src = "http://www.google.com/recaptcha/api/image?c=" + challenge; src = "http://www.google.com/recaptcha/api/image?c=" + challenge;
c = d.cookie; c = d.cookie;
name = (m = c.match(/4chan_name=([^;]+)/)) ? unescape(m[1]) : ''; name = (m = c.match(/4chan_name=([^;]+)/)) ? decodeURIComponent(m[1]) : '';
mail = (m = c.match(/4chan_email=([^;]+)/)) ? unescape(m[1]) : ''; mail = (m = c.match(/4chan_email=([^;]+)/)) ? decodeURIComponent(m[1]) : '';
pass = (m = c.match(/4chan_pass=([^;]+)/)) ? unescape(m[1]) : $('input[name=pwd]').value; pass = (m = c.match(/4chan_pass=([^;]+)/)) ? decodeURIComponent(m[1]) : $('input[name=pwd]').value;
html = " <div class=move> <input class=inputtext type=text name=name placeholder=Name form=qr_form value='" + name + "'> Quick Reply <input type=checkbox id=autohide title=autohide> <a name=close title=close>X</a> </div> <form name=post action=http://sys.4chan.org/" + g.BOARD + "/post method=POST enctype=multipart/form-data target=iframe id=qr_form> <input type=hidden name=MAX_FILE_SIZE value=" + MAX_FILE_SIZE + "> <input type=hidden name=resto value=" + THREAD_ID + "> <input type=hidden name=recaptcha_challenge_field value=" + challenge + "> <div><input class=inputtext type=text name=email placeholder=E-mail value='" + mail + "'></div> <div><input class=inputtext type=text name=sub placeholder=Subject><input type=submit value=Submit id=com_submit></div> <div><textarea class=inputtext name=com placeholder=Comment></textarea></div> <div><img src=" + src + "></div> <div><input class=inputtext type=text name=recaptcha_response_field placeholder=Verification required autocomplete=off></div> <div><input type=file name=upfile></div> <div><input class=inputtext type=password name=pwd maxlength=8 placeholder=Password value='" + pass + "'><input type=hidden name=mode value=regist></div> </form> <div id=error class=error></div> "; html = " <div class=move> <input class=inputtext type=text name=name placeholder=Name form=qr_form value=\"" + name + "\"> Quick Reply <input type=checkbox id=autohide title=autohide> <a name=close title=close>X</a> </div> <form name=post action=http://sys.4chan.org/" + g.BOARD + "/post method=POST enctype=multipart/form-data target=iframe id=qr_form> <input type=hidden name=MAX_FILE_SIZE value=" + MAX_FILE_SIZE + "> <input type=hidden name=resto value=" + THREAD_ID + "> <input type=hidden name=recaptcha_challenge_field value=" + challenge + "> <div><input class=inputtext type=text name=email placeholder=E-mail value=\"" + mail + "\"></div> <div><input class=inputtext type=text name=sub placeholder=Subject><input type=submit value=" + submitValue + " id=com_submit " + submitDisabled + "></div> <div><textarea class=inputtext name=com placeholder=Comment></textarea></div> <div><img src=" + src + "></div> <div><input class=inputtext type=text name=recaptcha_response_field placeholder=Verification required autocomplete=off></div> <div><input type=file name=upfile></div> <div><input class=inputtext type=password name=pwd maxlength=8 placeholder=Password value=\"" + pass + "\"><input type=hidden name=mode value=regist></div> </form> <div id=error class=error></div> ";
dialog = ui.dialog('qr', { dialog = ui.dialog('qr', {
top: '0px', top: '0px',
left: '0px' left: '0px'
@ -1405,7 +1407,7 @@
count.textContent = 404; count.textContent = 404;
count.className = 'error'; count.className = 'error';
timer.textContent = ''; timer.textContent = '';
clearInterval(updater.intervalID); window.clearInterval(updater.intervalID);
_ref = $$('input[type=submit]'); _ref = $$('input[type=submit]');
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (_i = 0, _len = _ref.length; _i < _len; _i++) {
input = _ref[_i]; input = _ref[_i];

View File

@ -26,7 +26,7 @@ config =
'Image Preloading': [false, 'Preload Images'] 'Image Preloading': [false, 'Preload Images']
'Sauce': [true, 'Add sauce to images'] 'Sauce': [true, 'Add sauce to images']
post: post:
'Cooldown': [false, 'Prevent \'flood detected\' errors (buggy)'] 'Cooldown': [true, 'Prevent \'flood detected\' errors']
'Quick Reply': [true, 'Reply without leaving the page'] 'Quick Reply': [true, 'Reply without leaving the page']
'Persistent QR': [false, 'Quick reply won\'t disappear after posting. Only in replies.'] 'Persistent QR': [false, 'Quick reply won\'t disappear after posting. Only in replies.']
quote: quote:
@ -887,33 +887,35 @@ qr =
qr.duration = duration qr.duration = duration
cooldownCB: -> cooldownCB: ->
qr.duration = qr.duration - 1 qr.duration--
submits = $$ '#com_submit' submits = $$ '#com_submit'
for submit in submits for submit in submits
if qr.duration == 0 if qr.duration
submit.value = qr.duration
else
submit.disabled = false submit.disabled = false
submit.value = 'Submit' submit.value = 'Submit'
else
submit.value = qr.duration
if qr.duration == 0 window.clearInterval qr.cooldownIntervalID unless qr.duration
clearInterval qr.cooldownIntervalID
dialog: (link) -> dialog: (link) ->
#maybe should be global #maybe should be global
MAX_FILE_SIZE = $('input[name="MAX_FILE_SIZE"]').value MAX_FILE_SIZE = $('input[name="MAX_FILE_SIZE"]').value
submitValue = $('#com_submit').value
submitDisabled = if $('#com_submit').disabled then 'disabled' else ''
#FIXME inlined cross-thread quotes #FIXME inlined cross-thread quotes
THREAD_ID = g.THREAD_ID or $.x('ancestor::div[@class="thread"]/div', link).id THREAD_ID = g.THREAD_ID or $.x('ancestor::div[@class="thread"]/div', link).id
challenge = $('input[name=recaptcha_challenge_field]').value challenge = $('input[name=recaptcha_challenge_field]').value
src = "http://www.google.com/recaptcha/api/image?c=#{challenge}" src = "http://www.google.com/recaptcha/api/image?c=#{challenge}"
c = d.cookie c = d.cookie
name = if m = c.match(/4chan_name=([^;]+)/) then unescape m[1] else '' name = if m = c.match(/4chan_name=([^;]+)/) then decodeURIComponent m[1] else ''
mail = if m = c.match(/4chan_email=([^;]+)/) then unescape m[1] else '' mail = if m = c.match(/4chan_email=([^;]+)/) then decodeURIComponent m[1] else ''
pass = if m = c.match(/4chan_pass=([^;]+)/) then unescape m[1] else $('input[name=pwd]').value pass = if m = c.match(/4chan_pass=([^;]+)/) then decodeURIComponent m[1] else $('input[name=pwd]').value
html = " html = "
<div class=move> <div class=move>
<input class=inputtext type=text name=name placeholder=Name form=qr_form value='#{name}'> <input class=inputtext type=text name=name placeholder=Name form=qr_form value=\"#{name}\">
Quick Reply Quick Reply
<input type=checkbox id=autohide title=autohide> <input type=checkbox id=autohide title=autohide>
<a name=close title=close>X</a> <a name=close title=close>X</a>
@ -922,13 +924,13 @@ qr =
<input type=hidden name=MAX_FILE_SIZE value=#{MAX_FILE_SIZE}> <input type=hidden name=MAX_FILE_SIZE value=#{MAX_FILE_SIZE}>
<input type=hidden name=resto value=#{THREAD_ID}> <input type=hidden name=resto value=#{THREAD_ID}>
<input type=hidden name=recaptcha_challenge_field value=#{challenge}> <input type=hidden name=recaptcha_challenge_field value=#{challenge}>
<div><input class=inputtext type=text name=email placeholder=E-mail value='#{mail}'></div> <div><input class=inputtext type=text name=email placeholder=E-mail value=\"#{mail}\"></div>
<div><input class=inputtext type=text name=sub placeholder=Subject><input type=submit value=Submit id=com_submit></div> <div><input class=inputtext type=text name=sub placeholder=Subject><input type=submit value=#{submitValue} id=com_submit #{submitDisabled}></div>
<div><textarea class=inputtext name=com placeholder=Comment></textarea></div> <div><textarea class=inputtext name=com placeholder=Comment></textarea></div>
<div><img src=#{src}></div> <div><img src=#{src}></div>
<div><input class=inputtext type=text name=recaptcha_response_field placeholder=Verification required autocomplete=off></div> <div><input class=inputtext type=text name=recaptcha_response_field placeholder=Verification required autocomplete=off></div>
<div><input type=file name=upfile></div> <div><input type=file name=upfile></div>
<div><input class=inputtext type=password name=pwd maxlength=8 placeholder=Password value='#{pass}'><input type=hidden name=mode value=regist></div> <div><input class=inputtext type=password name=pwd maxlength=8 placeholder=Password value=\"#{pass}\"><input type=hidden name=mode value=regist></div>
</form> </form>
<div id=error class=error></div> <div id=error class=error></div>
" "
@ -1154,7 +1156,7 @@ updater =
count.textContent = 404 count.textContent = 404
count.className = 'error' count.className = 'error'
timer.textContent = '' timer.textContent = ''
clearInterval updater.intervalID window.clearInterval updater.intervalID
for input in $$ 'input[type=submit]' for input in $$ 'input[type=submit]'
input.disabled = true input.disabled = true
input.value = 404 input.value = 404