Copy styles over to popup

This commit is contained in:
Ajay
2025-06-04 00:57:25 -04:00
parent 3734b61c81
commit 4330d5a726

View File

@@ -440,4 +440,14 @@ function forwardClickEvents(sendMessage: (request: Message) => Promise<MessageRe
}); });
}); });
} }
} }
// Copy over styles from parent window
window.addEventListener("message", async (e): Promise<void> => {
if (e.source !== window.parent) return;
if (e.origin.endsWith(".youtube.com") && e.data && e.data?.type === "style") {
const style = document.createElement("style");
style.textContent = e.data.css;
document.head.appendChild(style);
}
});