From c3a0bf654cf542cf2daefd1e3428c8c648007dd1 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Sun, 14 Sep 2014 20:02:05 +0200 Subject: add keyboard shortcuts for reloading and jumping to the next/previous feed --- js/gui/KeyboardShortcuts.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'js/gui') diff --git a/js/gui/KeyboardShortcuts.js b/js/gui/KeyboardShortcuts.js index 1ea9d21d8..d818a4ded 100644 --- a/js/gui/KeyboardShortcuts.js +++ b/js/gui/KeyboardShortcuts.js @@ -34,6 +34,20 @@ ); }; + var reloadFeed = function (navigationArea) { + navigationArea.find('.active > a:visible').trigger('click'); + }; + + var nextFeed = function (navigationArea) { + navigationArea.find('.active') + .next('li').children('a:visible').trigger('click'); + }; + + var previousFeed = function (navigationArea) { + navigationArea.find('.active').prev('li') + .children('a:visible').trigger('click'); + }; + var onActiveItem = function (scrollArea, callback) { var items = scrollArea.find('.item'); @@ -147,6 +161,7 @@ if (noInputFocused($(':focus')) && noModifierKey(event)) { var keyCode = event.keyCode; var scrollArea = $('#app-content'); + var navigationArea = $('#app-navigation'); var isCompactMode = $('#app-content-wrapper > .compact').length > 0; // j, n, right arrow @@ -192,6 +207,24 @@ event.preventDefault(); openLink(scrollArea); + // r + } else if ([82].indexOf(keyCode) >= 0) { + + event.preventDefault(); + reloadFeed(navigationArea); + + // f + } else if ([70].indexOf(keyCode) >= 0) { + + event.preventDefault(); + nextFeed(navigationArea); + + // d + } else if ([68].indexOf(keyCode) >= 0) { + + event.preventDefault(); + previousFeed(navigationArea); + } } -- cgit v1.2.3