actually fix noscript

This commit is contained in:
James Campos 2011-06-22 13:19:09 -07:00
parent 83782e16df
commit 5dfd379c94
2 changed files with 10 additions and 11 deletions

View File

@ -2260,15 +2260,13 @@
}; };
Recaptcha = { Recaptcha = {
init: function() { init: function() {
var el, recaptcha, _i, _len, _ref2; var el, _i, _len, _ref2;
_ref2 = $$('#recaptcha_table a'); _ref2 = $$('#recaptcha_table a');
for (_i = 0, _len = _ref2.length; _i < _len; _i++) { for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
el = _ref2[_i]; el = _ref2[_i];
el.tabIndex = 1; el.tabIndex = 1;
} }
if (recaptcha = $('#recaptcha_response_field')) { return $.bind($('#recaptcha_response_field'), 'keydown', Recaptcha.listener);
return $.bind(recaptcha, 'keydown', Recaptcha.listener);
}
}, },
listener: function(e) { listener: function(e) {
if (e.keyCode === 8 && this.value === '') { if (e.keyCode === 8 && this.value === '') {
@ -2510,7 +2508,7 @@
}; };
main = { main = {
init: function() { init: function() {
var DAY, callback, cutoff, form, hiddenThreads, id, lastChecked, now, op, pathname, reply, table, temp, timestamp, tzOffset, _i, _j, _k, _l, _len, _len2, _len3, _len4, _ref2, _ref3, _ref4, _ref5, _ref6; var DAY, callback, canPost, cutoff, form, hiddenThreads, id, lastChecked, now, op, pathname, reply, table, temp, timestamp, tzOffset, _i, _j, _k, _l, _len, _len2, _len3, _len4, _ref2, _ref3, _ref4, _ref5, _ref6;
pathname = location.pathname.substring(1).split('/'); pathname = location.pathname.substring(1).split('/');
g.BOARD = pathname[0], temp = pathname[1]; g.BOARD = pathname[0], temp = pathname[1];
if (temp === 'res') { if (temp === 'res') {
@ -2562,7 +2560,8 @@
$.setValue('lastChecked', now); $.setValue('lastChecked', now);
} }
$.addStyle(main.css); $.addStyle(main.css);
if (form = $('form[name=post]')) { if ((form = $('form[name=post]')) && $('#recaptcha_response_field')) {
canPost = true;
Recaptcha.init(); Recaptcha.init();
$.bind(form, 'submit', qr.cb.submit); $.bind(form, 'submit', qr.cb.submit);
} }
@ -2590,7 +2589,7 @@
if ($.config('Reply Hiding')) { if ($.config('Reply Hiding')) {
replyHiding.init(); replyHiding.init();
} }
if (form && $.config('Quick Reply')) { if (canPost && $.config('Quick Reply')) {
qr.init(); qr.init();
} }
if ($.config('Report Button')) { if ($.config('Report Button')) {

View File

@ -1714,8 +1714,7 @@ Recaptcha =
#hack to tab from comment straight to recaptcha #hack to tab from comment straight to recaptcha
for el in $$ '#recaptcha_table a' for el in $$ '#recaptcha_table a'
el.tabIndex = 1 el.tabIndex = 1
if recaptcha = $ '#recaptcha_response_field' #NoScript $.bind $('#recaptcha_response_field'), 'keydown', Recaptcha.listener
$.bind recaptcha, 'keydown', Recaptcha.listener
listener: (e) -> listener: (e) ->
if e.keyCode is 8 and @value is '' # backspace to reload if e.keyCode is 8 and @value is '' # backspace to reload
Recaptcha.reload() Recaptcha.reload()
@ -1989,7 +1988,8 @@ main =
$.addStyle main.css $.addStyle main.css
if form = $ 'form[name=post]' if (form = $ 'form[name=post]') and $ '#recaptcha_response_field'
canPost = true
Recaptcha.init() Recaptcha.init()
$.bind form, 'submit', qr.cb.submit $.bind form, 'submit', qr.cb.submit
@ -2018,7 +2018,7 @@ main =
if $.config 'Reply Hiding' if $.config 'Reply Hiding'
replyHiding.init() replyHiding.init()
if form and $.config 'Quick Reply' if canPost and $.config 'Quick Reply'
qr.init() qr.init()
if $.config 'Report Button' if $.config 'Report Button'