From 99b1cfed0b99e40bf59814a1aca635984e9cad1b Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 2 Jun 2011 21:21:37 +0200 Subject: [PATCH] Refresh only if the watcher list has changed. --- 4chan_x.user.js | 6 ++++-- script.coffee | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index fe3fc0daa..4ce17c816 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1531,8 +1531,10 @@ $.before(input, favicon); } watcher.refresh(); - return $.bind(window, 'storage', (function() { - return watcher.refresh(); + return $.bind(window, 'storage', (function(e) { + if (e.key === 'AEOS.4chan_x.watched') { + return watcher.refresh(); + } })); }, refresh: function() { diff --git a/script.coffee b/script.coffee index df0d118b1..692f81278 100644 --- a/script.coffee +++ b/script.coffee @@ -1245,7 +1245,7 @@ watcher = #populate watcher, display watch buttons watcher.refresh() - $.bind window, 'storage', (-> watcher.refresh() ) + $.bind window, 'storage', ((e) -> watcher.refresh() if e.key is 'AEOS.4chan_x.watched') refresh: -> watched = $.getValue 'watched', {}