aboutsummaryrefslogtreecommitdiff
path: root/ext/mixed/js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mixed/js')
-rw-r--r--ext/mixed/js/display.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js
index 2396805a..27100fd2 100644
--- a/ext/mixed/js/display.js
+++ b/ext/mixed/js/display.js
@@ -61,7 +61,6 @@ class Display {
if (!this.context) { return; }
const link = e.target;
- this.windowScroll.toY(0);
const context = {
source: {
type: 'terms',
@@ -77,6 +76,8 @@ class Display {
url: this.context.url
};
+ this.windowScroll.toY(0);
+
const definitions = await apiKanjiFind(link.textContent, this.getOptionsContext());
this.setContentKanji(definitions, context);
} catch (error) {
@@ -110,10 +111,6 @@ class Display {
const scannedElement = e.target;
const sentence = docSentenceExtract(textSource, this.options.anki.sentenceExt);
- if (!disableScroll) {
- this.windowScroll.toY(0);
- }
-
const context = {
source: disableHistory ? this.context.source : {
type: 'terms',
@@ -132,6 +129,10 @@ class Display {
this.setContentTerms(definitions, context);
+ if (!disableScroll) {
+ this.windowScroll.toY(0);
+ }
+
if (selectText) {
textSource.select();
}
@@ -481,7 +482,7 @@ class Display {
this.windowScroll.stop();
let target;
- if (scroll) {
+ if (scroll !== null) {
target = scroll;
} else {
target = index === 0 || entry === null ? 0 : Display.getElementTop(entry);