auto watch, actually working!
This commit is contained in:
parent
1fe459504e
commit
ec27fc47ca
17
4chan_x.js
17
4chan_x.js
@ -1468,7 +1468,7 @@
|
|||||||
favicon = $('img.favicon', thread);
|
favicon = $('img.favicon', thread);
|
||||||
id = favicon.nextSibling.name;
|
id = favicon.nextSibling.name;
|
||||||
if (favicon.src === g.favEmpty) {
|
if (favicon.src === g.favEmpty) {
|
||||||
return watcher.watch(id, favicon, thread);
|
return watcher.watch(thread);
|
||||||
} else {
|
} else {
|
||||||
return watcher.unwatch(g.BOARD, id);
|
return watcher.unwatch(g.BOARD, id);
|
||||||
}
|
}
|
||||||
@ -1486,9 +1486,14 @@
|
|||||||
delete watched[board][id];
|
delete watched[board][id];
|
||||||
return $.setValue('watched', watched);
|
return $.setValue('watched', watched);
|
||||||
},
|
},
|
||||||
watch: function(id, favicon, thread) {
|
watch: function(thread) {
|
||||||
var props, tc, watched, _name;
|
var favicon, id, props, tc, watched, _name;
|
||||||
|
favicon = $('img.favicon', thread);
|
||||||
|
if (favicon.src === g.favDefault) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
favicon.src = g.favDefault;
|
favicon.src = g.favDefault;
|
||||||
|
id = favicon.nextSibling.name;
|
||||||
tc = $('span.filetitle', thread).textContent || $('blockquote', thread).textContent;
|
tc = $('span.filetitle', thread).textContent || $('blockquote', thread).textContent;
|
||||||
props = {
|
props = {
|
||||||
textContent: "/" + g.BOARD + "/ - " + tc.slice(0, 25),
|
textContent: "/" + g.BOARD + "/ - " + tc.slice(0, 25),
|
||||||
@ -2193,6 +2198,9 @@
|
|||||||
if ($.config('Unread Count')) {
|
if ($.config('Unread Count')) {
|
||||||
unread.init();
|
unread.init();
|
||||||
}
|
}
|
||||||
|
if ($.config('Auto Watch') && location.hash === '#watch') {
|
||||||
|
watcher.watch();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($.config('Thread Hiding')) {
|
if ($.config('Thread Hiding')) {
|
||||||
threadHiding.init();
|
threadHiding.init();
|
||||||
@ -2200,9 +2208,6 @@
|
|||||||
if ($.config('Thread Navigation')) {
|
if ($.config('Thread Navigation')) {
|
||||||
nav.init();
|
nav.init();
|
||||||
}
|
}
|
||||||
if ($.config('Auto Watch') && location.hash === '#watch') {
|
|
||||||
watcher.watch();
|
|
||||||
}
|
|
||||||
if ($.config('Thread Expansion')) {
|
if ($.config('Thread Expansion')) {
|
||||||
expandThread.init();
|
expandThread.init();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1157,7 +1157,7 @@ watcher =
|
|||||||
favicon = $ 'img.favicon', thread
|
favicon = $ 'img.favicon', thread
|
||||||
id = favicon.nextSibling.name
|
id = favicon.nextSibling.name
|
||||||
if favicon.src == g.favEmpty
|
if favicon.src == g.favEmpty
|
||||||
watcher.watch id, favicon, thread
|
watcher.watch thread
|
||||||
else # favicon.src == g.favDefault
|
else # favicon.src == g.favDefault
|
||||||
watcher.unwatch g.BOARD, id
|
watcher.unwatch g.BOARD, id
|
||||||
|
|
||||||
@ -1174,8 +1174,12 @@ watcher =
|
|||||||
delete watched[board][id]
|
delete watched[board][id]
|
||||||
$.setValue 'watched', watched
|
$.setValue 'watched', watched
|
||||||
|
|
||||||
watch: (id, favicon, thread) ->
|
watch: (thread) ->
|
||||||
|
favicon = $ 'img.favicon', thread
|
||||||
|
return if favicon.src is g.favDefault
|
||||||
|
|
||||||
favicon.src = g.favDefault
|
favicon.src = g.favDefault
|
||||||
|
id = favicon.nextSibling.name
|
||||||
tc = $('span.filetitle', thread).textContent or $('blockquote', thread).textContent
|
tc = $('span.filetitle', thread).textContent or $('blockquote', thread).textContent
|
||||||
props =
|
props =
|
||||||
textContent: "/#{g.BOARD}/ - #{tc[...25]}"
|
textContent: "/#{g.BOARD}/ - #{tc[...25]}"
|
||||||
@ -1723,6 +1727,9 @@ if g.REPLY
|
|||||||
if $.config 'Unread Count'
|
if $.config 'Unread Count'
|
||||||
unread.init()
|
unread.init()
|
||||||
|
|
||||||
|
if $.config('Auto Watch') and location.hash is '#watch'
|
||||||
|
watcher.watch()
|
||||||
|
|
||||||
else #not reply
|
else #not reply
|
||||||
if $.config 'Thread Hiding'
|
if $.config 'Thread Hiding'
|
||||||
threadHiding.init()
|
threadHiding.init()
|
||||||
@ -1730,9 +1737,6 @@ else #not reply
|
|||||||
if $.config 'Thread Navigation'
|
if $.config 'Thread Navigation'
|
||||||
nav.init()
|
nav.init()
|
||||||
|
|
||||||
if $.config('Auto Watch') and location.hash is '#watch'
|
|
||||||
watcher.watch()
|
|
||||||
|
|
||||||
if $.config 'Thread Expansion'
|
if $.config 'Thread Expansion'
|
||||||
expandThread.init()
|
expandThread.init()
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user