Skip to content

Commit

Permalink
make main world script static in manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
marcustyphoon committed Jul 10, 2024
1 parent 0756439 commit dea57b1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
11 changes: 0 additions & 11 deletions src/content_scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,9 @@
return installedScripts;
};

const initMainWorld = () => {
const { nonce } = [...document.scripts].find(script => script.getAttributeNames().includes('nonce'));
const script = document.createElement('script');
script.type = 'module';
script.nonce = nonce;
script.src = browser.runtime.getURL('/main_world/index.js');
document.documentElement.append(script);
};

const init = async function () {
$('style.xkit').remove();

initMainWorld();

browser.storage.onChanged.addListener(onStorageChanged);

const installedScripts = await getInstalledScripts();
Expand Down
20 changes: 18 additions & 2 deletions src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,22 @@
"matches": [ "*://www.tumblr.com/*" ]
}],
"content_scripts": [
{
"matches": [
"*://www.tumblr.com/*"
],
"exclude_matches": [
"*://www.tumblr.com/login",
"*://www.tumblr.com/register",
"*://www.tumblr.com/register?*",
"*://www.tumblr.com/privacy/*"
],
"run_at": "document_end",
"js": [
"main_world/index.js"
],
"world": "MAIN"
},
{
"matches": [
"*://www.tumblr.com/*"
Expand Down Expand Up @@ -71,10 +87,10 @@
"browser_specific_settings": {
"gecko": {
"id": "{6e710c58-36cc-49d6-b772-bfc3030fa56e}",
"strict_min_version": "121.0"
"strict_min_version": "128.0"
},
"gecko_android": {
"strict_min_version": "121.0"
"strict_min_version": "128.0"
}
}
}

0 comments on commit dea57b1

Please sign in to comment.