work fully on main reply box

This commit is contained in:
James Campos 2011-03-30 16:18:04 -07:00
parent bd770b1246
commit 110fe98fd9
2 changed files with 50 additions and 29 deletions

View File

@ -1013,34 +1013,43 @@
return _results; return _results;
}, },
submit: function(e) { submit: function(e) {
var recaptcha, span; var isQR, recaptcha, span;
if (span = this.nextSibling) { isQR = e.target.parentNode.id === 'qr';
$.remove(span); if (isQR) {
if (span = this.nextSibling) {
$.remove(span);
}
} }
if (g.seconds = GM_getValue('seconds')) { if (g.seconds = GM_getValue('seconds')) {
e.preventDefault(); e.preventDefault();
span = $.el('span', {
className: 'error',
textContent: 'Stop posting so often!'
});
$.append(this.parentNode, span);
alert('Stop posting so often!');
qr.cooldownStart(); qr.cooldownStart();
alert('Stop posting so often!');
if (isQR) {
span = $.el('span', {
className: 'error',
textContent: 'Stop posting so often!'
});
$.append(this.parentNode, span);
}
return; return;
} }
recaptcha = $('input[name=recaptcha_response_field]', this); recaptcha = $('input[name=recaptcha_response_field]', this);
if (recaptcha.value) { if (recaptcha.value) {
qr.autohide.set(); g.sage = $('#qr input[name=email]').value === 'sage';
return g.sage = $('#qr input[name=email]').value === 'sage'; if (isQR) {
return qr.autohide.set();
}
} else { } else {
e.preventDefault(); e.preventDefault();
span = $.el('span', {
className: 'error',
textContent: 'You forgot to type in the verification.'
});
$.append(this.parentNode, span);
alert('You forgot to type in the verification.'); alert('You forgot to type in the verification.');
return recaptcha.focus(); recaptcha.focus();
if (isQR) {
span = $.el('span', {
className: 'error',
textContent: 'You forgot to type in the verification.'
});
return $.append(this.parentNode, span);
}
} }
}, },
quote: function(e) { quote: function(e) {
@ -1705,6 +1714,7 @@
} }
recaptcha = $('#recaptcha_response_field'); recaptcha = $('#recaptcha_response_field');
$.bind(recaptcha, 'keydown', recaptchaListener); $.bind(recaptcha, 'keydown', recaptchaListener);
$.bind($('form[name=post]'), 'submit', qr.cb.submit);
scroll = function() { scroll = function() {
var bottom, height, i, reply, _len, _ref; var bottom, height, i, reply, _len, _ref;
height = d.body.clientHeight; height = d.body.clientHeight;

View File

@ -747,32 +747,41 @@ qr =
$.bind quote, 'click', qr.cb.quote $.bind quote, 'click', qr.cb.quote
submit: (e) -> submit: (e) ->
if span = @nextSibling isQR = e.target.parentNode.id == 'qr'
$.remove span
if isQR
if span = @nextSibling
$.remove span
if g.seconds = GM_getValue 'seconds' if g.seconds = GM_getValue 'seconds'
e.preventDefault() e.preventDefault()
span = $.el 'span',
className: 'error'
textContent: 'Stop posting so often!'
$.append @parentNode, span
alert 'Stop posting so often!'
qr.cooldownStart() qr.cooldownStart()
alert 'Stop posting so often!'
if isQR
span = $.el 'span',
className: 'error'
textContent: 'Stop posting so often!'
$.append @parentNode, span
return return
recaptcha = $('input[name=recaptcha_response_field]', this) recaptcha = $('input[name=recaptcha_response_field]', this)
if recaptcha.value if recaptcha.value
qr.autohide.set()
g.sage = $('#qr input[name=email]').value == 'sage' g.sage = $('#qr input[name=email]').value == 'sage'
if isQR
qr.autohide.set()
else else
e.preventDefault() e.preventDefault()
span = $.el 'span',
className: 'error'
textContent: 'You forgot to type in the verification.'
$.append @parentNode, span
alert 'You forgot to type in the verification.' alert 'You forgot to type in the verification.'
recaptcha.focus() recaptcha.focus()
if isQR
span = $.el 'span',
className: 'error'
textContent: 'You forgot to type in the verification.'
$.append @parentNode, span
quote: (e) -> quote: (e) ->
e.preventDefault() e.preventDefault()
{target} = e {target} = e
@ -1334,6 +1343,8 @@ for el in $$ '#recaptcha_table a'
recaptcha = $ '#recaptcha_response_field' recaptcha = $ '#recaptcha_response_field'
$.bind recaptcha, 'keydown', recaptchaListener $.bind recaptcha, 'keydown', recaptchaListener
$.bind $('form[name=post]'), 'submit', qr.cb.submit
scroll = -> scroll = ->
height = d.body.clientHeight height = d.body.clientHeight
for reply, i in g.replies for reply, i in g.replies