diff --git a/4chan_x.js b/4chan_x.js index a79e88bf0..f5051a45e 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1468,7 +1468,7 @@ favicon = $('img.favicon', thread); id = favicon.nextSibling.name; if (favicon.src === g.favEmpty) { - return watcher.watch(id, favicon, thread); + return watcher.watch(thread); } else { return watcher.unwatch(g.BOARD, id); } @@ -1486,9 +1486,14 @@ delete watched[board][id]; return $.setValue('watched', watched); }, - watch: function(id, favicon, thread) { - var props, tc, watched, _name; + watch: function(thread) { + var favicon, id, props, tc, watched, _name; + favicon = $('img.favicon', thread); + if (favicon.src === g.favDefault) { + return; + } favicon.src = g.favDefault; + id = favicon.nextSibling.name; tc = $('span.filetitle', thread).textContent || $('blockquote', thread).textContent; props = { textContent: "/" + g.BOARD + "/ - " + tc.slice(0, 25), @@ -2193,6 +2198,9 @@ if ($.config('Unread Count')) { unread.init(); } + if ($.config('Auto Watch') && location.hash === '#watch') { + watcher.watch(); + } } else { if ($.config('Thread Hiding')) { threadHiding.init(); @@ -2200,9 +2208,6 @@ if ($.config('Thread Navigation')) { nav.init(); } - if ($.config('Auto Watch') && location.hash === '#watch') { - watcher.watch(); - } if ($.config('Thread Expansion')) { expandThread.init(); } diff --git a/script.coffee b/script.coffee index 340e2abfa..4cd6018c5 100644 --- a/script.coffee +++ b/script.coffee @@ -1157,7 +1157,7 @@ watcher = favicon = $ 'img.favicon', thread id = favicon.nextSibling.name if favicon.src == g.favEmpty - watcher.watch id, favicon, thread + watcher.watch thread else # favicon.src == g.favDefault watcher.unwatch g.BOARD, id @@ -1174,8 +1174,12 @@ watcher = delete watched[board][id] $.setValue 'watched', watched - watch: (id, favicon, thread) -> + watch: (thread) -> + favicon = $ 'img.favicon', thread + return if favicon.src is g.favDefault + favicon.src = g.favDefault + id = favicon.nextSibling.name tc = $('span.filetitle', thread).textContent or $('blockquote', thread).textContent props = textContent: "/#{g.BOARD}/ - #{tc[...25]}" @@ -1723,6 +1727,9 @@ if g.REPLY if $.config 'Unread Count' unread.init() + if $.config('Auto Watch') and location.hash is '#watch' + watcher.watch() + else #not reply if $.config 'Thread Hiding' threadHiding.init() @@ -1730,9 +1737,6 @@ else #not reply if $.config 'Thread Navigation' nav.init() - if $.config('Auto Watch') and location.hash is '#watch' - watcher.watch() - if $.config 'Thread Expansion' expandThread.init()