From d1dd1b8584f7031c0386e2c717c7300008f093ce Mon Sep 17 00:00:00 2001 From: James Campos Date: Mon, 17 Jan 2011 08:30:59 -0800 Subject: [PATCH] updater feedback/ui --- 4chan_x.coffee | 5 ++++- 4chan_x.js | 11 ++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/4chan_x.coffee b/4chan_x.coffee index adbc861c1..c189c9c47 100644 --- a/4chan_x.coffee +++ b/4chan_x.coffee @@ -833,7 +833,7 @@ updateCallback = -> l = arr.length count.textContent = "+#{l}" - count.className = if l is 0 then '' else 'new' + if l > 0 then count.className = 'new' #insert replies in order, so backlinks resolve while reply = arr.pop() @@ -897,6 +897,9 @@ updateInterval = -> updateNow = -> url = location.href + '?' + new Date().getTime() # fool the cache g.req = request url, updateCallback + count = $ '#updater #count' + count.textContent = 'Updating...' + count.className = '' updaterMake = -> html = "
Thread Updater
" diff --git a/4chan_x.js b/4chan_x.js index ed183a0ec..0ccec2742 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1097,7 +1097,9 @@ } l = arr.length; count.textContent = "+" + l; - count.className = l === 0 ? '' : 'new'; + if (l > 0) { + count.className = 'new'; + } while (reply = arr.pop()) { table = x('ancestor::table', reply); inBefore(root, table); @@ -1168,9 +1170,12 @@ } }; updateNow = function() { - var url; + var count, url; url = location.href + '?' + new Date().getTime(); - return g.req = request(url, updateCallback); + g.req = request(url, updateCallback); + count = $('#updater #count'); + count.textContent = 'Updating...'; + return count.className = ''; }; updaterMake = function() { var autoG, autoL, div, html, interval;