diff --git a/4chan_x.coffee b/4chan_x.coffee index 3286b441f..bc20ae44c 100644 --- a/4chan_x.coffee +++ b/4chan_x.coffee @@ -864,13 +864,17 @@ updateFavicon = -> updateTime = -> span = $ '#updater #timer' time = Number span.textContent + count = $ '#updater #count' + count.textContent = '' + count.className = '' if ++time is 0 updateNow() else if time > 10 - time = 0 g.req.abort() updateNow() - span.textContent = time + count.textContent = 'retry' + else + span.textContent = time updateTitle = -> len = g.replies.length @@ -897,11 +901,9 @@ updateInterval = -> span.textContent = -1 * num updateNow = -> + $("#updater #timer").textContent = 0 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 cce06ec36..06fe80168 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1185,17 +1185,21 @@ return replace(favicon, clone); }; updateTime = function() { - var span, time; + var count, span, time; span = $('#updater #timer'); time = Number(span.textContent); + count = $('#updater #count'); + count.textContent = ''; + count.className = ''; if (++time === 0) { - updateNow(); + return updateNow(); } else if (time > 10) { - time = 0; g.req.abort(); updateNow(); + return count.textContent = 'retry'; + } else { + return span.textContent = time; } - return span.textContent = time; }; updateTitle = function() { var len; @@ -1227,12 +1231,10 @@ } }; updateNow = function() { - var count, url; + var url; + $("#updater #timer").textContent = 0; url = location.href + '?' + new Date().getTime(); - g.req = request(url, updateCallback); - count = $('#updater #count'); - count.textContent = 'Updating...'; - return count.className = ''; + return g.req = request(url, updateCallback); }; updaterMake = function() { var autoG, autoL, div, html, interval;