feat: ✨ handle video on slider

This commit is contained in:
Abdel LAMRANI 2026-10-13 16:16:54 +02:00
parent 55e51ca304
commit 4fe025ba9f

View file

@ -14,7 +14,7 @@ document.addEventListener("DOMContentLoaded", function () {
return;
}
// Add enablejsapi=1 to YouTube iframes (inserted later by the cookie script) so they can be paused
// Enable the YouTube API on video iframes so they can be paused
const storyRoot = document.querySelector("#story-historical-milestones") as HTMLElement;
storyRoot.querySelectorAll<HTMLIFrameElement>("iframe").forEach(enableYoutubeApi);
@ -22,7 +22,7 @@ document.addEventListener("DOMContentLoaded", function () {
new MutationObserver(mutations => {
mutations.forEach(mutation => {
if (mutation.target instanceof HTMLIFrameElement) {
enableYoutubeApi(mutation.target); // src changed
enableYoutubeApi(mutation.target);
}
mutation.addedNodes.forEach(node => {
if (node instanceof HTMLIFrameElement) enableYoutubeApi(node);