From 165fad86232bdd3a12c10707ba9d5bf13d1b1cbc Mon Sep 17 00:00:00 2001 From: ahodesuka Date: Wed, 12 Feb 2014 00:11:29 -0600 Subject: [PATCH 1/4] Add hotkeys for index modes. --- src/General/Config.coffee | 3 +++ src/General/Index.coffee | 4 ++++ src/Miscellaneous/Keybinds.coffee | 9 +++++++++ 3 files changed, 16 insertions(+) diff --git a/src/General/Config.coffee b/src/General/Config.coffee index d04114ec1..217bab12b 100644 --- a/src/General/Config.coffee +++ b/src/General/Config.coffee @@ -188,6 +188,9 @@ 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.'] + 'Paged mode': ['Ctrl+p', 'Sets the index mode to paged.'] + 'Catalog mode': ['Ctrl+c', 'Sets the index mode to catalog.'] + 'All pages mode': ['Ctrl+a', 'Sets the index mode to all threads.'] 'Cycle sort type': ['Ctrl+x', 'Cycle through index sort types.'] # Thread Navigation 'Next thread': ['Down', 'See next thread.'] diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 2e9150881..a1b101f02 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -186,6 +186,10 @@ Index = val: isPinned: thread.isPinned Index.sort() Index.buildIndex() + setIndexMode: (mode) -> + [opt] = [Index.selectMode.options...].filter (option) -> option.value is mode + opt.selected = true + $.event 'change', null, Index.selectMode cycleSortType: -> types = [Index.selectSort.options...].filter (option) -> !option.disabled for type, i in types diff --git a/src/Miscellaneous/Keybinds.coffee b/src/Miscellaneous/Keybinds.coffee index 433ca353d..74d112efa 100644 --- a/src/Miscellaneous/Keybinds.coffee +++ b/src/Miscellaneous/Keybinds.coffee @@ -88,6 +88,15 @@ Keybinds = $('.prev button', Index.pagelist).click() when Conf['Search form'] Index.searchInput.focus() + when Conf['Paged mode'] + return unless g.VIEW is 'index' and Conf['Index Mode'] isnt 'paged' + Index.setIndexMode('paged') + when Conf['Catalog mode'] + return unless g.VIEW is 'index' and Conf['Index Mode'] isnt 'catalog' + Index.setIndexMode('catalog') + when Conf['All pages mode'] + return unless g.VIEW is 'index' and Conf['Index Mode'] isnt 'all pages' + Index.setIndexMode('all pages') when Conf['Cycle sort type'] Index.cycleSortType() # Thread Navigation From 1c47e1c197a1723e74531d92009290fa5bd265c8 Mon Sep 17 00:00:00 2001 From: ahodesuka Date: Wed, 12 Feb 2014 02:09:02 -0600 Subject: [PATCH 2/4] Remove unneeded parentheses, change default keybindings, remove unneeded slice and filter. --- src/General/Config.coffee | 6 +++--- src/General/Index.coffee | 3 +-- src/Miscellaneous/Keybinds.coffee | 6 +++--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/General/Config.coffee b/src/General/Config.coffee index 217bab12b..a31444595 100644 --- a/src/General/Config.coffee +++ b/src/General/Config.coffee @@ -188,9 +188,9 @@ 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.'] - 'Paged mode': ['Ctrl+p', 'Sets the index mode to paged.'] - 'Catalog mode': ['Ctrl+c', 'Sets the index mode to catalog.'] - 'All pages mode': ['Ctrl+a', 'Sets the index mode to all threads.'] + 'Paged mode': ['Ctrl+1', 'Sets the index mode to paged.'] + 'Catalog mode': ['Ctrl+2', 'Sets the index mode to catalog.'] + 'All pages mode': ['Ctrl+3', 'Sets the index mode to all threads.'] 'Cycle sort type': ['Ctrl+x', 'Cycle through index sort types.'] # Thread Navigation 'Next thread': ['Down', 'See next thread.'] diff --git a/src/General/Index.coffee b/src/General/Index.coffee index a1b101f02..7faf94004 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -187,8 +187,7 @@ Index = Index.sort() Index.buildIndex() setIndexMode: (mode) -> - [opt] = [Index.selectMode.options...].filter (option) -> option.value is mode - opt.selected = true + Index.selectMode.value = mode $.event 'change', null, Index.selectMode cycleSortType: -> types = [Index.selectSort.options...].filter (option) -> !option.disabled diff --git a/src/Miscellaneous/Keybinds.coffee b/src/Miscellaneous/Keybinds.coffee index 74d112efa..c5b0347eb 100644 --- a/src/Miscellaneous/Keybinds.coffee +++ b/src/Miscellaneous/Keybinds.coffee @@ -90,13 +90,13 @@ Keybinds = Index.searchInput.focus() when Conf['Paged mode'] return unless g.VIEW is 'index' and Conf['Index Mode'] isnt 'paged' - Index.setIndexMode('paged') + Index.setIndexMode 'paged' when Conf['Catalog mode'] return unless g.VIEW is 'index' and Conf['Index Mode'] isnt 'catalog' - Index.setIndexMode('catalog') + Index.setIndexMode 'catalog' when Conf['All pages mode'] return unless g.VIEW is 'index' and Conf['Index Mode'] isnt 'all pages' - Index.setIndexMode('all pages') + Index.setIndexMode 'all pages' when Conf['Cycle sort type'] Index.cycleSortType() # Thread Navigation From c97112d0ee72123cb6a5d8a8317278da4da8c77d Mon Sep 17 00:00:00 2001 From: ahodesuka Date: Wed, 12 Feb 2014 02:21:08 -0600 Subject: [PATCH 3/4] Change ordering to be the same as the dropdown. --- src/General/Config.coffee | 4 ++-- src/Miscellaneous/Keybinds.coffee | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/General/Config.coffee b/src/General/Config.coffee index a31444595..5345dd84f 100644 --- a/src/General/Config.coffee +++ b/src/General/Config.coffee @@ -189,8 +189,8 @@ Config = 'Previous page': ['Left', 'Jump to the previous page.'] 'Search form': ['Ctrl+Alt+s', 'Focus the search field on the board index.'] 'Paged mode': ['Ctrl+1', 'Sets the index mode to paged.'] - 'Catalog mode': ['Ctrl+2', 'Sets the index mode to catalog.'] - 'All pages mode': ['Ctrl+3', 'Sets the index mode to all threads.'] + 'All pages mode': ['Ctrl+2', 'Sets the index mode to all threads.'] + 'Catalog mode': ['Ctrl+3', 'Sets the index mode to catalog.'] 'Cycle sort type': ['Ctrl+x', 'Cycle through index sort types.'] # Thread Navigation 'Next thread': ['Down', 'See next thread.'] diff --git a/src/Miscellaneous/Keybinds.coffee b/src/Miscellaneous/Keybinds.coffee index c5b0347eb..8bb3e466b 100644 --- a/src/Miscellaneous/Keybinds.coffee +++ b/src/Miscellaneous/Keybinds.coffee @@ -91,12 +91,12 @@ Keybinds = when Conf['Paged mode'] return unless g.VIEW is 'index' and Conf['Index Mode'] isnt 'paged' Index.setIndexMode 'paged' - when Conf['Catalog mode'] - return unless g.VIEW is 'index' and Conf['Index Mode'] isnt 'catalog' - Index.setIndexMode 'catalog' when Conf['All pages mode'] return unless g.VIEW is 'index' and Conf['Index Mode'] isnt 'all pages' Index.setIndexMode 'all pages' + when Conf['Catalog mode'] + return unless g.VIEW is 'index' and Conf['Index Mode'] isnt 'catalog' + Index.setIndexMode 'catalog' when Conf['Cycle sort type'] Index.cycleSortType() # Thread Navigation From e19be9de03e2e60c30f757f5d433633680b76669 Mon Sep 17 00:00:00 2001 From: ahodesuka Date: Wed, 12 Feb 2014 02:46:57 -0600 Subject: [PATCH 4/4] Added line in the changelog. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c27f2b2d..2144cd125 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ - Added `Image Size` setting for the catalog. - Added a keybind to cycle through index sort types, `Ctrl+x` by default. +- Added keybindings for index modes, `Ctrl+{1,2,3}` by default. ### 3.17.1 - *2014-02-10*