From bd12096e741bdfdbc8eaa91446c583f88636c9e9 Mon Sep 17 00:00:00 2001 From: Duarte Dias Date: Tue, 9 Feb 2021 18:58:35 +0000 Subject: [PATCH] implement 'read all' and 'show' shortcuts (A) -> show All (U) -> show Unread (S) -> show Starred (R) -> mark all read --- src/assets/javascripts/keybindings.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/assets/javascripts/keybindings.js b/src/assets/javascripts/keybindings.js index ddc31bd..2640711 100644 --- a/src/assets/javascripts/keybindings.js +++ b/src/assets/javascripts/keybindings.js @@ -49,6 +49,12 @@ const shortcutFunctions = { vm.toggleItemRead(vm.itemSelectedDetails) } }, + markAllRead: function() { + // same condition as 'Mark all read button' + if(vm.filterSelected == 'unread'){ + vm.markItemsRead() + } + }, toggleItemStarred: function() { if(vm.itemSelected != null) { vm.toggleItemStarred(vm.itemSelectedDetails) @@ -69,16 +75,29 @@ const shortcutFunctions = { previousFeed() { helperFunctions.navigateToFeed(-1) }, + showAll() { + vm.filterSelected = '' + }, + showUnread() { + vm.filterSelected = 'unread' + }, + showStarred() { + vm.filterSelected = 'starred' + }, } const keybindings = { "r": shortcutFunctions.toggleItemRead, + "R": shortcutFunctions.markAllRead, "s": shortcutFunctions.toggleItemStarred, "?": shortcutFunctions.focusSearch, "j": shortcutFunctions.nextItem, "k": shortcutFunctions.previousItem, "l": shortcutFunctions.nextFeed, "h": shortcutFunctions.previousFeed, + "A": shortcutFunctions.showAll, + "U": shortcutFunctions.showUnread, + "S": shortcutFunctions.showStarred, } function isTextBox(element) {