From afa889d128ae0c73b96e730caef016cc928e8dff Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 11 Feb 2014 10:13:53 +0100 Subject: [PATCH] Add keybind to cycle through index sort types. Conflicts: CHANGELOG.md src/General/Config.coffee src/General/Index.coffee src/Miscellaneous/Keybinds.coffee --- src/General/Config.coffee | 4 ++++ src/General/Index.coffee | 6 ++++++ src/Miscellaneous/Keybinds.coffee | 3 +++ 3 files changed, 13 insertions(+) diff --git a/src/General/Config.coffee b/src/General/Config.coffee index 41e98a402..ac6a741ed 100755 --- a/src/General/Config.coffee +++ b/src/General/Config.coffee @@ -727,6 +727,10 @@ vp-replace 'Ctrl+Alt+s' 'Focus the search field on the board index.' ] + 'Cycle sort type': [ + 'Ctrl+x' + 'Cycle through index sort types.' + ] # Thread Navigation 'Next thread': [ 'Ctrl+Down' diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 1869cc53a..aa8d2a878 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -181,6 +181,12 @@ Index = else ThreadHiding.hide thread ThreadHiding.saveHiddenState thread + cycleSortType: -> + types = [Index.selectSort.options...].filter (option) -> !option.disabled + for type, i in types + break if type.selected + types[(i + 1) % types.length].selected = true + $.event 'change', null, Index.selectSort cb: toggleHiddenThreads: -> diff --git a/src/Miscellaneous/Keybinds.coffee b/src/Miscellaneous/Keybinds.coffee index b83078668..08b4fd8bb 100755 --- a/src/Miscellaneous/Keybinds.coffee +++ b/src/Miscellaneous/Keybinds.coffee @@ -131,6 +131,9 @@ Keybinds = searchInput.focus() when Conf['Open catalog'] window.location = CatalogLinks.catalog() + when Conf['Cycle sort type'] + return unless Conf['JSON Navigation'] + Index.cycleSortType() # Thread Navigation when Conf['Next thread'] return if g.VIEW isnt 'index' or !threadRoot