// Style the CTA button in the video via adding a class function addVideoCTAClass() { const targetElement = document.querySelector('.w-css-reset[data-handle="annotationOverlay"]'); if (targetElement) { const children = targetElement.children; if (children.length > 0 && children[0].children.length > 1) { const nextSibling = children[0].children[1]; if (nextSibling) { nextSibling.classList.add('videoCTA-parent'); return true; } } } return false; } // MutationObserver configuration const observer = new MutationObserver(function (mutationsList, observer) { if (addVideoCTAClass()) { observer.disconnect(); // Stop observing once the class is added } }); // Start observing the document for added nodes observer.observe(document.body, { childList: true, // Observe direct child elements subtree: true // Observe all descendants as well }); addVideoCTAClass(); // END Style the CTA button in the video via adding a class // Size the video player based on orientation function adjustVideoHeight() { const videoContainer = document.querySelector('.wistia_embed'); const currentHeight = window.innerHeight; // If in portrait mode and the initial portrait height has been recorded, use it if (window.innerHeight > window.innerWidth && initialPortraitHeight !== null) { videoContainer.style.height = `${initialPortraitHeight}px`; } else { videoContainer.style.height = `${currentHeight}px`; } console.log(`Video height adjusted to: ${currentHeight}px`); } function handleOrientationChange() { if (window.innerHeight > window.innerWidth) { // If entering portrait mode for the first time, capture the height if (initialPortraitHeight === null) { initialPortraitHeight = window.innerHeight; console.log(`Initial portrait height captured: ${initialPortraitHeight}px`); } adjustVideoHeight(); } else { // In landscape mode, use the current window height adjustVideoHeight(); } } function preSetVideoHeight() { console.log('preset'); const videoContainer = document.querySelector('.wistia_embed'); const currentHeight = window.innerHeight; videoContainer.style.height = `${currentHeight}px`; // Set initial height } // END Size the video player based on orientation