From ab739fd4464db32d44150c9aff1873a61a2dd509 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. --- CHANGELOG.md | 1 + src/General/Config.coffee | 1 + src/General/Index.coffee | 6 ++++++ src/Miscellaneous/Keybinds.coffee | 2 ++ 4 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b1e4141ed..6c27f2b2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ - Added `Image Size` setting for the catalog. +- Added a keybind to cycle through index sort types, `Ctrl+x` by default. ### 3.17.1 - *2014-02-10* diff --git a/src/General/Config.coffee b/src/General/Config.coffee index 3e127e782..d04114ec1 100644 --- a/src/General/Config.coffee +++ b/src/General/Config.coffee @@ -188,6 +188,7 @@ Config = 'Next page': ['Right', 'Jump to the next page.'] 'Previous page': ['Left', 'Jump to the previous page.'] 'Search form': ['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': ['Down', 'See next thread.'] 'Previous thread': ['Up', 'See previous thread.'] diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 41c454ba6..44960b110 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -186,6 +186,12 @@ Index = val: isPinned: thread.isPinned Index.sort() Index.buildIndex() + 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 addCatalogSwitch: -> a = $.el 'a', href: 'javascript:;' diff --git a/src/Miscellaneous/Keybinds.coffee b/src/Miscellaneous/Keybinds.coffee index 6fd4de92c..433ca353d 100644 --- a/src/Miscellaneous/Keybinds.coffee +++ b/src/Miscellaneous/Keybinds.coffee @@ -88,6 +88,8 @@ Keybinds = $('.prev button', Index.pagelist).click() when Conf['Search form'] Index.searchInput.focus() + when Conf['Cycle sort type'] + Index.cycleSortType() # Thread Navigation when Conf['Next thread'] return if g.VIEW isnt 'index'