diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-09-08 19:40:15 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-08 19:40:15 -0400 |
commit | b687870a55eae43a71ea3adc41be0ab341a8721f (patch) | |
tree | 55b5046b6c2f9513edf09307c05cc50d3468ae67 /ext/bg | |
parent | ab4dbacc4c36d6373e22f758eefdb7514dc7cdb9 (diff) |
Delay hide option (#774)
* Add hideDelay option
* Add _clearSelection
* Use hideDelay
* Prevent repeated delayed selection clears
* Fix popup hide timer being cleared when the cursor is moved into the frame
Diffstat (limited to 'ext/bg')
-rw-r--r-- | ext/bg/data/options-schema.json | 6 | ||||
-rw-r--r-- | ext/bg/js/options.js | 2 | ||||
-rw-r--r-- | ext/bg/settings.html | 12 |
3 files changed, 18 insertions, 2 deletions
diff --git a/ext/bg/data/options-schema.json b/ext/bg/data/options-schema.json index e2dd0573..52d96db9 100644 --- a/ext/bg/data/options-schema.json +++ b/ext/bg/data/options-schema.json @@ -324,6 +324,7 @@ "alphanumeric", "autoHideResults", "delay", + "hideDelay", "length", "modifier", "deepDomScan", @@ -360,6 +361,11 @@ "minimum": 0, "default": 20 }, + "hideDelay": { + "type": "number", + "minimum": 0, + "default": 0 + }, "length": { "type": "integer", "minimum": 1, diff --git a/ext/bg/js/options.js b/ext/bg/js/options.js index 9dc0c166..398fb95c 100644 --- a/ext/bg/js/options.js +++ b/ext/bg/js/options.js @@ -473,6 +473,7 @@ class OptionsUtil { // Options conditions converted to string representations. // Added usePopupWindow. // Updated handlebars templates to include "clipboard-image" definition. + // Added hideDelay. for (const {conditionGroups} of options.profiles) { for (const {conditions} of conditionGroups) { for (const condition of conditions) { @@ -487,6 +488,7 @@ class OptionsUtil { } for (const {options: profileOptions} of options.profiles) { profileOptions.general.usePopupWindow = false; + profileOptions.scanning.hideDelay = 0; } await this._addFieldTemplatesToOptions(options, '/bg/data/anki-field-templates-upgrade-v4.handlebars'); return options; diff --git a/ext/bg/settings.html b/ext/bg/settings.html index 0ad5b79b..3fa14f49 100644 --- a/ext/bg/settings.html +++ b/ext/bg/settings.html @@ -415,8 +415,16 @@ </div> <div class="form-group options-advanced"> - <label for="scan-delay">Scan delay <span class="label-light">(in milliseconds)</span></label> - <input type="number" min="0" id="scan-delay" class="form-control" data-setting="scanning.delay"> + <div class="row"> + <div class="col-xs-6"> + <label for="scan-delay">Scan delay <span class="label-light">(in milliseconds)</span></label> + <input type="number" min="0" id="scan-delay" class="form-control" data-setting="scanning.delay"> + </div> + <div class="col-xs-6"> + <label for="scan-close-delay">Auto-hide delay <span class="label-light">(in milliseconds)</span></label> + <input type="number" min="0" id="scan-close-delay" class="form-control" data-setting="scanning.hideDelay"> + </div> + </div> </div> <div class="form-group options-advanced"> |