]> git.wh0rd.org - tt-rss.git/blobdiff - js/FeedTree.js
scroll to end to show next feed or category
[tt-rss.git] / js / FeedTree.js
index 4ae82d8d96b9fa6fe9da6cae7502b19ba4fa6652..6c06f00d5ea09fc775906a09579540be2b32e957 100644 (file)
@@ -58,12 +58,12 @@ dojo.declare("fox.FeedStoreModel", dijit.tree.ForestStoreModel, {
 
                if (is_cat) {
                        treeItem = this.store._itemsByIdentity['CAT:' + feed];
-                       items = this.store._arrayOfTopLevelItems;
                } else {
                        treeItem = this.store._itemsByIdentity['FEED:' + feed];
-                       items = this.store._arrayOfAllItems;
                }
 
+               items = this.store._arrayOfAllItems;
+
                for (var i = 0; i < items.length; i++) {
                        if (items[i] == treeItem) {
 
@@ -71,14 +71,18 @@ dojo.declare("fox.FeedStoreModel", dijit.tree.ForestStoreModel, {
                                        var unread = this.store.getValue(items[j], 'unread');
                                        var id = this.store.getValue(items[j], 'id');
 
-                                       if (unread > 0 && (is_cat || id.match("FEED:"))) return items[j];
+                                       if (unread > 0 && ((is_cat && id.match("CAT:")) || (!is_cat && id.match("FEED:")))) {
+                                               if( !is_cat || ! (this.store.hasAttribute(items[j], 'parent_id') && this.store.getValue(items[j], 'parent_id') == feed) ) return items[j];
+                                       }
                                }
 
                                for (var j = 0; j < i; j++) {
                                        var unread = this.store.getValue(items[j], 'unread');
                                        var id = this.store.getValue(items[j], 'id');
 
-                                       if (unread > 0 && (is_cat || id.match("FEED:"))) return items[j];
+                                       if (unread > 0 && ((is_cat && id.match("CAT:")) || (!is_cat && id.match("FEED:")))) {
+                                               if( !is_cat || ! (this.store.hasAttribute(items[j], 'parent_id') && this.store.getValue(items[j], 'parent_id') == feed) ) return items[j];
+                                       }
                                }
                        }
                }