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;
isQR = e.target.parentNode.id === 'qr';
if (isQR) {
if (span = this.nextSibling) { if (span = this.nextSibling) {
$.remove(span); $.remove(span);
} }
}
if (g.seconds = GM_getValue('seconds')) { if (g.seconds = GM_getValue('seconds')) {
e.preventDefault(); e.preventDefault();
qr.cooldownStart();
alert('Stop posting so often!');
if (isQR) {
span = $.el('span', { span = $.el('span', {
className: 'error', className: 'error',
textContent: 'Stop posting so often!' textContent: 'Stop posting so often!'
}); });
$.append(this.parentNode, span); $.append(this.parentNode, span);
alert('Stop posting so often!'); }
qr.cooldownStart();
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();
alert('You forgot to type in the verification.');
recaptcha.focus();
if (isQR) {
span = $.el('span', { span = $.el('span', {
className: 'error', className: 'error',
textContent: 'You forgot to type in the verification.' textContent: 'You forgot to type in the verification.'
}); });
$.append(this.parentNode, span); return $.append(this.parentNode, span);
alert('You forgot to type in the verification.'); }
return recaptcha.focus();
} }
}, },
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,31 +747,40 @@ qr =
$.bind quote, 'click', qr.cb.quote $.bind quote, 'click', qr.cb.quote
submit: (e) -> submit: (e) ->
isQR = e.target.parentNode.id == 'qr'
if isQR
if span = @nextSibling if span = @nextSibling
$.remove span $.remove span
if g.seconds = GM_getValue 'seconds' if g.seconds = GM_getValue 'seconds'
e.preventDefault() e.preventDefault()
qr.cooldownStart()
alert 'Stop posting so often!'
if isQR
span = $.el 'span', span = $.el 'span',
className: 'error' className: 'error'
textContent: 'Stop posting so often!' textContent: 'Stop posting so often!'
$.append @parentNode, span $.append @parentNode, span
alert 'Stop posting so often!'
qr.cooldownStart()
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()
alert 'You forgot to type in the verification.'
recaptcha.focus()
if isQR
span = $.el 'span', span = $.el 'span',
className: 'error' className: 'error'
textContent: 'You forgot to type in the verification.' textContent: 'You forgot to type in the verification.'
$.append @parentNode, span $.append @parentNode, span
alert 'You forgot to type in the verification.'
recaptcha.focus()
quote: (e) -> quote: (e) ->
e.preventDefault() e.preventDefault()
@ -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