updater feedback/ui

This commit is contained in:
James Campos 2011-01-17 08:30:59 -08:00
parent 7ad7249805
commit d1dd1b8584
2 changed files with 12 additions and 4 deletions

View File

@ -833,7 +833,7 @@ updateCallback = ->
l = arr.length l = arr.length
count.textContent = "+#{l}" 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 #insert replies in order, so backlinks resolve
while reply = arr.pop() while reply = arr.pop()
@ -897,6 +897,9 @@ updateInterval = ->
updateNow = -> updateNow = ->
url = location.href + '?' + new Date().getTime() # fool the cache url = location.href + '?' + new Date().getTime() # fool the cache
g.req = request url, updateCallback g.req = request url, updateCallback
count = $ '#updater #count'
count.textContent = 'Updating...'
count.className = ''
updaterMake = -> updaterMake = ->
html = "<div class=move><span id=count></span> <span id=timer>Thread Updater</span></div>" html = "<div class=move><span id=count></span> <span id=timer>Thread Updater</span></div>"

View File

@ -1097,7 +1097,9 @@
} }
l = arr.length; l = arr.length;
count.textContent = "+" + l; count.textContent = "+" + l;
count.className = l === 0 ? '' : 'new'; if (l > 0) {
count.className = 'new';
}
while (reply = arr.pop()) { while (reply = arr.pop()) {
table = x('ancestor::table', reply); table = x('ancestor::table', reply);
inBefore(root, table); inBefore(root, table);
@ -1168,9 +1170,12 @@
} }
}; };
updateNow = function() { updateNow = function() {
var url; var count, url;
url = location.href + '?' + new Date().getTime(); 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() { updaterMake = function() {
var autoG, autoL, div, html, interval; var autoG, autoL, div, html, interval;