diff options
author | Ven <vendicated@riseup.net> | 2022-12-25 20:47:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-25 20:47:35 +0100 |
commit | 2e5d27b6b63097e96e25819df7a8cdd667c521b3 (patch) | |
tree | 082b0f1c7cb0210d208c7cb8017e9da97b3b4196 /browser | |
parent | 2172cae779fb24f9bcc8c54a0b6538da0b52bafd (diff) | |
download | Vencord-2e5d27b6b63097e96e25819df7a8cdd667c521b3.tar.gz Vencord-2e5d27b6b63097e96e25819df7a8cdd667c521b3.tar.bz2 Vencord-2e5d27b6b63097e96e25819df7a8cdd667c521b3.zip |
feat: Proper CSS api & css bundle (#269)
Co-authored-by: Vap0r1ze <superdash993@gmail.com>
Diffstat (limited to 'browser')
-rw-r--r-- | browser/content.js | 17 | ||||
-rw-r--r-- | browser/manifestv2.json | 2 | ||||
-rw-r--r-- | browser/manifestv3.json | 2 |
3 files changed, 16 insertions, 5 deletions
diff --git a/browser/content.js b/browser/content.js index 2c4b40e..e47ef83 100644 --- a/browser/content.js +++ b/browser/content.js @@ -2,7 +2,18 @@ if (typeof browser === "undefined") { var browser = chrome; } -var script = document.createElement("script"); +const script = document.createElement("script"); script.src = browser.runtime.getURL("dist/Vencord.js"); -// documentElement because we load before body/head are ready -document.documentElement.appendChild(script); + +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), + { once: true } +); diff --git a/browser/manifestv2.json b/browser/manifestv2.json index 405b2dc..b28b73f 100644 --- a/browser/manifestv2.json +++ b/browser/manifestv2.json @@ -18,7 +18,7 @@ "js": ["content.js"] } ], - "web_accessible_resources": ["dist/Vencord.js"], + "web_accessible_resources": ["dist/Vencord.js", "dist/Vencord.css"], "background": { "scripts": ["background.js"] } diff --git a/browser/manifestv3.json b/browser/manifestv3.json index ea79d12..d15b80a 100644 --- a/browser/manifestv3.json +++ b/browser/manifestv3.json @@ -23,7 +23,7 @@ "web_accessible_resources": [ { - "resources": ["dist/Vencord.js"], + "resources": ["dist/Vencord.js", "dist/Vencord.css"], "matches": ["*://*.discord.com/*"] } ], |