summaryrefslogtreecommitdiffstats
path: root/js/gui
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-09-14 20:02:05 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-09-14 20:02:05 +0200
commitc3a0bf654cf542cf2daefd1e3428c8c648007dd1 (patch)
tree997c1a8d27cb20afa17c5b2c85f8a56698c975b7 /js/gui
parent975f30899c6a1498cbaa0e1b81008b7b3063b5dc (diff)
add keyboard shortcuts for reloading and jumping to the next/previous feed
Diffstat (limited to 'js/gui')
-rw-r--r--js/gui/KeyboardShortcuts.js33
1 files changed, 33 insertions, 0 deletions
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);
+
}
}