From 5ffbc9cabc7325294dcf59c63f38f86b4530425d Mon Sep 17 00:00:00 2001 From: Ajay Date: Mon, 20 Nov 2023 20:15:41 -0500 Subject: 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 --- src/popup.ts | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/popup.ts') 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 => { 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); + } } }); -- cgit v1.2.3