aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js/frontend.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-11-03 11:06:31 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-11-03 11:06:31 -0500
commit75ff05148d5a07c397d11b8bfbc92833be8726ea (patch)
treee0d4ee4e42f1dab779ce2d183e552483fcec238c /ext/fg/js/frontend.js
parent7de24dd355f0ab27e43509929d66c60e07e7eee4 (diff)
Fix autoHideResults not working
Diffstat (limited to 'ext/fg/js/frontend.js')
-rw-r--r--ext/fg/js/frontend.js31
1 files changed, 16 insertions, 15 deletions
diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js
index 94c318d7..802221be 100644
--- a/ext/fg/js/frontend.js
+++ b/ext/fg/js/frontend.js
@@ -336,17 +336,16 @@ class Frontend {
}
const textSource = docRangeFromPoint(x, y, this.options);
- if (
- textSource === null ||
- (this.textSourceCurrent !== null && this.textSourceCurrent.equals(textSource))
- ) {
+ if (this.textSourceCurrent !== null && this.textSourceCurrent.equals(textSource)) {
return;
}
try {
- return await this.searchSource(textSource, cause);
+ await this.searchSource(textSource, cause);
} finally {
- textSource.cleanup();
+ if (textSource !== null) {
+ textSource.cleanup();
+ }
}
} catch (e) {
this.onError(e);
@@ -358,17 +357,19 @@ class Frontend {
try {
this.pendingLookup = true;
- results = (
- await this.findTerms(textSource) ||
- await this.findKanji(textSource)
- );
- if (results !== null) {
- const focus = (cause === 'mouse');
- this.showContent(textSource, focus, results.definitions, results.type);
+ if (textSource !== null) {
+ results = (
+ await this.findTerms(textSource) ||
+ await this.findKanji(textSource)
+ );
+ if (results !== null) {
+ const focus = (cause === 'mouse');
+ this.showContent(textSource, focus, results.definitions, results.type);
+ }
}
} catch (e) {
if (window.yomichan_orphaned) {
- if (textSource && this.options.scanning.modifier !== 'none') {
+ if (textSource !== null && this.options.scanning.modifier !== 'none') {
this.lastShowPromise = this.popup.showContent(
textSource.getRect(),
textSource.getWritingMode(),
@@ -386,7 +387,7 @@ class Frontend {
this.pendingLookup = false;
}
- return results !== null;
+ return results;
}
showContent(textSource, focus, definitions, type) {