From 71cac4e7f600a0c037af317a6305018ba6f5f175 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Fri, 28 Oct 2011 17:32:38 +0200 Subject: [PATCH] QR error checking fix. --- 4chan_x.user.js | 9 +++++++-- script.coffee | 8 ++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 5f760e9db..54a1cd44b 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1718,6 +1718,7 @@ }, sys: function() { var recaptcha; + $.unbind(d, 'DOMContentLoaded', QR.sys); if (recaptcha = $('#recaptcha_response_field')) { $.bind(recaptcha, 'keydown', QR.keydown); return; @@ -2955,7 +2956,11 @@ init: function() { var cutoff, hiddenThreads, id, lastChecked, now, pathname, temp, timestamp, _ref; if (location.hostname === 'sys.4chan.org') { - QR.sys(); + if (d.body) { + QR.sys(); + } else { + $.bind(d, 'DOMContentLoaded', QR.sys); + } return; } $.bind(window, 'message', Main.message); @@ -3040,7 +3045,7 @@ }, onLoad: function() { 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)) { redirect(); return; diff --git a/script.coffee b/script.coffee index d1fb56071..2c17ef31a 100644 --- a/script.coffee +++ b/script.coffee @@ -1288,6 +1288,7 @@ QR = if $('img.favicon', op).src is Favicon.empty watcher.watch op, id sys: -> + $.unbind d, 'DOMContentLoaded', QR.sys if recaptcha = $ '#recaptcha_response_field' #post reporting $.bind recaptcha, 'keydown', QR.keydown return @@ -2237,7 +2238,10 @@ firstRun = Main = init: -> if location.hostname is 'sys.4chan.org' - QR.sys() + if d.body + QR.sys() + else + $.bind d, 'DOMContentLoaded', QR.sys return $.bind window, 'message', Main.message @@ -2322,7 +2326,7 @@ Main = $.bind d, 'DOMContentLoaded', Main.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 redirect() return