diff --git a/4chan_x.js b/4chan_x.js
index d0ad53521..38eb97e62 100644
--- a/4chan_x.js
+++ b/4chan_x.js
@@ -987,15 +987,11 @@
}
},
message: function(e) {
- var data, dialog, error;
+ var data, dialog;
data = e.data;
dialog = $('#qr');
if (data) {
- error = $.el('span', {
- className: 'error',
- textContent: data
- });
- $.append(dialog, error);
+ $('#error').textContent = data;
qr.autohide.unset();
} else {
if (dialog) {
@@ -1023,24 +1019,18 @@
return _results;
},
submit: function(e) {
- var form, isQR, recaptcha, span;
+ var form, isQR, recaptcha;
form = e.target;
isQR = form.parentNode.id === 'qr';
if (isQR) {
- if (span = this.nextSibling) {
- $.remove(span);
- }
+ $('#error').textContent = '';
}
if ($.config('Cooldown')) {
if (qr.cooldown()) {
e.preventDefault();
alert('Stop posting so often!');
if (isQR) {
- span = $.el('span', {
- className: 'error',
- textContent: 'Stop posting so often!'
- });
- $.append(this.parentNode, span);
+ $('#error').textContent = 'Stop posting so often!';
}
return;
}
@@ -1056,11 +1046,7 @@
alert('You forgot to type in the verification.');
recaptcha.focus();
if (isQR) {
- span = $.el('span', {
- className: 'error',
- textContent: 'You forgot to type in the verification.'
- });
- return $.append(this.parentNode, span);
+ return $('#error').textContent = 'You forgot to type in the verification.';
}
}
},
@@ -1144,7 +1130,7 @@
var MAX_FILE_SIZE, THREAD_ID, clone, dialog, el, form, html, spoiler;
MAX_FILE_SIZE = $('input[name="MAX_FILE_SIZE"]').value;
THREAD_ID = g.THREAD_ID || link.pathname.split('/').pop();
- html = "
";
+ html = " ";
dialog = ui.dialog('qr', {
top: '0px',
left: '0px'
@@ -1163,7 +1149,7 @@
placeholder: 'Verification',
className: 'inputtext'
});
- form = dialog.lastChild;
+ form = dialog.lastElementChild;
$.bind(form, 'submit', qr.cb.submit);
$.bind($('input[name=recaptcha_response_field]', clone), 'keydown', Recaptcha.listener);
$.append(d.body, dialog);
@@ -2307,11 +2293,6 @@
#qr.auto:not(:hover) form {\
display: none;\
}\
- #qr span.error {\
- position: absolute;\
- top: 0;\
- left: 0;\
- }\
/* qr reCAPTCHA */\
#qr_captcha input {\
border: 1px solid #AAA !important;\
diff --git a/script.coffee b/script.coffee
index b97a7fb5a..64ea32092 100644
--- a/script.coffee
+++ b/script.coffee
@@ -747,10 +747,7 @@ qr =
{data} = e
dialog = $ '#qr'
if data # error message
- error = $.el 'span',
- className: 'error'
- textContent: data
- $.append dialog, error
+ $('#error').textContent = data
qr.autohide.unset()
else # success
if dialog
@@ -774,8 +771,7 @@ qr =
isQR = form.parentNode.id == 'qr'
if isQR
- if span = @nextSibling
- $.remove span
+ $('#error').textContent = ''
if $.config 'Cooldown'
# check if we've posted on this board in another tab
@@ -784,10 +780,7 @@ qr =
alert 'Stop posting so often!'
if isQR
- span = $.el 'span',
- className: 'error'
- textContent: 'Stop posting so often!'
- $.append @parentNode, span
+ $('#error').textContent = 'Stop posting so often!'
return
@@ -802,10 +795,7 @@ qr =
recaptcha.focus()
if isQR
- span = $.el 'span',
- className: 'error'
- textContent: 'You forgot to type in the verification.'
- $.append @parentNode, span
+ $('#error').textContent = 'You forgot to type in the verification.'
quote: (e) ->
e.preventDefault()
@@ -879,7 +869,7 @@ qr =
MAX_FILE_SIZE = $('input[name="MAX_FILE_SIZE"]').value
THREAD_ID = g.THREAD_ID or link.pathname.split('/').pop()
html = "
-
+