From b77864b1da399b37eaedfe16fd3d1c6ed4aa15fb Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Mon, 12 Aug 2013 17:21:01 -0700 Subject: [PATCH] Personal touches --- builds/4chan-X.user.js | 13 ++++++------- builds/crx/script.js | 13 ++++++------- src/Monitoring/ThreadWatcher.coffee | 9 +++------ 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 1f70d9c50..b066cc32c 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -7768,8 +7768,11 @@ var ID, board, div, favicon, id, link, nodes, props, thread, x, _ref, _ref1; if (!watched) { - $.get('WatchedThreads', {}, function(item) { - return ThreadWatcher.refresh(item['WatchedThreads']); + $.get('WatchedThreads', {}, function(_arg) { + var WatchedThreads; + + WatchedThreads = _arg.WatchedThreads; + return ThreadWatcher.refresh(WatchedThreads); }); return; } @@ -7798,11 +7801,7 @@ for (ID in _ref1) { thread = _ref1[ID]; favicon = $('.watch-thread-link', thread.OP.nodes.post); - if (ID in watched) { - $.addClass(favicon, 'watched'); - } else { - $.rmClass(favicon, 'watched'); - } + $[ID in watched ? 'addClass' : 'rmClass'](favicon, 'watched'); } }, toggleWatcher: function() { diff --git a/builds/crx/script.js b/builds/crx/script.js index 6092d09e9..478542ca3 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -7749,8 +7749,11 @@ var ID, board, div, favicon, id, link, nodes, props, thread, x, _ref, _ref1; if (!watched) { - $.get('WatchedThreads', {}, function(item) { - return ThreadWatcher.refresh(item['WatchedThreads']); + $.get('WatchedThreads', {}, function(_arg) { + var WatchedThreads; + + WatchedThreads = _arg.WatchedThreads; + return ThreadWatcher.refresh(WatchedThreads); }); return; } @@ -7779,11 +7782,7 @@ for (ID in _ref1) { thread = _ref1[ID]; favicon = $('.watch-thread-link', thread.OP.nodes.post); - if (ID in watched) { - $.addClass(favicon, 'watched'); - } else { - $.rmClass(favicon, 'watched'); - } + $[ID in watched ? 'addClass' : 'rmClass'](favicon, 'watched'); } }, toggleWatcher: function() { diff --git a/src/Monitoring/ThreadWatcher.coffee b/src/Monitoring/ThreadWatcher.coffee index f92eff25a..a2b5fc3c7 100644 --- a/src/Monitoring/ThreadWatcher.coffee +++ b/src/Monitoring/ThreadWatcher.coffee @@ -43,8 +43,8 @@ ThreadWatcher = refresh: (watched) -> unless watched - $.get 'WatchedThreads', {}, (item) -> - ThreadWatcher.refresh item['WatchedThreads'] + $.get 'WatchedThreads', {}, ({WatchedThreads}) -> + ThreadWatcher.refresh WatchedThreads return nodes = [$('.move', ThreadWatcher.dialog)] for board of watched @@ -67,10 +67,7 @@ ThreadWatcher = watched = watched[g.BOARD] or {} for ID, thread of g.BOARD.threads favicon = $ '.watch-thread-link', thread.OP.nodes.post - if ID of watched - $.addClass favicon, 'watched' - else - $.rmClass favicon, 'watched' + $[if ID of watched then 'addClass' else 'rmClass'] favicon, 'watched' return toggleWatcher: ->