From 7d636a049222a4c8c1b2575596df16fb0244f655 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 4 Sep 2011 18:58:18 +0200 Subject: [PATCH] Manage watcher dependencies within watcher. --- 4chan_x.user.js | 13 +++++++------ script.coffee | 13 ++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 2ced9a4d5..67fd8c60d 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1844,6 +1844,13 @@ $.before(input, favicon); } watcher.refresh(); + if (conf['Auto Watch']) { + if (!g.REPLY) { + $('.postarea form').action += '?watch'; + } else if (/watch/.test(location.search) && $('img.favicon').src === Favicon.empty) { + watcher.watch(null, g.THREAD_ID); + } + } return $.bind(window, 'storage', function(e) { if (e.key === ("" + NAMESPACE + "watched")) { return watcher.refresh(); @@ -2916,9 +2923,6 @@ if (conf['Reply Navigation']) { nav.init(); } - if (conf['Auto Watch'] && conf['Thread Watcher'] && /watch/.test(location.search) && $('img.favicon').src === Favicon.empty) { - watcher.watch(null, g.THREAD_ID); - } } else { if (conf['Index Navigation']) { nav.init(); @@ -2932,9 +2936,6 @@ if (conf['Comment Expansion']) { expandComment.init(); } - if (conf['Auto Watch']) { - $('.postarea form').action += '?watch'; - } } _ref3 = $$('div.op'); for (_i = 0, _len = _ref3.length; _i < _len; _i++) { diff --git a/script.coffee b/script.coffee index 619a4b0f5..48e16a13e 100644 --- a/script.coffee +++ b/script.coffee @@ -1512,6 +1512,12 @@ watcher = #populate watcher, display watch buttons watcher.refresh() + if conf['Auto Watch'] + unless g.REPLY + $('.postarea form').action += '?watch' + else if /watch/.test(location.search) and $('img.favicon').src is Favicon.empty + watcher.watch null, g.THREAD_ID + $.bind window, 'storage', (e) -> watcher.refresh() if e.key is "#{NAMESPACE}watched" refresh: -> @@ -2307,10 +2313,6 @@ main = if conf['Reply Navigation'] nav.init() - if conf['Auto Watch'] and conf['Thread Watcher'] and - /watch/.test(location.search) and $('img.favicon').src is Favicon.empty - watcher.watch null, g.THREAD_ID - else #not reply if conf['Index Navigation'] nav.init() @@ -2324,9 +2326,6 @@ main = if conf['Comment Expansion'] expandComment.init() - if conf['Auto Watch'] - $('.postarea form').action += '?watch' - for op in $$ 'div.op' for callback in g.callbacks callback op