getItemById: function(id) {
return this.store._itemsByIdentity[id];
},
- getFeedValue: function(feed, is_cat, key) {
+ getFeedValue: function(feed, is_cat, key) {
if (!this.store._itemsByIdentity) return undefined;
- if (is_cat)
+ if (is_cat)
treeItem = this.store._itemsByIdentity['CAT:' + feed];
else
treeItem = this.store._itemsByIdentity['FEED:' + feed];
if (treeItem)
return this.store.getValue(treeItem, key);
},
- getFeedName: function(feed, is_cat) {
+ getFeedName: function(feed, is_cat) {
return this.getFeedValue(feed, is_cat, 'name');
},
getFeedUnread: function(feed, is_cat) {
if (!value) value = '';
if (!this.store._itemsByIdentity) return undefined;
- if (is_cat)
+ if (is_cat)
treeItem = this.store._itemsByIdentity['CAT:' + feed];
else
treeItem = this.store._itemsByIdentity['FEED:' + feed];
}
}
}
-
+
return null;
},
hasCats: function() {
dojo.declare("fox.FeedTree", dijit.Tree, {
_createTreeNode: function(args) {
var tnode = new dijit._TreeNode(args);
-
+
if (args.item.icon)
tnode.iconNode.src = args.item.icon[0];
return (item.unread == 0) ? "dijitTreeLabel" : "dijitTreeLabel Unread";
},
getRowClass: function (item, opened) {
- return (!item.error || item.error == '') ? "dijitTreeRow" :
+ return (!item.error || item.error == '') ? "dijitTreeRow" :
"dijitTreeRow Error";
},
getLabel: function(item) {
}
},
selectFeed: function(feed, is_cat) {
- if (is_cat)
+ if (is_cat)
treeNode = this._itemNodesMap['CAT:' + feed];
else
treeNode = this._itemNodesMap['FEED:' + feed];
}
},
setFeedIcon: function(feed, is_cat, src) {
- if (is_cat)
+ if (is_cat)
treeNode = this._itemNodesMap['CAT:' + feed];
else
treeNode = this._itemNodesMap['FEED:' + feed];
return false;
},
setFeedExpandoIcon: function(feed, is_cat, src) {
- if (is_cat)
+ if (is_cat)
treeNode = this._itemNodesMap['CAT:' + feed];
else
treeNode = this._itemNodesMap['FEED:' + feed];
var tree = this;
var cats = this.model.store._arrayOfTopLevelItems;
-
+
cats.each(function(cat) {
var cat_unread = tree.hideReadFeeds(cat.items, hide, show_special);
-
+
var id = String(cat.id);
var node = tree._itemNodesMap[id];
var bare_id = parseInt(id.substr(id.indexOf(":")+1));
-
+
if (node) {
var check_unread = tree.model.getFeedUnread(bare_id, true);
-
+
if (hide && cat_unread == 0 && check_unread == 0) {
- Effect.Fade(node[0].rowNode, {duration : 0.3,
+ Effect.Fade(node[0].rowNode, {duration : 0.3,
queue: { position: 'end', scope: 'FFADE-' + id, limit: 1 }});
} else {
Element.show(node[0].rowNode);
++cat_unread;
}
- }
+ }
});
} else {
- this.hideReadFeeds(this.model.store._arrayOfTopLevelItems, hide,
+ this.hideReadFeeds(this.model.store._arrayOfTopLevelItems, hide,
show_special);
}
},
items.each(function(feed) {
var id = String(feed.id);
var bare_id = parseInt(feed.bare_id);;
-
+
var unread = feed.unread[0];
var node = tree._itemNodesMap[id];
-
+
if (node) {
if (hide && unread == 0 && (bare_id > 0 || !show_special)) {
- Effect.Fade(node[0].rowNode, {duration : 0.3,
+ Effect.Fade(node[0].rowNode, {duration : 0.3,
queue: { position: 'end', scope: 'FFADE-' + id, limit: 1 }});
} else {
Element.show(node[0].rowNode);
}
}
});
-
+
return cat_unread;
},
collapseCat: function(id) {
if (node && item) {
var hidden = tree.model.store.getValue(item, 'hidden');
- if (hidden)
+ if (hidden)
tree._expandNode(node);
else
tree._collapseNode(node);
var id = tree.model.store.getValue(cat, 'id');
var node = tree._itemNodesMap[id][0];
- if (hidden)
+ if (hidden)
tree._collapseNode(node);
else
tree._expandNode(node);
});
},
+ getVisibleUnreadFeeds: function() {
+ var items = this.model.store._arrayOfAllItems;
+ var rv = [];
+
+ for (var i = 0; i < items.length; i++) {
+ var id = String(items[i].id);
+ var box = this._itemNodesMap[id];
+
+ if (box) {
+ var row = box[0].rowNode;
+ var cat = false;
+
+ try {
+ cat = box[0].rowNode.parentNode.parentNode;
+ } catch (e) { }
+
+ if (row) {
+ if (Element.visible(row) && (!cat || Element.visible(cat))) {
+ var feed_id = String(items[i].bare_id);
+ var is_cat = !id.match('FEED:');
+ var unread = this.model.getFeedUnread(feed_id, is_cat);
+
+ if (unread > 0)
+ rv.push([feed_id, is_cat]);
+
+ }
+ }
+ }
+ }
+
+ return rv;
+ },
getNextFeed: function (feed, is_cat) {
if (is_cat) {
treeItem = this.model.store._itemsByIdentity['CAT:' + feed];
if (items[i] == treeItem) {
for (j = i+1; j < items.length; j++) {
- var id = String(items[j].id);
+ var id = String(items[j].id);
var box = this._itemNodesMap[id];
if (box) {
}
if (item) {
- return [this.model.store.getValue(item, 'bare_id'),
+ return [this.model.store.getValue(item, 'bare_id'),
!this.model.store.getValue(item, 'id').match('FEED:')];
} else {
return false;
if (items[i] == treeItem) {
for (j = i-1; j > 0; j--) {
- var id = String(items[j].id);
+ var id = String(items[j].id);
var box = this._itemNodesMap[id];
if (box) {
}
if (item) {
- return [this.model.store.getValue(item, 'bare_id'),
+ return [this.model.store.getValue(item, 'bare_id'),
!this.model.store.getValue(item, 'id').match('FEED:')];
} else {
return false;