summaryrefslogtreecommitdiffstats
path: root/js/gui
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2015-04-30 18:25:49 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2015-04-30 18:25:49 +0200
commit2e54780c1496bfa39cd035b9ac40ed851d2198f1 (patch)
treeb9991f6306bbf266942d56525175868448a35402 /js/gui
parent5515371a8017b6df6b7824da7fa7b97c57344c32 (diff)
fix #635
Diffstat (limited to 'js/gui')
-rw-r--r--js/gui/KeyboardShortcuts.js36
1 files changed, 28 insertions, 8 deletions
diff --git a/js/gui/KeyboardShortcuts.js b/js/gui/KeyboardShortcuts.js
index 7a15d7a3a..1b3b05976 100644
--- a/js/gui/KeyboardShortcuts.js
+++ b/js/gui/KeyboardShortcuts.js
@@ -34,6 +34,14 @@
);
};
+ var markAllRead = function (navigationArea) {
+ var selector = '.active > .app-navigation-entry-menu .mark-read button';
+ var button = navigationArea.find(selector);
+ if (button.length > 0) {
+ button.trigger('click');
+ }
+ };
+
var isInScrollView = function (elem, scrollArea) {
// offset().top adds the navigation bar too so we have to subract it
var elemTop = elem.offset().top - scrollArea.offset().top;
@@ -339,15 +347,15 @@
$(document).keyup(function (event) {
- if (noInputFocused($(':focus')) && noModifierKey(event)) {
- var keyCode = event.keyCode;
- var scrollArea = $('#app-content');
- var navigationArea = $('#app-navigation');
- var isCompactView = $('#articles.compact').length > 0;
- var isExpandItem = $('#articles')
- .attr('news-compact-expand') === 'true';
- var expandItemInCompact = isCompactView && isExpandItem;
+ var keyCode = event.keyCode;
+ var scrollArea = $('#app-content');
+ var navigationArea = $('#app-navigation');
+ var isCompactView = $('#articles.compact').length > 0;
+ var isExpandItem = $('#articles')
+ .attr('news-compact-expand') === 'true';
+ var expandItemInCompact = isCompactView && isExpandItem;
+ if (noInputFocused($(':focus')) && noModifierKey(event)) {
// j, n, right arrow
if ([74, 78, 39].indexOf(keyCode) >= 0) {
@@ -436,9 +444,21 @@
// page up
} else if ([33].indexOf(keyCode) >= 0) {
+
tryReload(navigationArea, scrollArea);
+
}
+ // everything with shift
+ } else if (noInputFocused($(':focus')) && event.shiftKey) {
+
+ // shift + a
+ if ([65].indexOf(keyCode) >= 0) {
+
+ event.preventDefault();
+ markAllRead(navigationArea);
+
+ }
}
});