error in titlebar (sux)

This commit is contained in:
James Campos 2011-05-04 21:09:32 -07:00
parent 61a155bef9
commit 4d3c5e9ea6
2 changed files with 14 additions and 48 deletions

View File

@ -987,15 +987,11 @@
} }
}, },
message: function(e) { message: function(e) {
var data, dialog, error; var data, dialog;
data = e.data; data = e.data;
dialog = $('#qr'); dialog = $('#qr');
if (data) { if (data) {
error = $.el('span', { $('#error').textContent = data;
className: 'error',
textContent: data
});
$.append(dialog, error);
qr.autohide.unset(); qr.autohide.unset();
} else { } else {
if (dialog) { if (dialog) {
@ -1023,24 +1019,18 @@
return _results; return _results;
}, },
submit: function(e) { submit: function(e) {
var form, isQR, recaptcha, span; var form, isQR, recaptcha;
form = e.target; form = e.target;
isQR = form.parentNode.id === 'qr'; isQR = form.parentNode.id === 'qr';
if (isQR) { if (isQR) {
if (span = this.nextSibling) { $('#error').textContent = '';
$.remove(span);
}
} }
if ($.config('Cooldown')) { if ($.config('Cooldown')) {
if (qr.cooldown()) { if (qr.cooldown()) {
e.preventDefault(); e.preventDefault();
alert('Stop posting so often!'); alert('Stop posting so often!');
if (isQR) { if (isQR) {
span = $.el('span', { $('#error').textContent = 'Stop posting so often!';
className: 'error',
textContent: 'Stop posting so often!'
});
$.append(this.parentNode, span);
} }
return; return;
} }
@ -1056,11 +1046,7 @@
alert('You forgot to type in the verification.'); alert('You forgot to type in the verification.');
recaptcha.focus(); recaptcha.focus();
if (isQR) { if (isQR) {
span = $.el('span', { return $('#error').textContent = 'You forgot to type in the verification.';
className: 'error',
textContent: 'You forgot to type in the verification.'
});
return $.append(this.parentNode, span);
} }
} }
}, },
@ -1144,7 +1130,7 @@
var MAX_FILE_SIZE, THREAD_ID, clone, dialog, el, form, html, spoiler; var MAX_FILE_SIZE, THREAD_ID, clone, dialog, el, form, html, spoiler;
MAX_FILE_SIZE = $('input[name="MAX_FILE_SIZE"]').value; MAX_FILE_SIZE = $('input[name="MAX_FILE_SIZE"]').value;
THREAD_ID = g.THREAD_ID || link.pathname.split('/').pop(); THREAD_ID = g.THREAD_ID || link.pathname.split('/').pop();
html = " <div class=move>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> <input type=hidden name=MAX_FILE_SIZE value=" + MAX_FILE_SIZE + "> <input type=hidden name=resto value=" + THREAD_ID + "> <div><input class=inputtext type=text name=name placeholder=Name></div> <div><input class=inputtext type=text name=email placeholder=E-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 id=qr_captcha></div> <div><input type=file name=upfile></div> <div><input class=inputtext type=password name=pwd maxlength=8 placeholder=Password><input type=hidden name=mode value=regist></div> </form> "; html = " <div class=move><span id=error class=error></span><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> <input type=hidden name=MAX_FILE_SIZE value=" + MAX_FILE_SIZE + "> <input type=hidden name=resto value=" + THREAD_ID + "> <div><input class=inputtext type=text name=name placeholder=Name></div> <div><input class=inputtext type=text name=email placeholder=E-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 id=qr_captcha></div> <div><input type=file name=upfile></div> <div><input class=inputtext type=password name=pwd maxlength=8 placeholder=Password><input type=hidden name=mode value=regist></div> </form> ";
dialog = ui.dialog('qr', { dialog = ui.dialog('qr', {
top: '0px', top: '0px',
left: '0px' left: '0px'
@ -1163,7 +1149,7 @@
placeholder: 'Verification', placeholder: 'Verification',
className: 'inputtext' className: 'inputtext'
}); });
form = dialog.lastChild; form = dialog.lastElementChild;
$.bind(form, 'submit', qr.cb.submit); $.bind(form, 'submit', qr.cb.submit);
$.bind($('input[name=recaptcha_response_field]', clone), 'keydown', Recaptcha.listener); $.bind($('input[name=recaptcha_response_field]', clone), 'keydown', Recaptcha.listener);
$.append(d.body, dialog); $.append(d.body, dialog);
@ -2307,11 +2293,6 @@
#qr.auto:not(:hover) form {\ #qr.auto:not(:hover) form {\
display: none;\ display: none;\
}\ }\
#qr span.error {\
position: absolute;\
top: 0;\
left: 0;\
}\
/* qr reCAPTCHA */\ /* qr reCAPTCHA */\
#qr_captcha input {\ #qr_captcha input {\
border: 1px solid #AAA !important;\ border: 1px solid #AAA !important;\

View File

@ -747,10 +747,7 @@ qr =
{data} = e {data} = e
dialog = $ '#qr' dialog = $ '#qr'
if data # error message if data # error message
error = $.el 'span', $('#error').textContent = data
className: 'error'
textContent: data
$.append dialog, error
qr.autohide.unset() qr.autohide.unset()
else # success else # success
if dialog if dialog
@ -774,8 +771,7 @@ qr =
isQR = form.parentNode.id == 'qr' isQR = form.parentNode.id == 'qr'
if isQR if isQR
if span = @nextSibling $('#error').textContent = ''
$.remove span
if $.config 'Cooldown' if $.config 'Cooldown'
# check if we've posted on this board in another tab # check if we've posted on this board in another tab
@ -784,10 +780,7 @@ qr =
alert 'Stop posting so often!' alert 'Stop posting so often!'
if isQR if isQR
span = $.el 'span', $('#error').textContent = 'Stop posting so often!'
className: 'error'
textContent: 'Stop posting so often!'
$.append @parentNode, span
return return
@ -802,10 +795,7 @@ qr =
recaptcha.focus() recaptcha.focus()
if isQR if isQR
span = $.el 'span', $('#error').textContent = 'You forgot to type in the verification.'
className: 'error'
textContent: 'You forgot to type in the verification.'
$.append @parentNode, span
quote: (e) -> quote: (e) ->
e.preventDefault() e.preventDefault()
@ -879,7 +869,7 @@ qr =
MAX_FILE_SIZE = $('input[name="MAX_FILE_SIZE"]').value MAX_FILE_SIZE = $('input[name="MAX_FILE_SIZE"]').value
THREAD_ID = g.THREAD_ID or link.pathname.split('/').pop() THREAD_ID = g.THREAD_ID or link.pathname.split('/').pop()
html = " html = "
<div class=move>Quick Reply <input type=checkbox id=autohide title=autohide> <a name=close title=close>X</a></div> <div class=move><span id=error class=error></span><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> <form name=post action=http://sys.4chan.org/#{g.BOARD}/post method=POST enctype=multipart/form-data target=iframe>
<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}>
@ -908,7 +898,7 @@ qr =
placeholder: 'Verification' placeholder: 'Verification'
className: 'inputtext' className: 'inputtext'
form = dialog.lastChild form = dialog.lastElementChild
$.bind form, 'submit', qr.cb.submit $.bind form, 'submit', qr.cb.submit
$.bind $('input[name=recaptcha_response_field]', clone), 'keydown', Recaptcha.listener $.bind $('input[name=recaptcha_response_field]', clone), 'keydown', Recaptcha.listener
@ -1822,11 +1812,6 @@ main =
#qr.auto:not(:hover) form { #qr.auto:not(:hover) form {
display: none; display: none;
} }
#qr span.error {
position: absolute;
top: 0;
left: 0;
}
/* qr reCAPTCHA */ /* qr reCAPTCHA */
#qr_captcha input { #qr_captcha input {
border: 1px solid #AAA !important; border: 1px solid #AAA !important;