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
This commit is contained in:
Ajay
2023-11-20 20:15:41 -05:00
parent 52bd85b850
commit 5ffbc9cabc
2 changed files with 37 additions and 2 deletions

View File

@@ -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);
}
}
});