From 090e250b6905ecbc078cdc2f485f343a1d3a7bfc Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 8 Sep 2005 13:10:07 +0100 Subject: automagically updating labels with cute XML RPC --- tt-rss.js | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'tt-rss.js') diff --git a/tt-rss.js b/tt-rss.js index 4f532d60a..d1bcad692 100644 --- a/tt-rss.js +++ b/tt-rss.js @@ -49,17 +49,37 @@ function feedlist_callback() { */ function refetch_callback() { - if (xmlhttp.readyState == 4) { document.title = "Tiny Tiny RSS"; notify("All feeds updated."); - updateFeedList(); - - } -} + var reply = xmlhttp.responseXML.firstChild; + + var f_document = window.frames["feeds-frame"].document; + + for (var l = 0; l < reply.childNodes.length; l++) { + var id = reply.childNodes[l].getAttribute("id"); + var ctr = reply.childNodes[l].getAttribute("counter"); + var feedctr = f_document.getElementById("FEEDCTR-" + id); + var feedu = f_document.getElementById("FEEDU-" + id); + var feedr = f_document.getElementById("FEEDR-" + id); + + feedu.innerHTML = ctr; + + if (ctr > 0) { + feedctr.className = "odd"; + if (id > 0 && !feedr.className.match("Unread")) { + feedr.className = feedr.className + "Unread"; + } + } else { + feedctr.className = "invisible"; + feedr.className = feedr.className.replace("Unread", ""); + } + } + } +} function updateFeed(feed_id) { -- cgit v1.2.3