aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/popup.ts
diff options
context:
space:
mode:
authorAjay <[email protected]>2023-11-20 20:15:41 -0500
committerAjay <[email protected]>2023-11-20 20:15:41 -0500
commit5ffbc9cabc7325294dcf59c63f38f86b4530425d (patch)
tree25401eeb54d67abc328c779dad6667aca1e0cc2f /src/popup.ts
parent52bd85b8506a6c7620e9125b9f84d73ed91367b5 (diff)
downloadSponsorBlock-5ffbc9cabc7325294dcf59c63f38f86b4530425d.tar.gz
SponsorBlock-5ffbc9cabc7325294dcf59c63f38f86b4530425d.zip
Add support for userstyles in the popup
It takes userstyles from stylus or enhancer for YouTube and copies them to the popup in an iframe
Diffstat (limited to 'src/popup.ts')
-rw-r--r--src/popup.ts6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/popup.ts b/src/popup.ts
index 21267afe..a6157dea 100644
--- a/src/popup.ts
+++ b/src/popup.ts
@@ -72,6 +72,12 @@ window.addEventListener("message", async (e): Promise<void> => {
if (e.source !== window.parent) return;
if (e.origin.endsWith('.youtube.com')) {
allowPopup = true;
+
+ if (e.data && e.data?.type === "style") {
+ const style = document.createElement("style");
+ style.textContent = e.data.css;
+ document.head.appendChild(style);
+ }
}
});