aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/options.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-09-09 16:59:03 -0400
committerGitHub <noreply@github.com>2020-09-09 16:59:03 -0400
commit0d00f7e1cf8a0fa1e2b1aa2732bceaae39f4e23c (patch)
tree92b0a2e72ef2cecb31e8cc70da354ee43b87e2b4 /ext/bg/js/options.js
parentacb7ad32f39c40b879400c9daa4bc8cd25585ba7 (diff)
Scanning input generalization (#789)
* Add inputs to options.scanning * Update CSS for mouse buttons * Update list counters * Set up HTML/CSS * Add input controller * Use new inputs * Include mouse buttons * Update how button inputs are detected * Add index/empty fields to the input details object * Update none check for scanning modifier * Remove old settings * Remove unused global
Diffstat (limited to 'ext/bg/js/options.js')
-rw-r--r--ext/bg/js/options.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/ext/bg/js/options.js b/ext/bg/js/options.js
index 398fb95c..ab32bb11 100644
--- a/ext/bg/js/options.js
+++ b/ext/bg/js/options.js
@@ -474,6 +474,7 @@ class OptionsUtil {
// Added usePopupWindow.
// Updated handlebars templates to include "clipboard-image" definition.
// Added hideDelay.
+ // Added inputs to profileOptions.scanning.
for (const {conditionGroups} of options.profiles) {
for (const {conditions} of conditionGroups) {
for (const condition of conditions) {
@@ -489,6 +490,24 @@ class OptionsUtil {
for (const {options: profileOptions} of options.profiles) {
profileOptions.general.usePopupWindow = false;
profileOptions.scanning.hideDelay = 0;
+
+ const {modifier, middleMouse} = profileOptions.scanning;
+ const scanningInputs = [];
+ switch (modifier) {
+ case 'alt':
+ case 'ctrl':
+ case 'shift':
+ case 'meta':
+ scanningInputs.push(modifier);
+ break;
+ case 'none':
+ scanningInputs.push('');
+ break;
+ }
+ if (middleMouse) {
+ scanningInputs.push('mouse2');
+ }
+ profileOptions.scanning.inputs = scanningInputs;
}
await this._addFieldTemplatesToOptions(options, '/bg/data/anki-field-templates-upgrade-v4.handlebars');
return options;