unify return values for getPreviousFeed and usages of both prev/next
This commit is contained in:
parent
2e6d48ead7
commit
d275134f26
|
@ -938,16 +938,16 @@ const App = {
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
this.hotkey_actions["next_feed"] = () => {
|
this.hotkey_actions["next_feed"] = () => {
|
||||||
const rv = dijit.byId("feedTree").getNextFeed(
|
const [feed, is_cat] = Feeds.getNextFeed(
|
||||||
Feeds.getActive(), Feeds.activeIsCat());
|
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"] = () => {
|
this.hotkey_actions["prev_feed"] = () => {
|
||||||
const rv = dijit.byId("feedTree").getPreviousFeed(
|
const [feed, is_cat] = Feeds.getPreviousFeed(
|
||||||
Feeds.getActive(), Feeds.activeIsCat());
|
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) => {
|
this.hotkey_actions["next_article_or_scroll"] = (event) => {
|
||||||
if (this.isCombinedMode())
|
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;
|
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++) {
|
for (let i = 0; i < items.length; i++) {
|
||||||
if (items[i] == treeItem) {
|
if (items[i] == treeItem) {
|
||||||
|
@ -453,7 +453,6 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dojo/_base/array", "dojo/co
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
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'),
|
return [this.model.store.getValue(item, 'bare_id'),
|
||||||
!this.model.store.getValue(item, 'id').match('FEED:')];
|
!this.model.store.getValue(item, 'id').match('FEED:')];
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return [false, false];
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
16
js/Feeds.js
16
js/Feeds.js
|
@ -583,12 +583,26 @@ const Feeds = {
|
||||||
|
|
||||||
return false;
|
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) {
|
getNextUnread: function(feed, is_cat) {
|
||||||
const tree = dijit.byId("feedTree");
|
const tree = dijit.byId("feedTree");
|
||||||
|
|
||||||
if (tree) return tree.getNextUnread(feed, is_cat);
|
if (tree) return tree.getNextUnread(feed, is_cat);
|
||||||
|
|
||||||
return false;
|
return [false, false];
|
||||||
},
|
},
|
||||||
search: function() {
|
search: function() {
|
||||||
xhr.json("backend.php",
|
xhr.json("backend.php",
|
||||||
|
|
Loading…
Reference in New Issue