PageSourceSearch

https://overthemoon.com/cdn/shop/t/167/assets/videoToggle.js?v=135962720480815345601790002913

js overthemoon.com collected 2026-09-24 18:42:17 UTC 5,242 bytes, 2 lines download raw bytes

1function hydrateLazyVideoSources(video){if(!video)return;let changed=!1;const videoDataSrc=video.getAttribute("data-src");videoDataSrc&&(video.src=videoDataSrc,video.removeAttribute("data-src"),changed=!0);for(const source of video.querySelectorAll("source[data-src]")){const url=source.getAttribute("data-src");url&&(source.src=url,source.removeAttribute("data-src"),changed=!0)}changed&&video.load()}class VideoToggle extends HTMLElement{constructor(){super(),this._video=null,this._pauseButton=null,this._playButton=null,this._autoplayHoverZone=null,this._autoplayHoverVideo=null,this._handlePauseClick=this._handlePauseClick.bind(this),this._handlePlayClick=this._handlePlayClick.bind(this),this._syncUiState=this._syncUiState.bind(this),this._handleAutoplayPointerEnter=this._handleAutoplayPointerEnter.bind(this),this._handleAutoplayPointerOut=this._handleAutoplayPointerOut.bind(this)}connectedCallback(){const videoWrapper=this.closest("video-wrapper");if(!videoWrapper||(this._video=videoWrapper.querySelector("video"),!this._video))return;hydrateLazyVideoSources(this._video);const buttons=this.querySelectorAll("button");this._pauseButton=buttons[0]||null,this._playButton=buttons[1]||null,!(!this._pauseButton||!this._playButton)&&(this._pauseButton.setAttribute("type","button"),this._pauseButton.setAttribute("aria-controls",this._ensureVideoId()),this._pauseButton.setAttribute("aria-label","Pause video"),this._playButton.setAttribute("type","button"),this._playButton.setAttribute("aria-controls",this._ensureVideoId()),this._playButton.setAttribute("aria-label","Play video"),this._pauseButton.addEventListener("click",this._handlePauseClick),this._playButton.addEventListener("click",this._handlePlayClick),this._video.addEventListener("play",this._syncUiState),this._video.addEventListener("pause",this._syncUiState),this._video.addEventListener("ended",this._syncUiState),this._attachAutoplayHover(),this._syncUiState())}disconnectedCallback(){this._pauseButton&&this._pauseButton.removeEventListener("click",this._handlePauseClick),this._playButton&&this._playButton.removeEventListener("click",this._handlePlayClick),this._video&&(this._video.removeEventListener("play",this._syncUiState),this._video.removeEventListener("pause",this._syncUiState),this._video.removeEventListener("ended",this._syncUiState)),this._detachAutoplayHover()}_handlePauseClick(){this._video&&this._video.pause()}_handlePlayClick(){this._video&&this._video.play().catch(()=>{})}_attachAutoplayHover(){!this.hasAttribute("autoplay-hover")||!this._video||window.matchMedia("(prefers-reduced-motion: reduce)").matches||window.matchMedia("(hover: hover) and (pointer: fine)").matches&&(this._autoplayHoverZone=this._video.closest("video-wrapper"),this._autoplayHoverZone?(this._autoplayHoverZone.addEventListener("pointerenter",this._handleAutoplayPointerEnter),this._autoplayHoverZone.addEventListener("pointerout",this._handleAutoplayPointerOut)):(this._autoplayHoverVideo=this._video,this._autoplayHoverVideo.addEventListener("pointerenter",this._handleAutoplayPointerEnter),this._autoplayHoverVideo.addEventListener("pointerout",this._handleAutoplayPointerOut)),this.addEventListener("pointerenter",this._handleAutoplayPointerEnter),this.addEventListener("pointerout",this._handleAutoplayPointerOut))}_detachAutoplayHover(){this._autoplayHoverZone&&(this._autoplayHoverZone.removeEventListener("pointerenter",this._handleAutoplayPointerEnter),this._autoplayHoverZone.removeEventListener("pointerout",this._handleAutoplayPointerOut),this._autoplayHoverZone=null),this._autoplayHoverVideo&&(this._autoplayHoverVideo.removeEventListener("pointerenter",this._handleAutoplayPointerEnter),this._autoplayHoverVideo.removeEventListener("pointerout",this._handleAutoplayPointerOut),this._autoplayHoverVideo=null),this.removeEventListener("pointerenter",this._handleAutoplayPointerEnter),this.removeEventListener("pointerout",this._handleAutoplayPointerOut)}_isWithinAutoplayHoverGroup(el){if(!el)return!1;if(el===this||this.contains(el)||this._video&&(el===this._video||this._video.contains(el)))return!0;const zone=this._autoplayHoverZone;return!!(zone&&(el===zone||zone.contains(el)))}_handleAutoplayPointerEnter(){this._video&&this._video.play().catch(()=>{})}_handleAutoplayPointerOut(e){this._isWithinAutoplayHoverGroup(e.relatedTarget)||this._video&&this._video.pause()}_syncUiState(){if(!this._video||!this._pauseButton||!this._playButton)return;const isPlaying=!this._video.paused&&!this._video.ended;this.classList.toggle("playing",isPlaying),this._video.classList.toggle("playing",isPlaying),this._setButtonVisibility(this._pauseButton,isPlaying),this._setButtonVisibility(this._playButton,!isPlaying)}_setButtonVisibility(button,isVisible){button.hidden=!isVisible,button.style.display=isVisible?"":"none",button.setAttribute("aria-hidden",isVisible?"false":"true"),button.tabIndex=isVisible?0:-1}_ensureVideoId(){return this._video?(this._video.id||(this._video.id=`video-toggle-target-${Math.random().toString(36).slice(2,10)}`),this._video.id):""}}window.customElements.get("video-toggle")||customElements.define("video-toggle",VideoToggle);
2//# sourceMappingURL=/cdn/shop/t/167/assets/videoToggle.js.map?v=135962720480815345601790002913

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.