diff --git a/js/App.js b/js/App.js index a9d796968..a9da8a1c0 100644 --- a/js/App.js +++ b/js/App.js @@ -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()) diff --git a/js/FeedTree.js b/js/FeedTree.js index 50a1fe643..f02a61859 100755 --- a/js/FeedTree.js +++ b/js/FeedTree.js @@ -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]; } }, diff --git a/js/Feeds.js b/js/Feeds.js index 2c468c934..818973542 100644 --- a/js/Feeds.js +++ b/js/Feeds.js @@ -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",