From 36bbd9a2afc012e02dc355ef2deb16f49ad37c43 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 4 Sep 2011 17:39:59 +0200 Subject: [PATCH 1/3] Initiate Reveal Spoilers only in spoilable boards. --- 4chan_x.user.js | 2 +- script.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 187dfe4a8..2ced9a4d5 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2855,7 +2855,7 @@ if (conf['Sauce']) { sauce.init(); } - if (conf['Reveal Spoilers']) { + if (conf['Reveal Spoilers'] && $('.postarea label')) { revealSpoilers.init(); } if (conf['Anonymize']) { diff --git a/script.coffee b/script.coffee index c6b63a808..619a4b0f5 100644 --- a/script.coffee +++ b/script.coffee @@ -2247,7 +2247,7 @@ main = if conf['Sauce'] sauce.init() - if conf['Reveal Spoilers'] + if conf['Reveal Spoilers'] and $('.postarea label') revealSpoilers.init() if conf['Anonymize'] From 7d636a049222a4c8c1b2575596df16fb0244f655 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 4 Sep 2011 18:58:18 +0200 Subject: [PATCH 2/3] 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 From 15ad125124fc33c103c0c47895c6c668d8fed087 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 4 Sep 2011 19:01:48 +0200 Subject: [PATCH 3/3] Simpler. Eh, I didn't know anything when I did this. --- 4chan_x.user.js | 2 +- script.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 67fd8c60d..6aef2d495 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2800,7 +2800,7 @@ return; } Favicon.halo = /ws/.test(Favicon["default"]) ? Favicon.haloSFW : Favicon.haloNSFW; - $('link[rel="shortcut icon"]', d.head).setAttribute('type', 'image/x-icon'); + $('link[rel="shortcut icon"]', d.head).type = 'image/x-icon'; g.hiddenReplies = $.get("hiddenReplies/" + g.BOARD + "/", {}); tzOffset = (new Date()).getTimezoneOffset() / 60; g.chanOffset = 5 - tzOffset; diff --git a/script.coffee b/script.coffee index 48e16a13e..30f8ba407 100644 --- a/script.coffee +++ b/script.coffee @@ -2193,7 +2193,7 @@ main = return Favicon.halo = if /ws/.test Favicon.default then Favicon.haloSFW else Favicon.haloNSFW - $('link[rel="shortcut icon"]', d.head).setAttribute 'type', 'image/x-icon' + $('link[rel="shortcut icon"]', d.head).type = 'image/x-icon' g.hiddenReplies = $.get "hiddenReplies/#{g.BOARD}/", {} tzOffset = (new Date()).getTimezoneOffset() / 60 # GMT -8 is given as +480; would GMT +8 be -480 ?