diff options
author | lonkaars <loek@pipeframe.xyz> | 2023-02-01 18:21:13 +0100 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2023-02-01 18:21:13 +0100 |
commit | e0653d60ca122df3c301ec0cfab91df15c8d224e (patch) | |
tree | bf0b599ca34cc6a63d9428f01b3940c919bb4b3a | |
parent | 454ed4b182c54e368f852b63e4d61e0340eeb2e1 (diff) |
only run userscript on search page3.4.0
-rw-r--r-- | yomichan/userscript-loader.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/yomichan/userscript-loader.js b/yomichan/userscript-loader.js index b9d9120..729b760 100644 --- a/yomichan/userscript-loader.js +++ b/yomichan/userscript-loader.js @@ -1,6 +1,10 @@ -(async () => eval((await yomichan.api.getSettings([{ - scope: "profile", - optionsContext: { current: true }, - path: 'general.userScript' -}]))[0].result))(); +(async () => { + if (window.location.protocol != "chrome-extension:") return; // only run on yomichan pages + if (window.location.pathname != "/search.html") return; // only run on search page + eval((await yomichan.api.getSettings([{ + scope: "profile", + optionsContext: { current: true }, + path: 'general.userScript' + }]))[0].result); +})(); |