summaryrefslogtreecommitdiff
path: root/ext/fg/js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-01-17 11:43:05 -0500
committerGitHub <noreply@github.com>2021-01-17 11:43:05 -0500
commitbe590004fee5bbbbaefa8a11ddecdb4fca6f7da7 (patch)
tree40ff739237817035f3836667eba1068233ad0762 /ext/fg/js
parent5d9d96996e1b80ecca94023e20476e5e2f85bbff (diff)
Text scanner improvements (#1261)
* Add support for allowing TextScanner.search to force focus * Simplify query parser searched event forwarding * Defer fallback creation * Simplify event listeners * Change type to pointerType * Change cause to eventType * Change empty to passive; make .search function passive * Remove unused input index
Diffstat (limited to 'ext/fg/js')
-rw-r--r--ext/fg/js/frontend.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js
index 8b2df1b0..d789c4f0 100644
--- a/ext/fg/js/frontend.js
+++ b/ext/fg/js/frontend.js
@@ -251,12 +251,12 @@ class Frontend {
}
}
- _onSearched({type, definitions, sentence, inputInfo: {cause, empty}, textSource, optionsContext, detail: {documentTitle}, error}) {
+ _onSearched({type, definitions, sentence, inputInfo: {eventType, passive, detail}, textSource, optionsContext, detail: {documentTitle}, error}) {
const scanningOptions = this._options.scanning;
if (error !== null) {
if (yomichan.isExtensionUnloaded) {
- if (textSource !== null && !empty) {
+ if (textSource !== null && !passive) {
this._showExtensionUnloaded(textSource);
}
} else {
@@ -264,7 +264,11 @@ class Frontend {
}
} if (type !== null) {
this._stopClearSelectionDelayed();
- const focus = (cause === 'mouseMove');
+ let focus = (eventType === 'mouseMove');
+ if (isObject(detail)) {
+ const focus2 = detail.focus;
+ if (typeof focus2 === 'boolean') { focus = focus2; }
+ }
this._showContent(textSource, focus, definitions, type, sentence, documentTitle, optionsContext);
} else {
if (scanningOptions.autoHideResults) {