diff --git a/4chan_x.user.js b/4chan_x.user.js index 9ecb715f3..694801d68 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1366,7 +1366,7 @@ return qr.autohide.set(); }, sys: function() { - var c, id, recaptcha, thread, _, _ref; + var c, id, otoNoko, recaptcha, thread, _, _ref; if (recaptcha = $('#recaptcha_response_field')) { $.bind(recaptcha, 'keydown', Recaptcha.listener); return; @@ -1386,9 +1386,14 @@ c = $('b').lastChild; if (c.nodeType === 8) { _ref = c.textContent.match(/thread:(\d+),no:(\d+)/), _ = _ref[0], thread = _ref[1], id = _ref[2]; + otoNoko = /AEOS.4chan_x.auto_noko=true/.test(d.cookie); if (thread === '0') { - return window.location = "http://boards.4chan.org/" + g.BOARD + "/res/" + id + "#watch"; - } else if (d.cookie.indexOf("" + NAMESPACE + "auto_noko") > -1) { + if (/AEOS.4chan_x.auto_watch=true/.test(d.cookie)) { + return window.location = "http://boards.4chan.org/" + g.BOARD + "/res/" + id + "#watch"; + } else if (otoNoko) { + return window.location = "http://boards.4chan.org/" + g.BOARD + "/res/" + id; + } + } else if (otoNoko) { return window.location = "http://boards.4chan.org/" + g.BOARD + "/res/" + thread + "#" + id; } } @@ -2740,6 +2745,14 @@ keybinds.init(); } threading.init(); + if ($.config('Auto Watch') && $.config('Thread Watcher')) { + d.cookie = "" + NAMESPACE + "auto_watch=true;path=/;domain=.4chan.org"; + if (g.REPLY && location.hash === '#watch' && $('img.favicon').src === Favicon.empty) { + watcher.watch(null, g.THREAD_ID); + } + } else { + d.cookie = "" + NAMESPACE + "auto_watch=false;path=/;domain=.4chan.org"; + } if (g.REPLY) { if ($.config('Thread Updater')) { updater.init(); @@ -2759,9 +2772,6 @@ if ($.config('Unread Count')) { unread.init(); } - if ($.config('Auto Watch') && $.config('Thread Watcher') && location.hash === '#watch' && $('img.favicon').src === Favicon.empty) { - watcher.watch(null, g.THREAD_ID); - } if ($.config('Reply Navigation')) { nav.init(); } @@ -2918,8 +2928,7 @@ height: 120px;\ }\ #qr.auto:not(:hover) > form {\ - height: 0;\ - overflow: hidden;\ + display: none;\ }\ /* http://stackoverflow.com/questions/2610497/change-an-inputs-html5-placeholder-color-with-css */\ #qr input::-webkit-input-placeholder {\ diff --git a/changelog b/changelog index 948daf184..0770ab149 100644 --- a/changelog +++ b/changelog @@ -3,6 +3,7 @@ - image spoiler revealer - optional auto noko - fix options centering on Opera + - fix append '#watch' only when auto watch is enabled - aeosynth: - keep options dialog at constant size - drop firefox 3.6 support (again...) diff --git a/script.coffee b/script.coffee index 41c87afcd..0d209554b 100644 --- a/script.coffee +++ b/script.coffee @@ -1127,9 +1127,13 @@ qr = c = $('b').lastChild if c.nodeType is 8 #comment node [_, thread, id] = c.textContent.match(/thread:(\d+),no:(\d+)/) + otoNoko = /AEOS.4chan_x.auto_noko=true/.test d.cookie if thread is '0' - window.location = "http://boards.4chan.org/#{g.BOARD}/res/#{id}#watch" - else if d.cookie.indexOf("#{NAMESPACE}auto_noko") > -1 + if /AEOS.4chan_x.auto_watch=true/.test d.cookie + window.location = "http://boards.4chan.org/#{g.BOARD}/res/#{id}#watch" + else if otoNoko + window.location = "http://boards.4chan.org/#{g.BOARD}/res/#{id}" + else if otoNoko window.location = "http://boards.4chan.org/#{g.BOARD}/res/#{thread}##{id}" threading = @@ -2154,6 +2158,13 @@ main = threading.init() + if $.config('Auto Watch') and $.config('Thread Watcher') + d.cookie = "#{NAMESPACE}auto_watch=true;path=/;domain=.4chan.org" + if g.REPLY and location.hash is '#watch' and $('img.favicon').src is Favicon.empty + watcher.watch null, g.THREAD_ID + else + d.cookie = "#{NAMESPACE}auto_watch=false;path=/;domain=.4chan.org" + if g.REPLY if $.config 'Thread Updater' updater.init() @@ -2173,10 +2184,6 @@ main = if $.config 'Unread Count' unread.init() - if $.config('Auto Watch') and $.config('Thread Watcher') and - location.hash is '#watch' and $('img.favicon').src is Favicon.empty - watcher.watch null, g.THREAD_ID - if $.config 'Reply Navigation' nav.init() @@ -2320,8 +2327,7 @@ main = height: 120px; } #qr.auto:not(:hover) > form { - height: 0; - overflow: hidden; + display: none; } /* http://stackoverflow.com/questions/2610497/change-an-inputs-html5-placeholder-color-with-css */ #qr input::-webkit-input-placeholder {