auto watch, actually working!

This commit is contained in:
James Campos 2011-04-18 00:12:23 -07:00
parent 1fe459504e
commit ec27fc47ca
2 changed files with 20 additions and 11 deletions

View File

@ -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();
}

View File

@ -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()