diff --git a/4chan_x.user.js b/4chan_x.user.js index e87d0568c..fe3fc0daa 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -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 = { diff --git a/script.coffee b/script.coffee index 08b1e34f4..df0d118b1 100644 --- a/script.coffee +++ b/script.coffee @@ -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: ->