From 9e397d0f5a9d2e8e39f27cf714efd4c4cc8cec87 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 12 Aug 2006 15:36:39 +0100 Subject: [PATCH] refresh feeds frame if number of subscriptions failed --- functions.js | 21 +++++++++++++++++++++ tt-rss.js | 1 + 2 files changed, 22 insertions(+) diff --git a/functions.js b/functions.js index cef4692c..495bcd64 100644 --- a/functions.js +++ b/functions.js @@ -481,6 +481,8 @@ function parse_counters(reply, scheduled_call) { var f_document = getFeedsContext().document; var title_obj = getMainContext(); + var feeds_found = 0; + if (reply.firstChild && reply.firstChild.firstChild) { debug("wrong element passed to parse_counters, adjusting."); reply = reply.firstChild; @@ -502,6 +504,10 @@ function parse_counters(reply, scheduled_call) { var has_img = reply.childNodes[l].getAttribute("hi"); var updated = reply.childNodes[l].getAttribute("updated"); + if (t == "feed") { + feeds_found++; + } + if (id == "global-unread") { title_obj.global_unread = ctr; title_obj.updateTitle(); @@ -575,6 +581,21 @@ function parse_counters(reply, scheduled_call) { } } } + + var feeds_stored = getMainContext().number_of_feeds; + + debug("Feed counters, C: " + feeds_found + ", S:" + feeds_stored); + + if (feeds_stored != feeds_found) { + if (feeds_found != 0) { + getMainContext().number_of_feeds = feeds_found; + } + if (feeds_stored != 0 && feeds_found != 0) { + debug("Subscribed feed number changed, refreshing feedlist"); + updateFeedList(); + } + } + } catch (e) { exception_error("parse_counters", e); } diff --git a/tt-rss.js b/tt-rss.js index 8e988ff2..9f83cc5b 100644 --- a/tt-rss.js +++ b/tt-rss.js @@ -13,6 +13,7 @@ var last_refetch = 0; var cookie_lifetime = 0; var active_feed_id = 0; var active_feed_is_cat = false; +var number_of_feeds = 0; var xmlhttp = Ajax.getTransport(); -- 2.39.2