getValue into refresh

This commit is contained in:
Nicolas Stepien 2011-06-02 20:30:57 +02:00
parent 9d91220665
commit d90fd1e016
2 changed files with 13 additions and 11 deletions

View File

@ -1530,13 +1530,14 @@
$.bind(favicon, 'click', watcher.cb.toggle);
$.before(input, favicon);
}
watcher.refresh($.getValue('watched', {}));
watcher.refresh();
return $.bind(window, 'storage', (function() {
return watcher.refresh($.getValue('watched', {}));
return watcher.refresh();
}));
},
refresh: function(watched) {
var board, dialog, div, favicon, id, link, props, watchedBoard, x, _i, _j, _len, _len2, _ref, _ref2, _ref3, _results;
refresh: function() {
var board, dialog, div, favicon, id, link, props, watched, watchedBoard, x, _i, _j, _len, _len2, _ref, _ref2, _ref3, _results;
watched = $.getValue('watched', {});
dialog = $('#watcher');
_ref = $$('div:not(.move)', dialog);
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
@ -1592,7 +1593,7 @@
watched = $.getValue('watched', {});
delete watched[board][id];
$.setValue('watched', watched);
return watcher.refresh(watched);
return watcher.refresh();
},
watch: function(thread, id) {
var props, tc, watched, _name;
@ -1605,7 +1606,7 @@
watched[_name = g.BOARD] || (watched[_name] = {});
watched[g.BOARD][id] = props;
$.setValue('watched', watched);
return watcher.refresh(watched);
return watcher.refresh();
}
};
anonymize = {

View File

@ -1243,11 +1243,12 @@ watcher =
$.before input, favicon
#populate watcher, display watch buttons
watcher.refresh $.getValue 'watched', {}
watcher.refresh()
$.bind window, 'storage', (-> watcher.refresh $.getValue 'watched', {})
$.bind window, 'storage', (-> watcher.refresh() )
refresh: (watched) ->
refresh: ->
watched = $.getValue 'watched', {}
dialog = $ '#watcher'
for div in $$ 'div:not(.move)', dialog
$.rm div
@ -1290,7 +1291,7 @@ watcher =
watched = $.getValue 'watched', {}
delete watched[board][id]
$.setValue 'watched', watched
watcher.refresh watched
watcher.refresh()
watch: (thread, id) ->
tc = $('span.filetitle', thread).textContent or $('blockquote', thread).textContent
@ -1302,7 +1303,7 @@ watcher =
watched[g.BOARD] or= {}
watched[g.BOARD][id] = props
$.setValue 'watched', watched
watcher.refresh watched
watcher.refresh()
anonymize =
init: ->