mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-06 11:37:02 +03:00
Copy styles over to popup
This commit is contained in:
@@ -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);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user