From b4a6c8b35e9a316c99fe0e717c09945d06bd6d7f Mon Sep 17 00:00:00 2001 From: James Campos Date: Sat, 12 Jun 2010 18:41:40 -0700 Subject: [PATCH] error out at start if no #navtopr attempt to add options to #navtopr at start, erroring out on failure. do this so we don't add the thread watcher and waste time in general. --- 4chan_x.coffee | 17 +++++++++-------- 4chan_x.js | 19 ++++++++++--------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/4chan_x.coffee b/4chan_x.coffee index 5161bc2ae..cd2e2f869 100644 --- a/4chan_x.coffee +++ b/4chan_x.coffee @@ -654,6 +654,15 @@ replyNav: -> window.location: "#$op" +#error out if there's no #navtopr. +text: $('#navtopr a').nextSibling +a: tag('a') +a.textContent: 'X' +a.className: 'pointer' +a.addEventListener('click', options, true) +inBefore(text, document.createTextNode(' / ')) +inBefore(text, a) + if getValue('Reply Hiding') callbacks.push((root) -> tds: $$('td.doubledash', root) @@ -820,14 +829,6 @@ if not REPLY for a in as a.addEventListener('click', expandComment, true) -a: tag('a') -a.textContent: 'X' -a.className: 'pointer' -a.addEventListener('click', options, true) -text: $('#navtopr a').nextSibling -inBefore(text, document.createTextNode(' / ')) -inBefore(text, a) - for callback in callbacks callback() document.body.addEventListener('DOMNodeInserted', nodeInserted, true) diff --git a/4chan_x.js b/4chan_x.js index 6c5cc1231..0cbffe690 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -742,8 +742,16 @@ cursor: pointer; \ return window.location; } }; + //error out if there's no #navtopr. + text = $('#navtopr a').nextSibling; + a = tag('a'); + a.textContent = 'X'; + a.className = 'pointer'; + a.addEventListener('click', options, true); + inBefore(text, document.createTextNode(' / ')); + inBefore(text, a); getValue('Reply Hiding') ? callbacks.push(function(root) { - var _c, _d, _e, _f, _g, _h, _i, _j, a, next, obj, td, tds; + var _c, _d, _e, _f, _g, _h, _i, _j, next, obj, td, tds; tds = $$('td.doubledash', root); _c = []; _e = tds; for (_d = 0, _f = _e.length; _d < _f; _d++) { @@ -784,7 +792,7 @@ cursor: pointer; \ }); } getValue('Quick Report') ? callbacks.push(function(root) { - var _c, _d, _e, _f, a, arr, el; + var _c, _d, _e, _f, arr, el; arr = $$('span[id^=no]', root); _c = []; _e = arr; for (_d = 0, _f = _e.length; _d < _f; _d++) { @@ -944,13 +952,6 @@ cursor: pointer; \ } } } - a = tag('a'); - a.textContent = 'X'; - a.className = 'pointer'; - a.addEventListener('click', options, true); - text = $('#navtopr a').nextSibling; - inBefore(text, document.createTextNode(' / ')); - inBefore(text, a); _s = callbacks; for (_r = 0, _t = _s.length; _r < _t; _r++) { callback = _s[_r];