]> git.wh0rd.org Git - tt-rss.git/commitdiff
refresh feeds frame if number of subscriptions failed
authorAndrew Dolgov <fox@bah.spb.su>
Sat, 12 Aug 2006 14:36:39 +0000 (15:36 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Sat, 12 Aug 2006 14:36:39 +0000 (15:36 +0100)
functions.js
tt-rss.js

index cef4692c649fef46630ec8fe4fb85d96f72b242b..495bcd6464cf2bbe9c997e529361dc99e150410d 100644 (file)
@@ -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("<b>wrong element passed to parse_counters, adjusting.</b>");
                        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);
        }
index 8e988ff2691d0117660188771c277232132f617b..9f83cc5be6a4f819c0a4e36b0a47c177bbcd4c47 100644 (file)
--- 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();