diff --git a/browser/content.js b/browser/content.js index 4810fe3c..57964af6 100644 --- a/browser/content.js +++ b/browser/content.js @@ -2,23 +2,22 @@ if (typeof browser === "undefined") { var browser = chrome; } -const script = document.createElement("script"); -script.src = browser.runtime.getURL("dist/Vencord.js"); -script.id = "vencord-script"; -Object.assign(script.dataset, { - extensionBaseUrl: browser.runtime.getURL(""), - version: browser.runtime.getManifest().version -}); - const style = document.createElement("link"); style.type = "text/css"; style.rel = "stylesheet"; style.href = browser.runtime.getURL("dist/Vencord.css"); -document.documentElement.append(script); - document.addEventListener( "DOMContentLoaded", - () => document.documentElement.append(style), + () => { + document.documentElement.append(style); + window.postMessage({ + type: "vencord:meta", + meta: { + EXTENSION_VERSION: browser.runtime.getManifest().version, + EXTENSION_BASE_URL: browser.runtime.getURL(""), + } + }); + }, { once: true } ); diff --git a/browser/manifest.json b/browser/manifest.json index 731a7879..6782682a 100644 --- a/browser/manifest.json +++ b/browser/manifest.json @@ -18,13 +18,17 @@ "content_scripts": [ { "run_at": "document_start", - "matches": [ - "*://*.discord.com/*" - ], - "js": [ - "content.js" - ], - "all_frames": true + "matches": ["*://*.discord.com/*"], + "js": ["content.js"], + "all_frames": true, + "world": "ISOLATED" + }, + { + "run_at": "document_start", + "matches": ["*://*.discord.com/*"], + "js": ["dist/Vencord.js"], + "all_frames": true, + "world": "MAIN" } ], "web_accessible_resources": [ @@ -47,4 +51,4 @@ } ] } -} \ No newline at end of file +} diff --git a/browser/manifestv2.json b/browser/manifestv2.json index 8d2d17e7..8ed2bf36 100644 --- a/browser/manifestv2.json +++ b/browser/manifestv2.json @@ -17,13 +17,17 @@ "content_scripts": [ { "run_at": "document_start", - "matches": [ - "*://*.discord.com/*" - ], - "js": [ - "content.js" - ], - "all_frames": true + "matches": ["*://*.discord.com/*"], + "js": ["content.js"], + "all_frames": true, + "world": "ISOLATED" + }, + { + "run_at": "document_start", + "matches": ["*://*.discord.com/*"], + "js": ["dist/Vencord.js"], + "all_frames": true, + "world": "MAIN" } ], "background": { @@ -41,4 +45,4 @@ "strict_min_version": "91.0" } } -} \ No newline at end of file +} diff --git a/package.json b/package.json index f4c56f74..ac0ec301 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vencord", "private": "true", - "version": "1.9.0", + "version": "1.9.1", "description": "The other cutest Discord client mod", "homepage": "https://github.com/Equicord/Equicord#readme", "bugs": { diff --git a/src/main/monacoWin.html b/src/main/monacoWin.html index c4e204ab..1670cf7c 100644 --- a/src/main/monacoWin.html +++ b/src/main/monacoWin.html @@ -4,6 +4,9 @@ Equicord QuickCSS Editor +