From 1902a7dcb0d4b0fc00a1c2ed86f4b8ab757f4508 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 5 Dec 2019 17:00:02 +0300 Subject: [PATCH] pgup/pgdown hotkey normalization: - pgup/pgdown without modifier scroll headline buffer - shift+pgup/pgdown work similarly to shift+up/down but operating on pages --- include/functions.php | 6 ++++-- js/Article.js | 2 +- js/Headlines.js | 6 ++++++ js/tt-rss.js | 10 ++++++++-- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/include/functions.php b/include/functions.php index 18885b1ea..b4e91fe9c 100644 --- a/include/functions.php +++ b/include/functions.php @@ -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", diff --git a/js/Article.js b/js/Article.js index e40e1fca0..1135fde02 100644 --- a/js/Article.js +++ b/js/Article.js @@ -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) { diff --git a/js/Headlines.js b/js/Headlines.js index 3c98bef6c..4382e04f7 100755 --- a/js/Headlines.js +++ b/js/Headlines.js @@ -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")) { diff --git a/js/tt-rss.js b/js/tt-rss.js index 43d057199..f5444207d 100644 --- a/js/tt-rss.js +++ b/js/tt-rss.js @@ -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()) {