aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-10-24 20:07:17 -0400
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-10-28 17:03:42 -0400
commitf927f806ba602867948654947dce4d27dfc07ebf (patch)
tree79fcd76ab00410c94d4c5ab14e791063b7f0d025
parent1f0a434e965aabad6b10bff4970a8c44a61961be (diff)
Move check
-rw-r--r--ext/bg/js/settings-popup-preview.js1
-rw-r--r--ext/fg/js/frontend.js13
2 files changed, 7 insertions, 7 deletions
diff --git a/ext/bg/js/settings-popup-preview.js b/ext/bg/js/settings-popup-preview.js
index ce6da4c0..b7b3acc5 100644
--- a/ext/bg/js/settings-popup-preview.js
+++ b/ext/bg/js/settings-popup-preview.js
@@ -160,7 +160,6 @@ class SettingsPopupPreview {
const source = new TextSourceRange(range, range.toString(), null);
if (source === null) { return; }
- this.frontend.textSourceLast = null;
try {
await this.frontend.searchSource(source, 'script');
} finally {
diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js
index 957f57c9..1ab3c1a1 100644
--- a/ext/fg/js/frontend.js
+++ b/ext/fg/js/frontend.js
@@ -319,7 +319,10 @@ class Frontend {
}
const textSource = docRangeFromPoint(x, y, this.options);
- if (textSource === null) {
+ if (
+ textSource === null ||
+ (this.textSourceLast !== null && this.textSourceLast.equals(textSource))
+ ) {
return;
}
@@ -337,11 +340,9 @@ class Frontend {
let hideResults = false;
try {
- if (!this.textSourceLast || !this.textSourceLast.equals(textSource)) {
- this.pendingLookup = true;
- const focus = (cause === 'mouse');
- hideResults = !await this.searchTerms(textSource, focus) && !await this.searchKanji(textSource, focus);
- }
+ this.pendingLookup = true;
+ const focus = (cause === 'mouse');
+ hideResults = !await this.searchTerms(textSource, focus) && !await this.searchKanji(textSource, focus);
} catch (e) {
if (window.yomichan_orphaned) {
if (textSource && this.options.scanning.modifier !== 'none') {