unify return values for getPreviousFeed and usages of both prev/next

master
Andrew Dolgov 4 years ago
parent 2e6d48ead7
commit d275134f26

@ -938,16 +938,16 @@ const App = {
} else {
this.hotkey_actions["next_feed"] = () => {
const rv = dijit.byId("feedTree").getNextFeed(
const [feed, is_cat] = Feeds.getNextFeed(
Feeds.getActive(), Feeds.activeIsCat());
if (rv) Feeds.open({feed: rv[0], is_cat: rv[1], delayed: true})
Feeds.open({feed: feed, is_cat: is_cat, delayed: true})
};
this.hotkey_actions["prev_feed"] = () => {
const rv = dijit.byId("feedTree").getPreviousFeed(
const [feed, is_cat] = Feeds.getPreviousFeed(
Feeds.getActive(), Feeds.activeIsCat());
if (rv) Feeds.open({feed: rv[0], is_cat: rv[1], delayed: true})
Feeds.open({feed: feed, is_cat: is_cat, delayed: true})
};
this.hotkey_actions["next_article_or_scroll"] = (event) => {
if (this.isCombinedMode())

@ -435,7 +435,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dojo/_base/array", "dojo/co
}
const items = this.model.store._arrayOfAllItems;
let item = items[0] == treeItem ? items[items.length-1] : items[0];
let item = false;
for (let i = 0; i < items.length; i++) {
if (items[i] == treeItem) {
@ -453,7 +453,6 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dojo/_base/array", "dojo/co
break;
}
}
}
break;
}
@ -463,7 +462,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dojo/_base/array", "dojo/co
return [this.model.store.getValue(item, 'bare_id'),
!this.model.store.getValue(item, 'id').match('FEED:')];
} else {
return false;
return [false, false];
}
},

@ -583,12 +583,26 @@ const Feeds = {
return false;
},
getNextFeed: function(feed, is_cat) {
const tree = dijit.byId("feedTree");
if (tree) return tree.getNextFeed(feed, is_cat, false);
return [false, false];
},
getPreviousFeed: function(feed, is_cat) {
const tree = dijit.byId("feedTree");
if (tree) return tree.getPreviousFeed(feed, is_cat);
return [false, false];
},
getNextUnread: function(feed, is_cat) {
const tree = dijit.byId("feedTree");
if (tree) return tree.getNextUnread(feed, is_cat);
return false;
return [false, false];
},
search: function() {
xhr.json("backend.php",

Loading…
Cancel
Save