pgup/pgdown hotkey normalization:

- pgup/pgdown without modifier scroll headline buffer
- shift+pgup/pgdown work similarly to shift+up/down but operating on pages
This commit is contained in:
Andrew Dolgov 2019-12-05 17:00:02 +03:00
parent f30287be65
commit 1902a7dcb0
4 changed files with 19 additions and 5 deletions

View File

@ -1114,14 +1114,16 @@
"j" => "prev_feed",
"n" => "next_article",
"p" => "prev_article",
"(33)|PageUp" => "prev_article_page",
"(34)|PageDown" => "next_article_page",
"(38)|Up" => "prev_article",
"(40)|Down" => "next_article",
"*(38)|Shift+Up" => "article_scroll_up",
"*(40)|Shift+Down" => "article_scroll_down",
"^(38)|Ctrl+Up" => "prev_article_noscroll",
"^(40)|Ctrl+Down" => "next_article_noscroll",
"(33)|Page Up" => "article_page_up",
"(34)|Page Down" => "article_page_down",
"^(33)|Shift+PageUp" => "article_page_up",
"^(34)|Shift+PageDown" => "article_page_down",
"/" => "search_dialog",
"s" => "toggle_mark",
"S" => "toggle_publ",

View File

@ -314,7 +314,7 @@ define(["dojo/_base/declare"], function (declare) {
else
return 0;
},
scrollPages: function (offset) {
scrollByPages: function (offset) {
if (!App.isCombinedMode()) {
const ci = $("content-insert");
if (ci) {

View File

@ -1381,6 +1381,12 @@ define(["dojo/_base/declare"], function (declare) {
}
},
scrollByPages: function (offset) {
const hi = $("headlines-frame");
if (hi) {
hi.scrollTop += hi.offsetHeight * offset * 0.9;
}
},
initHeadlinesMenu: function () {
if (!dijit.byId("headlinesMenu")) {

View File

@ -330,11 +330,17 @@ require(["dojo/_base/kernel",
this.hotkey_actions["article_scroll_up"] = function () {
Article.scroll(-40);
};
this.hotkey_actions["next_article_page"] = function () {
Headlines.scrollByPages(1);
};
this.hotkey_actions["prev_article_page"] = function () {
Headlines.scrollByPages(-1);
};
this.hotkey_actions["article_page_down"] = function () {
Article.scrollPages(1);
Article.scrollByPages(1);
};
this.hotkey_actions["article_page_up"] = function () {
Article.scrollPages(-1);
Article.scrollByPages(-1);
};
this.hotkey_actions["close_article"] = function () {
if (App.isCombinedMode()) {