From a411875be5c37256c27d27adee7588a8acbc7104 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 9 Sep 2008 08:08:47 +0100 Subject: [PATCH] set N/P hotkeys to scroll active article (or headlines pane in CDM) --- help/3.php | 4 +++- tt-rss.js | 26 ++++++++++++++++++++++++-- viewfeed.js | 19 +++++++++++++++++++ 3 files changed, 46 insertions(+), 3 deletions(-) diff --git a/help/3.php b/help/3.php index dadb627da..92c4be2ef 100644 --- a/help/3.php +++ b/help/3.php @@ -18,7 +18,9 @@ u T o - N/P + c n/c p + N/P +

diff --git a/tt-rss.js b/tt-rss.js index 9a5235497..3cb07e124 100644 --- a/tt-rss.js +++ b/tt-rss.js @@ -1134,16 +1134,27 @@ function hotkey_handler(e) { return; } - if (shift_key && (keycode == 78 || keycode == 40)) { // shift - n, down + if (shift_key && keycode == 40) { // shift-down catchupRelativeToArticle(1); return; } - if (shift_key && (keycode == 80 || keycode == 38)) { // shift - p, up + if (shift_key && keycode == 38) { // shift-up catchupRelativeToArticle(0); return; } + if (shift_key && keycode == 78) { // N + scrollArticle(50); + return; + } + + if (shift_key && keycode == 80) { // P + scrollArticle(-50); + return; + } + + if (keycode == 78 || keycode == 40) { // n, down if (typeof moveToPost != 'undefined') { moveToPost('next'); @@ -1332,6 +1343,17 @@ function hotkey_handler(e) { } } + if (keycode == 78) { // n + catchupRelativeToArticle(1); + return; + } + + if (keycode == 80) { // p + catchupRelativeToArticle(0); + return; + } + + } /* Prefix g */ diff --git a/viewfeed.js b/viewfeed.js index 5813f4135..4b90f1d05 100644 --- a/viewfeed.js +++ b/viewfeed.js @@ -1903,3 +1903,22 @@ function zoomToArticle(id) { exception_error("zoomToArticle", e); } } + +function scrollArticle(offset) { + try { + if (!isCdmMode()) { + var ci = document.getElementById("content-insert"); + if (ci) { + ci.scrollTop += offset; + } + } else { + var hi = document.getElementById("headlinesInnerContainer"); + if (hi) { + hi.scrollTop += offset; + } + + } + } catch (e) { + exception_error("scrollArticle", e); + } +}