Manage watcher dependencies within watcher.

This commit is contained in:
Nicolas Stepien 2011-09-04 18:58:18 +02:00
parent 36bbd9a2af
commit 7d636a0492
2 changed files with 13 additions and 13 deletions

View File

@ -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++) {

View File

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