diff --git a/4chan_x.js b/4chan_x.js index 929d5a3fa..6fe6c91af 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1469,7 +1469,7 @@ }, html); $.append(d.body, dialog); watched = $.getValue('watched', {}); - watcher.list(watched); + watcher.refresh(watched); watchedBoard = watched[g.BOARD] || {}; inputs = $$('form > input[value=delete], div.thread > input[value=delete]'); _results = []; @@ -1490,12 +1490,10 @@ } return _results; }, - list: function(watched) { + refresh: function(watched) { var board, div, id, props, _results; - div = $('#watcher > div:not(.move)'); - while (div) { + while (div = $('#watcher > div:not(.move)')) { $.remove(div); - div = $('#watcher > div:not(.move)'); } _results = []; for (board in watched) { @@ -1552,7 +1550,7 @@ watched = $.getValue('watched', {}); delete watched[board][id]; $.setValue('watched', watched); - return watcher.list(watched); + return watcher.refresh(watched); }, watch: function(thread) { var favicon, id, props, tc, watched, _name; @@ -1571,7 +1569,7 @@ watched[_name = g.BOARD] || (watched[_name] = {}); watched[g.BOARD][id] = props; $.setValue('watched', watched); - return watcher.list(watched); + return watcher.refresh(watched); } }; anonymize = { diff --git a/script.coffee b/script.coffee index d5b3ee50f..b6087329b 100644 --- a/script.coffee +++ b/script.coffee @@ -1165,7 +1165,7 @@ watcher = #populate watcher watched = $.getValue 'watched', {} - watcher.list watched + watcher.refresh watched #add watch buttons watchedBoard = watched[g.BOARD] or {} @@ -1182,11 +1182,9 @@ watcher = $.bind favicon, 'click', watcher.cb.toggle $.before input, favicon - list: (watched) -> - div = $ '#watcher > div:not(.move)' - while div + refresh: (watched) -> + while div = $ '#watcher > div:not(.move)' $.remove div - div = $ '#watcher > div:not(.move)' for board of watched for id, props of watched[board] watcher.addLink props, $ '#watcher' @@ -1226,7 +1224,7 @@ watcher = delete watched[board][id] $.setValue 'watched', watched - watcher.list watched + watcher.refresh watched watch: (thread) -> favicon = $ 'img.favicon', thread @@ -1244,7 +1242,7 @@ watcher = watched[g.BOARD][id] = props $.setValue 'watched', watched - watcher.list watched + watcher.refresh watched anonymize = init: ->