view: implement a hack to fake counter updates for current feed and its parent

master
Andrew Dolgov 13 years ago
parent 21e42e5fb0
commit 6c8e8fbdc9

@ -433,5 +433,14 @@ dojo.declare("fox.FeedTree", dijit.Tree, {
} }
}, },
getFeedCategory: function(feed) {
try {
return this.getNodesByItem(this.model.store.
_itemsByIdentity["FEED:" + feed])[0].
getParent().item.bare_id[0];
} catch (e) {
return false;
}
},
}); });

@ -345,6 +345,20 @@ function getFeedUnread(feed, is_cat) {
return -1; return -1;
} }
function getFeedCategory(feed) {
try {
var tree = dijit.byId("feedTree");
if (tree && tree.model)
return tree.getFeedCategory(feed);
} catch (e) {
//
}
return false;
}
function hideOrShowFeeds(hide) { function hideOrShowFeeds(hide) {
var tree = dijit.byId("feedTree"); var tree = dijit.byId("feedTree");

@ -391,6 +391,24 @@ function view(id) {
console.log(query); console.log(query);
if (article_is_unread) {
var ctr = getFeedUnread(getActiveFeedId(), activeFeedIsCat());
if (ctr > 0) {
setFeedUnread(getActiveFeedId(), activeFeedIsCat(), ctr - 1);
var cat = parseInt(getFeedCategory(getActiveFeedId()));
if (!isNaN(cat)) {
ctr = getFeedUnread(cat, true);
if (ctr > 0) {
setFeedUnread(cat, true, ctr - 1);
}
}
}
}
new Ajax.Request("backend.php", { new Ajax.Request("backend.php", {
parameters: query, parameters: query,
onComplete: function(transport) { onComplete: function(transport) {

Loading…
Cancel
Save