From 6584da2a68bd98e332098c0326e93072350a5497 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 4 May 2011 01:39:58 +0200 Subject: [PATCH 1/6] Update coffee-script to 1.1.0 --- 4chan_x.js | 76 +++++++++++++++++++++++++++--------------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index 274edf915..58ca92b97 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -60,7 +60,7 @@ (function() { var $, $$, Favicon, NAMESPACE, Recaptcha, anonymize, config, d, expandComment, expandThread, g, imageHover, imgExpand, imgGif, imgPreloading, keybinds, localize, log, main, nav, nodeInserted, options, qr, quickReport, redirect, replyHiding, sauce, threadHiding, threading, titlePost, ui, unread, updater, watcher, _config, _ref; var __slice = Array.prototype.slice; - if (typeof console !== "undefined" && console !== null) { + if (typeof console != "undefined" && console !== null) { log = function(arg) { return console.log(arg); }; @@ -384,7 +384,7 @@ } } }); - if (typeof GM_deleteValue !== "undefined" && GM_deleteValue !== null) { + if (typeof GM_deleteValue != "undefined" && GM_deleteValue !== null) { $.extend($, { deleteValue: function(name) { return GM_deleteValue(name); @@ -1195,8 +1195,8 @@ in the global context. */ return $.globalEval(function() { - var data, _ref3; - data = ((_ref3 = document.querySelector('table font b')) != null ? _ref3.firstChild.textContent : void 0) || ''; + var data, _ref; + data = ((_ref = document.querySelector('table font b')) != null ? _ref.firstChild.textContent : void 0) || ''; return parent.postMessage(data, '*'); }); } @@ -1606,17 +1606,17 @@ span = _ref[_i]; suffix = $('a', span).href; _results.push((function() { - var _len2, _results2; - _results2 = []; - for (i = 0, _len2 = prefixes.length; i < _len2; i++) { + var _len, _results; + _results = []; + for (i = 0, _len = prefixes.length; i < _len; i++) { prefix = prefixes[i]; link = $.el('a', { textContent: names[i], href: prefix + suffix }); - _results2.push($.append(span, $.tn(' '), link)); + _results.push($.append(span, $.tn(' '), link)); } - return _results2; + return _results; })()); } return _results; @@ -1804,10 +1804,10 @@ }; Recaptcha = { init: function() { - var el, recaptcha, _i, _len, _ref2; - _ref2 = $$('#recaptcha_table a'); - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - el = _ref2[_i]; + var el, recaptcha, _i, _len, _ref; + _ref = $$('#recaptcha_table a'); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + el = _ref[_i]; el.tabIndex = 1; } recaptcha = $('#recaptcha_response_field'); @@ -1823,13 +1823,13 @@ } }; nodeInserted = function(e) { - var callback, dialog, target, _i, _len, _ref2, _results; + var callback, dialog, target, _i, _len, _ref, _results; target = e.target; if (target.nodeName === 'TABLE') { - _ref2 = g.callbacks; + _ref = g.callbacks; _results = []; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - callback = _ref2[_i]; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + callback = _ref[_i]; _results.push(callback(target)); } return _results; @@ -1934,11 +1934,11 @@ }, cb: { node: function(root) { - var thumb, _i, _len, _ref2, _results; - _ref2 = $$('img[md5]', root); + var thumb, _i, _len, _ref, _results; + _ref = $$('img[md5]', root); _results = []; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - thumb = _ref2[_i]; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + thumb = _ref[_i]; $.bind(thumb.parentNode, 'click', imgExpand.cb.toggle); _results.push(imgExpand.on ? imgExpand.toggle(thumb) : void 0); } @@ -1973,12 +1973,12 @@ } }, typeChange: function(e) { - var img, _i, _len, _ref2, _results; + var img, _i, _len, _ref, _results; imgExpand.foo(); - _ref2 = $$('img[md5] + img'); + _ref = $$('img[md5] + img'); _results = []; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - img = _ref2[_i]; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + img = _ref[_i]; _results.push(imgExpand.resize(img)); } return _results; @@ -2022,9 +2022,9 @@ return imgExpand.type = $('#imageType').value; }, resize: function(img) { - var imgHeight, imgWidth, maxHeight, maxWidth, maxWidthOP, maxWidthReply, ratio, type, _, _ref2; + var imgHeight, imgWidth, maxHeight, maxWidth, maxWidthOP, maxWidthReply, ratio, type, _, _ref; maxWidthOP = imgExpand.maxWidthOP, maxWidthReply = imgExpand.maxWidthReply, maxHeight = imgExpand.maxHeight, type = imgExpand.type; - _ref2 = $.x("preceding::span[@class][1]/text()[2]", img).textContent.match(/(\d+)x(\d+)/), _ = _ref2[0], imgWidth = _ref2[1], imgHeight = _ref2[2]; + _ref = $.x("preceding::span[@class][1]/text()[2]", img).textContent.match(/(\d+)x(\d+)/), _ = _ref[0], imgWidth = _ref[1], imgHeight = _ref[2]; imgWidth = Number(imgWidth); imgHeight = Number(imgHeight); if (img.parentNode.parentNode.nodeName === 'TD') { @@ -2048,15 +2048,15 @@ } }, dialog: function() { - var controls, delform, imageType, option, _i, _len, _ref2; + var controls, delform, imageType, option, _i, _len, _ref; controls = $.el('div', { id: 'imgControls', innerHTML: " " }); imageType = $.getValue('imageType', 'full'); - _ref2 = $$('option', controls); - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - option = _ref2[_i]; + _ref = $$('option', controls); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + option = _ref[_i]; if (option.textContent === imageType) { option.selected = true; break; @@ -2077,7 +2077,7 @@ }; main = { init: function() { - var DAY, callback, cutoff, hiddenThreads, id, lastChecked, now, pathname, temp, timestamp, tzOffset, _i, _len, _ref2, _ref3; + var DAY, callback, cutoff, hiddenThreads, id, lastChecked, now, pathname, temp, timestamp, tzOffset, _i, _len, _ref, _ref2; pathname = location.pathname.substring(1).split('/'); g.BOARD = pathname[0], temp = pathname[1]; if (temp === 'res') { @@ -2116,9 +2116,9 @@ delete hiddenThreads[id]; } } - _ref2 = g.hiddenReplies; - for (id in _ref2) { - timestamp = _ref2[id]; + _ref = g.hiddenReplies; + for (id in _ref) { + timestamp = _ref[id]; if (timestamp < cutoff) { delete g.hiddenReplies[id]; } @@ -2200,9 +2200,9 @@ expandComment.init(); } } - _ref3 = g.callbacks; - for (_i = 0, _len = _ref3.length; _i < _len; _i++) { - callback = _ref3[_i]; + _ref2 = g.callbacks; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + callback = _ref2[_i]; callback(); } $.bind(d.body, 'DOMNodeInserted', nodeInserted); From fa2ebec87a98e9c1b51d7d1ecb088de3e51e53bc Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 4 May 2011 01:52:04 +0200 Subject: [PATCH 2/6] Better thread watcher list update on un/watch. --- 4chan_x.js | 32 ++++++++++++++++++++++++++------ script.coffee | 17 ++++++++++++----- 2 files changed, 38 insertions(+), 11 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index 58ca92b97..d99e3d88a 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1496,6 +1496,28 @@ } return _results; }, + list: function(watched) { + var board, div, id, props, _results; + div = $('#watcher > div:not(.move)'); + while (div) { + $.remove(div); + div = $('#watcher > div:not(.move)'); + } + _results = []; + for (board in watched) { + _results.push((function() { + var _ref, _results; + _ref = watched[board]; + _results = []; + for (id in _ref) { + props = _ref[id]; + _results.push(watcher.addLink(props, $('#watcher'))); + } + return _results; + })()); + } + return _results; + }, addLink: function(props, dialog) { var div, link, x; dialog || (dialog = $('#watcher')); @@ -1529,17 +1551,15 @@ } }, unwatch: function(board, id) { - var div, favicon, href, input, watched; - href = "/" + board + "/res/" + id; - div = $("#watcher a[href=\"" + href + "\"]").parentNode; - $.remove(div); + var favicon, input, watched; if (input = $("input[name=\"" + id + "\"]")) { favicon = input.previousSibling; favicon.src = Favicon.empty; } watched = $.getValue('watched', {}); delete watched[board][id]; - return $.setValue('watched', watched); + $.setValue('watched', watched); + return watcher.list(watched); }, watch: function(thread) { var favicon, id, props, tc, watched, _name; @@ -1558,7 +1578,7 @@ watched[_name = g.BOARD] || (watched[_name] = {}); watched[g.BOARD][id] = props; $.setValue('watched', watched); - return watcher.addLink(props); + return watcher.list(watched); } }; anonymize = { diff --git a/script.coffee b/script.coffee index c535fdc85..8238de541 100644 --- a/script.coffee +++ b/script.coffee @@ -1184,6 +1184,15 @@ watcher = $.bind favicon, 'click', watcher.cb.toggle $.before input, favicon + list: (watched) -> + div = $ '#watcher > div:not(.move)' + while div + $.remove div + div = $ '#watcher > div:not(.move)' + for board of watched + for id, props of watched[board] + watcher.addLink props, $ '#watcher' + addLink: (props, dialog) -> dialog or= $ '#watcher' div = $.el 'div' @@ -1212,10 +1221,6 @@ watcher = watcher.unwatch g.BOARD, id unwatch: (board, id) -> - href = "/#{board}/res/#{id}" - div = $("#watcher a[href=\"#{href}\"]").parentNode - $.remove div - if input = $ "input[name=\"#{id}\"]" favicon = input.previousSibling favicon.src = Favicon.empty @@ -1224,6 +1229,8 @@ watcher = delete watched[board][id] $.setValue 'watched', watched + watcher.list watched + watch: (thread) -> favicon = $ 'img.favicon', thread return if favicon.src is Favicon.default @@ -1240,7 +1247,7 @@ watcher = watched[g.BOARD][id] = props $.setValue 'watched', watched - watcher.addLink props + watcher.list watched anonymize = init: -> From ca2051313d73af579b824c206263eebc4e073c16 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 4 May 2011 01:58:39 +0200 Subject: [PATCH 3/6] A bit deeper. --- 4chan_x.js | 11 ++--------- script.coffee | 5 +---- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index d99e3d88a..929d5a3fa 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1461,7 +1461,7 @@ }; watcher = { init: function() { - var board, dialog, favicon, html, id, input, inputs, props, src, watched, watchedBoard, _i, _len, _ref, _results; + var dialog, favicon, html, id, input, inputs, src, watched, watchedBoard, _i, _len, _results; html = '
Thread Watcher
'; dialog = ui.dialog('watcher', { top: '50px', @@ -1469,13 +1469,7 @@ }, html); $.append(d.body, dialog); watched = $.getValue('watched', {}); - for (board in watched) { - _ref = watched[board]; - for (id in _ref) { - props = _ref[id]; - watcher.addLink(props, dialog); - } - } + watcher.list(watched); watchedBoard = watched[g.BOARD] || {}; inputs = $$('form > input[value=delete], div.thread > input[value=delete]'); _results = []; @@ -1520,7 +1514,6 @@ }, addLink: function(props, dialog) { var div, link, x; - dialog || (dialog = $('#watcher')); div = $.el('div'); x = $.el('a', { textContent: 'X' diff --git a/script.coffee b/script.coffee index 8238de541..d5b3ee50f 100644 --- a/script.coffee +++ b/script.coffee @@ -1165,9 +1165,7 @@ watcher = #populate watcher watched = $.getValue 'watched', {} - for board of watched - for id, props of watched[board] - watcher.addLink props, dialog + watcher.list watched #add watch buttons watchedBoard = watched[g.BOARD] or {} @@ -1194,7 +1192,6 @@ watcher = watcher.addLink props, $ '#watcher' addLink: (props, dialog) -> - dialog or= $ '#watcher' div = $.el 'div' x = $.el 'a', textContent: 'X' From 62763b2e0c896947d69b321bebaa2fc9cc58755e Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 4 May 2011 09:09:34 +0200 Subject: [PATCH 4/6] Rename function. A bit deeper. --- 4chan_x.js | 12 +++++------- script.coffee | 12 +++++------- 2 files changed, 10 insertions(+), 14 deletions(-) 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: -> From 741e52a04751c1598eace413468c6baba7b18a10 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 4 May 2011 11:20:30 +0200 Subject: [PATCH 5/6] OP here. Nevermind I found out. --- 4chan_x.js | 84 +++++++++++++++++++++++++++--------------------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index 6fe6c91af..3e73a3e75 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -60,7 +60,7 @@ (function() { var $, $$, Favicon, NAMESPACE, Recaptcha, anonymize, config, d, expandComment, expandThread, g, imageHover, imgExpand, imgGif, imgPreloading, keybinds, localize, log, main, nav, nodeInserted, options, qr, quickReport, redirect, replyHiding, sauce, threadHiding, threading, titlePost, ui, unread, updater, watcher, _config, _ref; var __slice = Array.prototype.slice; - if (typeof console != "undefined" && console !== null) { + if (typeof console !== "undefined" && console !== null) { log = function(arg) { return console.log(arg); }; @@ -384,7 +384,7 @@ } } }); - if (typeof GM_deleteValue != "undefined" && GM_deleteValue !== null) { + if (typeof GM_deleteValue !== "undefined" && GM_deleteValue !== null) { $.extend($, { deleteValue: function(name) { return GM_deleteValue(name); @@ -1195,8 +1195,8 @@ in the global context. */ return $.globalEval(function() { - var data, _ref; - data = ((_ref = document.querySelector('table font b')) != null ? _ref.firstChild.textContent : void 0) || ''; + var data, _ref3; + data = ((_ref3 = document.querySelector('table font b')) != null ? _ref3.firstChild.textContent : void 0) || ''; return parent.postMessage(data, '*'); }); } @@ -1498,14 +1498,14 @@ _results = []; for (board in watched) { _results.push((function() { - var _ref, _results; + var _ref, _results2; _ref = watched[board]; - _results = []; + _results2 = []; for (id in _ref) { props = _ref[id]; - _results.push(watcher.addLink(props, $('#watcher'))); + _results2.push(watcher.addLink(props, $('#watcher'))); } - return _results; + return _results2; })()); } return _results; @@ -1617,17 +1617,17 @@ span = _ref[_i]; suffix = $('a', span).href; _results.push((function() { - var _len, _results; - _results = []; - for (i = 0, _len = prefixes.length; i < _len; i++) { + var _len2, _results2; + _results2 = []; + for (i = 0, _len2 = prefixes.length; i < _len2; i++) { prefix = prefixes[i]; link = $.el('a', { textContent: names[i], href: prefix + suffix }); - _results.push($.append(span, $.tn(' '), link)); + _results2.push($.append(span, $.tn(' '), link)); } - return _results; + return _results2; })()); } return _results; @@ -1815,10 +1815,10 @@ }; Recaptcha = { init: function() { - var el, recaptcha, _i, _len, _ref; - _ref = $$('#recaptcha_table a'); - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - el = _ref[_i]; + var el, recaptcha, _i, _len, _ref2; + _ref2 = $$('#recaptcha_table a'); + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + el = _ref2[_i]; el.tabIndex = 1; } recaptcha = $('#recaptcha_response_field'); @@ -1834,13 +1834,13 @@ } }; nodeInserted = function(e) { - var callback, dialog, target, _i, _len, _ref, _results; + var callback, dialog, target, _i, _len, _ref2, _results; target = e.target; if (target.nodeName === 'TABLE') { - _ref = g.callbacks; + _ref2 = g.callbacks; _results = []; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - callback = _ref[_i]; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + callback = _ref2[_i]; _results.push(callback(target)); } return _results; @@ -1945,11 +1945,11 @@ }, cb: { node: function(root) { - var thumb, _i, _len, _ref, _results; - _ref = $$('img[md5]', root); + var thumb, _i, _len, _ref2, _results; + _ref2 = $$('img[md5]', root); _results = []; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - thumb = _ref[_i]; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + thumb = _ref2[_i]; $.bind(thumb.parentNode, 'click', imgExpand.cb.toggle); _results.push(imgExpand.on ? imgExpand.toggle(thumb) : void 0); } @@ -1984,12 +1984,12 @@ } }, typeChange: function(e) { - var img, _i, _len, _ref, _results; + var img, _i, _len, _ref2, _results; imgExpand.foo(); - _ref = $$('img[md5] + img'); + _ref2 = $$('img[md5] + img'); _results = []; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - img = _ref[_i]; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + img = _ref2[_i]; _results.push(imgExpand.resize(img)); } return _results; @@ -2033,9 +2033,9 @@ return imgExpand.type = $('#imageType').value; }, resize: function(img) { - var imgHeight, imgWidth, maxHeight, maxWidth, maxWidthOP, maxWidthReply, ratio, type, _, _ref; + var imgHeight, imgWidth, maxHeight, maxWidth, maxWidthOP, maxWidthReply, ratio, type, _, _ref2; maxWidthOP = imgExpand.maxWidthOP, maxWidthReply = imgExpand.maxWidthReply, maxHeight = imgExpand.maxHeight, type = imgExpand.type; - _ref = $.x("preceding::span[@class][1]/text()[2]", img).textContent.match(/(\d+)x(\d+)/), _ = _ref[0], imgWidth = _ref[1], imgHeight = _ref[2]; + _ref2 = $.x("preceding::span[@class][1]/text()[2]", img).textContent.match(/(\d+)x(\d+)/), _ = _ref2[0], imgWidth = _ref2[1], imgHeight = _ref2[2]; imgWidth = Number(imgWidth); imgHeight = Number(imgHeight); if (img.parentNode.parentNode.nodeName === 'TD') { @@ -2059,15 +2059,15 @@ } }, dialog: function() { - var controls, delform, imageType, option, _i, _len, _ref; + var controls, delform, imageType, option, _i, _len, _ref2; controls = $.el('div', { id: 'imgControls', innerHTML: " " }); imageType = $.getValue('imageType', 'full'); - _ref = $$('option', controls); - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - option = _ref[_i]; + _ref2 = $$('option', controls); + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + option = _ref2[_i]; if (option.textContent === imageType) { option.selected = true; break; @@ -2088,7 +2088,7 @@ }; main = { init: function() { - var DAY, callback, cutoff, hiddenThreads, id, lastChecked, now, pathname, temp, timestamp, tzOffset, _i, _len, _ref, _ref2; + var DAY, callback, cutoff, hiddenThreads, id, lastChecked, now, pathname, temp, timestamp, tzOffset, _i, _len, _ref2, _ref3; pathname = location.pathname.substring(1).split('/'); g.BOARD = pathname[0], temp = pathname[1]; if (temp === 'res') { @@ -2127,9 +2127,9 @@ delete hiddenThreads[id]; } } - _ref = g.hiddenReplies; - for (id in _ref) { - timestamp = _ref[id]; + _ref2 = g.hiddenReplies; + for (id in _ref2) { + timestamp = _ref2[id]; if (timestamp < cutoff) { delete g.hiddenReplies[id]; } @@ -2211,9 +2211,9 @@ expandComment.init(); } } - _ref2 = g.callbacks; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - callback = _ref2[_i]; + _ref3 = g.callbacks; + for (_i = 0, _len = _ref3.length; _i < _len; _i++) { + callback = _ref3[_i]; callback(); } $.bind(d.body, 'DOMNodeInserted', nodeInserted); From 8d30da48852ddf5163f83171488fe84ea67ea262 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 4 May 2011 18:42:25 +0200 Subject: [PATCH 6/6] This is wrong and you know it. --- 4chan_x.js | 14 ++++++++------ script.coffee | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index 3e73a3e75..ce589e7d6 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1491,18 +1491,20 @@ return _results; }, refresh: function(watched) { - var board, div, id, props, _results; - while (div = $('#watcher > div:not(.move)')) { + var board, div, id, props, _i, _len, _ref, _results; + _ref = $$('#watcher > div:not(.move)'); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + div = _ref[_i]; $.remove(div); } _results = []; for (board in watched) { _results.push((function() { - var _ref, _results2; - _ref = watched[board]; + var _ref2, _results2; + _ref2 = watched[board]; _results2 = []; - for (id in _ref) { - props = _ref[id]; + for (id in _ref2) { + props = _ref2[id]; _results2.push(watcher.addLink(props, $('#watcher'))); } return _results2; diff --git a/script.coffee b/script.coffee index b6087329b..c8cce8408 100644 --- a/script.coffee +++ b/script.coffee @@ -1183,7 +1183,7 @@ watcher = $.before input, favicon refresh: (watched) -> - while div = $ '#watcher > div:not(.move)' + for div in $$ '#watcher > div:not(.move)' $.remove div for board of watched for id, props of watched[board]