From 2098d2faaeb1658ef753eb9f4ac123698938480e Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 27 Mar 2021 22:30:45 -0400 Subject: Hotkey arguments (#1565) * Update display * Move scope definitions * Update scopes button after changing action * Don't show menu if empty * Improve scope updating * Update style * Simplify * Add argument to settings * Update convertToNumber implementation * Add support for arguments * Pass argument to action handler * Update hotkey action definitions * Remove x3 options --- ext/js/data/options-util.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'ext/js/data/options-util.js') diff --git a/ext/js/data/options-util.js b/ext/js/data/options-util.js index fd62a558..5b2e2bd3 100644 --- a/ext/js/data/options-util.js +++ b/ext/js/data/options-util.js @@ -754,8 +754,32 @@ class OptionsUtil { // Version 10 changes: // Removed global option useSettingsV2. // Added part-of-speech field template. + // Added an argument to hotkey inputs. await this._applyAnkiFieldTemplatesPatch(options, '/data/templates/anki-field-templates-upgrade-v10.handlebars'); delete options.global.useSettingsV2; + for (const profile of options.profiles) { + for (const hotkey of profile.options.inputs.hotkeys) { + switch (hotkey.action) { + case 'previousEntry': + hotkey.argument = '1'; + break; + case 'previousEntry3': + hotkey.action = 'previousEntry'; + hotkey.argument = '3'; + break; + case 'nextEntry': + hotkey.argument = '1'; + break; + case 'nextEntry3': + hotkey.action = 'nextEntry'; + hotkey.argument = '3'; + break; + default: + hotkey.argument = ''; + break; + } + } + } return options; } } -- cgit v1.2.3