summaryrefslogtreecommitdiff
path: root/ext/fg/js/frontend.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-09-07 13:58:19 -0400
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-09-10 20:09:33 -0400
commitbc8793eb56b2ce985f2e5dc0a9fd270f98fbf17a (patch)
treeb390bf63356b1584ea6d9bb5ff98450d96fb0e04 /ext/fg/js/frontend.js
parent99ca60d4c1456f243d8142b4502db441e33340a4 (diff)
Add a context object for all calls to fetch options
Diffstat (limited to 'ext/fg/js/frontend.js')
-rw-r--r--ext/fg/js/frontend.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js
index 5e12d101..0b60aa2b 100644
--- a/ext/fg/js/frontend.js
+++ b/ext/fg/js/frontend.js
@@ -28,6 +28,10 @@ class Frontend {
this.options = null;
this.ignoreNodes = (Array.isArray(ignoreNodes) && ignoreNodes.length > 0 ? ignoreNodes.join(',') : null);
+ this.optionsContext = {
+ depth: popup.depth
+ };
+
this.primaryTouchIdentifier = null;
this.contextMenuChecking = false;
this.contextMenuPrevent = false;
@@ -50,7 +54,7 @@ class Frontend {
async prepare() {
try {
- this.options = await apiOptionsGet();
+ this.options = await apiOptionsGet(this.optionsContext);
window.addEventListener('message', this.onFrameMessage.bind(this));
window.addEventListener('mousedown', this.onMouseDown.bind(this));
@@ -282,7 +286,7 @@ class Frontend {
}
async updateOptions() {
- this.options = await apiOptionsGet();
+ this.options = await apiOptionsGet(this.optionsContext);
if (!this.options.enable) {
this.searchClear();
}
@@ -351,7 +355,7 @@ class Frontend {
return;
}
- const {definitions, length} = await apiTermsFind(searchText);
+ const {definitions, length} = await apiTermsFind(searchText, this.optionsContext);
if (definitions.length === 0) {
return false;
}
@@ -384,7 +388,7 @@ class Frontend {
return;
}
- const definitions = await apiKanjiFind(searchText);
+ const definitions = await apiKanjiFind(searchText, this.optionsContext);
if (definitions.length === 0) {
return false;
}