aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/search-frontend.js
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2020-04-10 02:15:24 +0300
committersiikamiika <siikamiika@users.noreply.github.com>2020-04-11 21:01:27 +0300
commit61a96e327a815bda7fea4c5d2096dead901fdf33 (patch)
tree0fb76f6b407ab5d4668b674a9e164243a2995042 /ext/bg/js/search-frontend.js
parent9adbc80a70ea263ae97a853c3d9bb0b6109503bd (diff)
prevent injecting frontend multiple times
Diffstat (limited to 'ext/bg/js/search-frontend.js')
-rw-r--r--ext/bg/js/search-frontend.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/bg/js/search-frontend.js b/ext/bg/js/search-frontend.js
index 48326caf..18cb6060 100644
--- a/ext/bg/js/search-frontend.js
+++ b/ext/bg/js/search-frontend.js
@@ -54,13 +54,16 @@ function injectSearchFrontend() {
async function main() {
await yomichan.prepare();
+ let optionsApplied = false;
+
const applyOptions = async () => {
const optionsContext = {
depth: 0,
url: window.location.href
};
const options = await apiOptionsGet(optionsContext);
- if (!options.scanning.enableOnSearchPage) { return; }
+ if (!options.scanning.enableOnSearchPage || optionsApplied) { return; }
+ optionsApplied = true;
window.frontendInitializationData = {depth: 1, proxy: false};
injectSearchFrontend();