QR error checking fix.

This commit is contained in:
Nicolas Stepien 2011-10-28 17:32:38 +02:00
parent 0400ecb42f
commit 71cac4e7f6
2 changed files with 13 additions and 4 deletions

View File

@ -1718,6 +1718,7 @@
}, },
sys: function() { sys: function() {
var recaptcha; var recaptcha;
$.unbind(d, 'DOMContentLoaded', QR.sys);
if (recaptcha = $('#recaptcha_response_field')) { if (recaptcha = $('#recaptcha_response_field')) {
$.bind(recaptcha, 'keydown', QR.keydown); $.bind(recaptcha, 'keydown', QR.keydown);
return; return;
@ -2955,7 +2956,11 @@
init: function() { init: function() {
var cutoff, hiddenThreads, id, lastChecked, now, pathname, temp, timestamp, _ref; var cutoff, hiddenThreads, id, lastChecked, now, pathname, temp, timestamp, _ref;
if (location.hostname === 'sys.4chan.org') { if (location.hostname === 'sys.4chan.org') {
QR.sys(); if (d.body) {
QR.sys();
} else {
$.bind(d, 'DOMContentLoaded', QR.sys);
}
return; return;
} }
$.bind(window, 'message', Main.message); $.bind(window, 'message', Main.message);
@ -3040,7 +3045,7 @@
}, },
onLoad: function() { onLoad: function() {
var nodes; var nodes;
$.unbind(document, 'DOMContentLoaded', Main.onLoad); $.unbind(d, 'DOMContentLoaded', Main.onLoad);
if (conf['404 Redirect'] && d.title === '4chan - 404' && /^\d+$/.test(g.THREAD_ID)) { if (conf['404 Redirect'] && d.title === '4chan - 404' && /^\d+$/.test(g.THREAD_ID)) {
redirect(); redirect();
return; return;

View File

@ -1288,6 +1288,7 @@ QR =
if $('img.favicon', op).src is Favicon.empty if $('img.favicon', op).src is Favicon.empty
watcher.watch op, id watcher.watch op, id
sys: -> sys: ->
$.unbind d, 'DOMContentLoaded', QR.sys
if recaptcha = $ '#recaptcha_response_field' #post reporting if recaptcha = $ '#recaptcha_response_field' #post reporting
$.bind recaptcha, 'keydown', QR.keydown $.bind recaptcha, 'keydown', QR.keydown
return return
@ -2237,7 +2238,10 @@ firstRun =
Main = Main =
init: -> init: ->
if location.hostname is 'sys.4chan.org' if location.hostname is 'sys.4chan.org'
QR.sys() if d.body
QR.sys()
else
$.bind d, 'DOMContentLoaded', QR.sys
return return
$.bind window, 'message', Main.message $.bind window, 'message', Main.message
@ -2322,7 +2326,7 @@ Main =
$.bind d, 'DOMContentLoaded', Main.onLoad $.bind d, 'DOMContentLoaded', Main.onLoad
onLoad: -> onLoad: ->
$.unbind document, 'DOMContentLoaded', Main.onLoad $.unbind d, 'DOMContentLoaded', Main.onLoad
if conf['404 Redirect'] and d.title is '4chan - 404' and /^\d+$/.test g.THREAD_ID if conf['404 Redirect'] and d.title is '4chan - 404' and /^\d+$/.test g.THREAD_ID
redirect() redirect()
return return