- update descriptions of changed hotkeys

- bind noscroll variants of move article hotkeys to n/p by default
- update N/P (i.e. scroll article content) hotkeys to scroll by fraction of viewport height instead of hardcoded pixel distance
- minor fixes w/ checking for undefined
master
Andrew Dolgov 5 years ago
parent 985e11b754
commit 0a10832491

@ -1041,10 +1041,10 @@
__("Navigation") => array( __("Navigation") => array(
"next_feed" => __("Open next feed"), "next_feed" => __("Open next feed"),
"prev_feed" => __("Open previous feed"), "prev_feed" => __("Open previous feed"),
"next_article" => __("Open next article (scroll long articles)"), "next_article_or_scroll" => __("Open next article (in combined mode, scroll down)"),
"prev_article" => __("Open previous article (scroll long articles)"), "prev_article_or_scroll" => __("Open previous article (in combined mode, scroll up)"),
"next_article_page" => __("Open next article (scroll down page)"), "next_article_page" => __("Scroll article by one page down"),
"prev_article_page" => __("Open previous article (scroll up page)"), "prev_article_page" => __("Scroll article by one page up"),
"next_article_noscroll" => __("Open next article"), "next_article_noscroll" => __("Open next article"),
"prev_article_noscroll" => __("Open previous article"), "prev_article_noscroll" => __("Open previous article"),
"next_article_noexpand" => __("Move to next article (don't expand or mark read)"), "next_article_noexpand" => __("Move to next article (don't expand or mark read)"),
@ -1116,14 +1116,14 @@
$hotkeys = array( $hotkeys = array(
"k" => "next_feed", "k" => "next_feed",
"j" => "prev_feed", "j" => "prev_feed",
"n" => "next_article", "n" => "next_article_noscroll",
"p" => "prev_article", "p" => "prev_article_noscroll",
//"(33)|PageUp" => "prev_article_page", //"(33)|PageUp" => "prev_article_page",
//"(34)|PageDown" => "next_article_page", //"(34)|PageDown" => "next_article_page",
"*(33)|Shift+PageUp" => "article_page_up", "*(33)|Shift+PgUp" => "article_page_up",
"*(34)|Shift+PageDown" => "article_page_down", "*(34)|Shift+PgDn" => "article_page_down",
"(38)|Up" => "prev_article", "(38)|Up" => "prev_article_or_scroll",
"(40)|Down" => "next_article", "(40)|Down" => "next_article_or_scroll",
"*(38)|Shift+Up" => "article_scroll_up", "*(38)|Shift+Up" => "article_scroll_up",
"*(40)|Shift+Down" => "article_scroll_down", "*(40)|Shift+Down" => "article_scroll_down",
"^(38)|Ctrl+Up" => "prev_article_noscroll", "^(38)|Ctrl+Up" => "prev_article_noscroll",

@ -329,13 +329,7 @@ define(["dojo/_base/declare"], function (declare) {
return 0; return 0;
}, },
scrollByPages: function (page_offset, event) { scrollByPages: function (page_offset, event) {
let elem; const elem = App.isCombinedMode() ? $("headlines-frame") : $("content-insert");
if (!App.isCombinedMode()) {
elem = $("content-insert");
} else {
elem = $("headlines-frame");
}
const offset = elem.offsetHeight * page_offset * 0.99; const offset = elem.offsetHeight * page_offset * 0.99;
@ -343,13 +337,7 @@ define(["dojo/_base/declare"], function (declare) {
}, },
scroll: function (offset, event) { scroll: function (offset, event) {
let elem; const elem = App.isCombinedMode() ? $("headlines-frame") : $("content-insert");
if (!App.isCombinedMode()) {
elem = $("content-insert");
} else {
elem = $("headlines-frame");
}
if (event && event.repeat) { if (event && event.repeat) {
elem.addClassName("forbid-smooth-scroll"); elem.addClassName("forbid-smooth-scroll");

@ -277,10 +277,10 @@ require(["dojo/_base/kernel",
if (rv) Feeds.open({feed: rv[0], is_cat: rv[1], delayed: true}) if (rv) Feeds.open({feed: rv[0], is_cat: rv[1], delayed: true})
}; };
this.hotkey_actions["next_article"] = function (event) { this.hotkey_actions["next_article_or_scroll"] = function (event) {
Headlines.move('next', {event: event}); Headlines.move('next', {event: event});
}; };
this.hotkey_actions["prev_article"] = function (event) { this.hotkey_actions["prev_article_or_scroll"] = function (event) {
Headlines.move('prev', {event: event}); Headlines.move('prev', {event: event});
}; };
this.hotkey_actions["next_article_noscroll"] = function (event) { this.hotkey_actions["next_article_noscroll"] = function (event) {
@ -325,10 +325,16 @@ require(["dojo/_base/kernel",
Headlines.catchupRelativeTo(0); Headlines.catchupRelativeTo(0);
}; };
this.hotkey_actions["article_scroll_down"] = function (event) { this.hotkey_actions["article_scroll_down"] = function (event) {
Article.scroll(80, event); const ctr = App.isCombinedMode() ? $("headlines-frame") : $("content-insert");
if (ctr)
Article.scroll(ctr.offsetHeight / 2, event);
}; };
this.hotkey_actions["article_scroll_up"] = function (event) { this.hotkey_actions["article_scroll_up"] = function (event) {
Article.scroll(-80, event); const ctr = App.isCombinedMode() ? $("headlines-frame") : $("content-insert");
if (ctr)
Article.scroll(-ctr.offsetHeight / 2, event);
}; };
this.hotkey_actions["next_article_page"] = function (event) { this.hotkey_actions["next_article_page"] = function (event) {
Headlines.scrollByPages(1, event); Headlines.scrollByPages(1, event);
@ -375,7 +381,7 @@ require(["dojo/_base/kernel",
Headlines.select('none'); Headlines.select('none');
}; };
this.hotkey_actions["feed_refresh"] = function () { this.hotkey_actions["feed_refresh"] = function () {
if (Feeds.getActive() != undefined) { if (typeof Feeds.getActive() != "undefined") {
Feeds.open({feed: Feeds.getActive(), is_cat: Feeds.activeIsCat()}); Feeds.open({feed: Feeds.getActive(), is_cat: Feeds.activeIsCat()});
} }
}; };
@ -405,7 +411,7 @@ require(["dojo/_base/kernel",
CommonDialogs.editFeed(Feeds.getActive()); CommonDialogs.editFeed(Feeds.getActive());
}; };
this.hotkey_actions["feed_catchup"] = function () { this.hotkey_actions["feed_catchup"] = function () {
if (Feeds.getActive() != undefined) { if (typeof Feeds.getActive() != "undefined") {
Feeds.catchupCurrent(); Feeds.catchupCurrent();
} }
}; };

Loading…
Cancel
Save