diff options
author | Andrew Dolgov <[email protected]> | 2020-05-17 08:25:51 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2020-05-17 08:25:51 +0300 |
commit | 9ae9302b6b3526b15652715f9741dad8c51f9fee (patch) | |
tree | 9b3efedd928a5b074e4b60c6f4184c804877111e /js/tt-rss.js | |
parent | 3dc506a19ac483c60cf2800066e4403df4db0ef1 (diff) |
implement keyboard-related changes discussed in https://community.tt-rss.org/t/changing-the-amount-of-scroll-by-arrow-key/3452/7
Diffstat (limited to 'js/tt-rss.js')
-rw-r--r-- | js/tt-rss.js | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/js/tt-rss.js b/js/tt-rss.js index 0e970205c..595766f4e 100644 --- a/js/tt-rss.js +++ b/js/tt-rss.js @@ -285,10 +285,16 @@ require(["dojo/_base/kernel", if (rv) Feeds.open({feed: rv[0], is_cat: rv[1], delayed: true}) }; this.hotkey_actions["next_article_or_scroll"] = function (event) { - Headlines.move('next', {event: event}); + if (App.isCombinedMode()) + Headlines.scroll(Headlines.line_scroll_offset, event); + else + Headlines.move('next', {event: event}); }; this.hotkey_actions["prev_article_or_scroll"] = function (event) { - Headlines.move('prev', {event: event}); + if (App.isCombinedMode()) + Headlines.scroll(-Headlines.line_scroll_offset, event); + else + Headlines.move('prev', {event: event}); }; this.hotkey_actions["next_article_noscroll"] = function (event) { Headlines.move('next', {noscroll: true, event: event}); @@ -335,28 +341,34 @@ require(["dojo/_base/kernel", Headlines.catchupRelativeTo(0); }; this.hotkey_actions["article_scroll_down"] = function (event) { - const ctr = App.isCombinedMode() ? $("headlines-frame") : $("content-insert"); - - if (ctr) - Article.scroll(ctr.offsetHeight / 2, event); + if (App.isCombinedMode()) + Headlines.scroll(Headlines.line_scroll_offset, event); + else + Article.scroll(Headlines.line_scroll_offset, event); }; this.hotkey_actions["article_scroll_up"] = function (event) { - const ctr = App.isCombinedMode() ? $("headlines-frame") : $("content-insert"); - - if (ctr) - Article.scroll(-ctr.offsetHeight / 2, event); + if (App.isCombinedMode()) + Headlines.scroll(-Headlines.line_scroll_offset, event); + else + Article.scroll(-Headlines.line_scroll_offset, event); }; - this.hotkey_actions["next_article_page"] = function (event) { + this.hotkey_actions["next_headlines_page"] = function (event) { Headlines.scrollByPages(1, event); }; - this.hotkey_actions["prev_article_page"] = function (event) { + this.hotkey_actions["prev_headlines_page"] = function (event) { Headlines.scrollByPages(-1, event); }; this.hotkey_actions["article_page_down"] = function (event) { - Article.scrollByPages(1, event); + if (App.isCombinedMode()) + Headlines.scrollByPages(1, event); + else + Article.scrollByPages(1, event); }; this.hotkey_actions["article_page_up"] = function (event) { - Article.scrollByPages(-1, event); + if (App.isCombinedMode()) + Headlines.scrollByPages(-1, event); + else + Article.scrollByPages(-1, event); }; this.hotkey_actions["close_article"] = function () { if (App.isCombinedMode()) { |