summaryrefslogtreecommitdiff
path: root/FeedTree.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2010-11-20 11:25:08 +0300
committerAndrew Dolgov <[email protected]>2010-11-20 11:25:08 +0300
commit692de15991a7be43afd515e3b9fde3d0a713de3d (patch)
tree58a21dc16cd9fa1439d135797c75e59e4b764260 /FeedTree.js
parente5d9c770520d436d34c45a49e57806a77396c915 (diff)
fix opening next unread feed on catchup
Diffstat (limited to 'FeedTree.js')
-rw-r--r--FeedTree.js41
1 files changed, 37 insertions, 4 deletions
diff --git a/FeedTree.js b/FeedTree.js
index 19c32a95f..76b46601b 100644
--- a/FeedTree.js
+++ b/FeedTree.js
@@ -52,6 +52,42 @@ dojo.declare("fox.FeedStoreModel", dijit.tree.ForestStoreModel, {
if (treeItem)
return this.store.setValue(treeItem, key, value);
},
+ getNextUnreadFeed: function (feed, is_cat) {
+ if (is_cat) {
+ treeItem = this.store._itemsByIdentity['CAT:' + feed];
+ items = this.store._arrayOfTopLevelItems;
+ } else {
+ treeItem = this.store._itemsByIdentity['FEED:' + feed];
+ items = this.store._arrayOfAllItems;
+ }
+
+ for (var i = 0; i < items.length; i++) {
+ if (items[i] == treeItem) {
+
+ for (j = i+1; j < items.length; 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];
+ }
+
+ for (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];
+ }
+ }
+ }
+
+ return null;
+ },
+ hasCats: function() {
+ if (this.store && this.store._itemsByIdentity)
+ return this.store._itemsByIdentity['CAT:-1'] != undefined;
+ else
+ return false;
+ },
});
dojo.declare("fox.FeedTree", dijit.Tree, {
@@ -144,10 +180,7 @@ dojo.declare("fox.FeedTree", dijit.Tree, {
return false;
},
hasCats: function() {
- if (this.model.store && this.model.store._itemsByIdentity)
- return this.model.store._itemsByIdentity['CAT:-1'] != undefined;
- else
- return false;
+ return this.model.hasCats();
},
hideRead: function (hide, show_special) {
if (this.hasCats()) {