PageSourceSearch

https://relicusroad.com/js/systems/video-system/index.min.c21f54ad…1db2bc0ff73d5a7a533c7bc38bbb06ff33716312.js

js relicusroad.com collected 2026-10-08 15:12:48 UTC 9,874 bytes, 16 lines download raw bytes

1(()=>{var e,t,n,s,l=class{constructor(){this.observer=null,this.observedVideos=new Set,this.config={rootMargin:"200px 0px",threshold:.01},this.enablePerformanceLogging=!window.location.hostname.includes("relicusroad.com"),this.performanceMetrics={pauseEvents:0,resumeEvents:0,loadEvents:0,startTime:performance.now()},this.init()}init(){this.createObserver()}createObserver(){if(window.PerformanceManager?.observeElement){this.useMasterObserver=!0;return}this.observer=new IntersectionObserver(e=>{e.forEach(e=>{this.handleVideoVisibility(e)})},this.config)}handleVideoVisibility(e){const t=e.target.querySelector("video");e.isIntersecting?!t||!t.hasAttribute("data-loaded")?this.loadVideo(e.target):this.resumeVideo(e.target):this.pauseVideo(e.target)}observeVideo(e){if(this.observedVideos.has(e))return;const t=e.querySelector("video");if(!t)return;this.observedVideos.add(e),this.useMasterObserver?window.PerformanceManager.observeElement(e,e=>this.handleVideoVisibility(e),{type:"viewport",hasAnimations:!0}):this.observer.observe(e)}loadVideo(e){const t=e.querySelector("video");if(!t||t.hasAttribute("data-loaded"))return;t.setAttribute("data-loaded","true"),t.load(),t.addEventListener("canplay",()=>{t.play().catch(e=>{})},{once:!0})}pauseVideo(e){const t=e.querySelector("video");if(!t||!t.hasAttribute("data-loaded"))return;!t.paused&&!t.hasAttribute("data-user-paused")&&(t.pause(),t.setAttribute("data-auto-paused","true"),e.setAttribute("data-playing","false"))}resumeVideo(e){const t=e.querySelector("video");if(!t||!t.hasAttribute("data-loaded"))return;t.hasAttribute("data-auto-paused")&&!t.hasAttribute("data-user-paused")&&(t.removeAttribute("data-auto-paused"),t.play().catch(e=>{}),e.setAttribute("data-playing","true"))}destroy(){this.observer&&(this.observer.disconnect(),this.observedVideos.clear())}},h=l,u=class{constructor(){this.processedVideos=new Set}processVideo(e){if(this.processedVideos.has(e))return;const t=e.querySelector("video");if(!t)return;this.processedVideos.add(e),t.addEventListener("loadedmetadata",()=>{this.detectOrientation(t,e)}),t.readyState>=1&&this.detectOrientation(t,e)}detectOrientation(e,t){if(!this.isOrientationVideo(t))return;const n=e.videoWidth>e.videoHeight;t.setAttribute("data-video-type",n?"landscape":"portrait"),t.style.setProperty("--video-width",e.videoWidth+"px"),t.style.setProperty("--video-height",e.videoHeight+"px")}isOrientationVideo(e){return e.classList.contains("video-testimonial")||e.id.startsWith("video-")||e.id==="testimonial-video"}reset(){this.processedVideos.clear()}},d=u,o=class{constructor(){this.isIOS=this.detectIOS(),this.processedVideos=new Set}detectIOS(){return/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream}processVideo(e){if(this.processedVideos.has(e))return;const t=e.querySelector("video");if(!t)return;this.processedVideos.add(e),this.isIOS&&this.handleIOSAutoplay(t,e)}handleIOSAutoplay(e,t){const n=this.createPlayOverlay();t.appendChild(n),n.addEventListener("click",()=>{e.play().then(()=>{n.classList.add("hidden")}).catch(e=>{})}),e.addEventListener("canplaythrough",()=>{e.play().then(()=>{n.classList.add("hidden")}).catch(()=>{})},{once:!0})}createPlayOverlay(){const e=document.createElement("div");e.className="rr-video-overlay ios-play-overlay";const t=document.createElement("div");return t.className="rr-video-overlay__button ios-play-button",t.innerHTML=`
2            <svg class="rr-video-overlay__icon" viewBox="0 0 24 24" fill="currentColor">
3                <path d="M8 5v14l11-7z"/>
4            </svg>
5        `,e.appendChild(t),e}reset(){this.processedVideos.clear()}},i=o,a="nodownload";function r(e){e.preventDefault()}function c(e){if(!e)return;e.setAttribute("controlsList",a),e.setAttribute("disablePictureInPicture",""),e.setAttribute("oncontextmenu","return false;"),e.addEventListener("contextmenu",r)}e=class{createLoader(){const e=document.createElement("div");return e.className="video-skeleton",e.setAttribute("aria-hidden","true"),e}createErrorFallback(e){const t=e.getAttribute("poster"),n=e.getAttribute("aria-label")||"Testimonial from a satisfied customer";return t?this.createPosterFallback(t,n):this.createGenericFallback(n)}createPosterFallback(e,t){const n=document.createElement("img");return n.src=e,n.alt=t,n.className="rr-video-cover video-fallback-image",n}createGenericFallback(e){const t=document.createElement("div");return t.className="rr-video-fallback video-fallback-placeholder",t.innerHTML=`
6            <div class="rr-video-fallback__body fallback-content">
7                <svg class="rr-video-fallback__icon" fill="currentColor" viewBox="0 0 24 24">
8                    <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/>
9                </svg>
10                <p class="rr-video-fallback__text">"${e}"</p>
11            </div>
12        `,t}updateLoaderError(e){const t=e.querySelector(".loader-text"),n=e.querySelector(".loader-spinner");t&&(t.textContent="Error loading video",t.className="rr-video-loader__text rr-video-loader__text--error loader-text"),n&&(n.className="rr-video-loader__spinner loader-spinner",n.style.animation="none")}createPlayOverlay(){const t=document.createElement("div");t.className="rr-video-overlay video-play-overlay";const e=document.createElement("button");return e.className="rr-video-overlay__button",e.setAttribute("aria-label","Play video"),e.innerHTML=`
13            <svg class="rr-video-overlay__icon" viewBox="0 0 24 24" fill="currentColor">
14                <path d="M8 5v14l11-7z"/>
15            </svg>
16        `,t.appendChild(e),t}createVideoContainer(e={}){const{id:s="",classes:a="video-container relative overflow-hidden rounded-lg",videoSrc:o="",posterSrc:i="",autoplay:r=!1,muted:l=!0,loop:d=!1,ariaLabel:u="Video content"}=e,n=document.createElement("div");n.className=a,s&&(n.id=s);const t=document.createElement("video");if(t.className="rr-video-cover rr-video-cover--fade opacity-0",t.style.opacity="0",t.setAttribute("playsinline",""),t.setAttribute("preload","none"),t.setAttribute("loading","lazy"),t.setAttribute("aria-label",u),c(t),o){const e=document.createElement("source");e.src=o,e.type="video/mp4",t.appendChild(e)}return i&&t.setAttribute("poster",i),r&&t.setAttribute("autoplay",""),l&&t.setAttribute("muted",""),d&&t.setAttribute("loop",""),n.appendChild(t),n.appendChild(this.createLoader()),n}},s=e,n=class{constructor(){this.containers=new Set,this.loadedVideos=new Set,this.lazyLoadManager=new h,this.orientationManager=new d,this.platformManager=new i,this.templates=new s,this.init()}init(){this.findVideoContainers(),this.setupVideoContainers()}findVideoContainers(){const e=document.querySelectorAll("video:not([data-motion]):not([data-motion-banner])");e.forEach(e=>{let t=e.parentElement;const n=window.getComputedStyle(t);n.position==="static"&&(t.style.position="relative"),this.containers.add(t)})}setupVideoContainers(){this.containers.forEach(e=>{this.setupVideoContainer(e)})}setupVideoContainer(e){const t=e.querySelector("video");if(!t)return;this.addLoader(e),e.setAttribute("data-playing","false"),this.lazyLoadManager.observeVideo(e),this.orientationManager.processVideo(e),this.platformManager.processVideo(e),this.setupVideoEvents(e,t),this.setupInteractiveVideo(e,t)}addLoader(e){const t=e.querySelector('.video-skeleton, [id*="loader"], [class*="loader"]');if(t)return;const n=this.templates.createLoader();e.appendChild(n)}hideSkeleton(e,t){if(e.dataset.skeletonHidden==="true")return;e.dataset.skeletonHidden="true",e.classList.add("loaded"),t.style.opacity="1";const n=e.querySelectorAll('.video-skeleton, [id*="loader"], [class*="loader"]');n.forEach(e=>{e.style.opacity="0",e.style.pointerEvents="none",setTimeout(()=>{e.style.display="none"},450)}),this.loadedVideos.add(e)}setupVideoEvents(e,t){const n=()=>this.hideSkeleton(e,t),o=()=>e.dataset.skeletonHidden==="true";t.addEventListener("playing",n);const s=()=>{setTimeout(()=>{!o()&&t.readyState>=2&&n()},1200)};t.addEventListener("loadeddata",s),t.addEventListener("canplay",s);let i=!1;const a=()=>{if(i)return;i=!0,setTimeout(()=>{o()||n()},8e3)};t.addEventListener("loadstart",a),t.readyState>=2&&s(),(t.readyState>=1||t.networkState===2)&&a(),t.addEventListener("error",s=>{this.handleVideoError(e,t,s),n()})}setupInteractiveVideo(e,t){const n=e.classList.contains("video-testimonial")||e.id.startsWith("video-")||e.id==="testimonial-video";if(!n)return;e.addEventListener("click",()=>{e.classList.contains("loaded")&&this.toggleVideoPlayback(e,t)}),t.addEventListener("play",()=>{e.setAttribute("data-playing","true")}),t.addEventListener("pause",()=>{e.setAttribute("data-playing","false")})}toggleVideoPlayback(e,t){t.paused?(t.removeAttribute("data-auto-paused"),t.play().catch(()=>{}),e.setAttribute("data-playing","true")):(t.removeAttribute("data-auto-paused"),t.setAttribute("data-user-paused","true"),t.pause(),e.setAttribute("data-playing","false"))}handleVideoError(e,t,n){console.error("Video error:",n),e.classList.add("video-error");const s=this.templates.createErrorFallback(t);e.appendChild(s),e.classList.add("using-fallback")}destroy(){this.lazyLoadManager.destroy(),this.orientationManager.reset(),this.platformManager.reset(),this.containers.clear(),this.loadedVideos.clear()}addVideoContainer(e){if(this.containers.has(e))return;this.containers.add(e),this.setupVideoContainer(e)}},t=n;function m(){return document.querySelector("video:not([data-motion]):not([data-motion-banner])")}function f(e){"requestIdleCallback"in window?window.requestIdleCallback(e,{timeout:2e3}
16):window.setTimeout(e,300)}function p(){if(!m())return;try{const e=new t;window.VideoSystem={videoContainer:e,addVideoContainer:t=>e.addVideoContainer(t)}}catch(e){console.error("Failed to initialize VideoSystem:",e)}}document.addEventListener("DOMContentLoaded",()=>{f(p)})})()

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.