PageSourceSearch

https://sewingtrip.com/wp-content/cache/min/1/wp-content/plugins/s…/assets/js/youtube-lazy.js?ver=1790113016

js sewingtrip.com collected 2026-10-01 10:13:24 UTC 3,268 bytes, 16 lines download raw bytes

1(function(){'use strict';function createThumbnail(videoId){const img=document.createElement('img');img.src=`https://i.ytimg.com/vi_webp/${videoId}/hqdefault.webp`;img.alt='YouTube Video';img.className='zonYoutube-thumbnail';img.loading='lazy';return img}
2function createPlayButton(){const button=document.createElement('div');button.className='zonYoutube-play-button';button.innerHTML=`
3            <svg height="100%" version="1.1" viewBox="0 0 68 48" width="100%">
4                <path d="M66.52,7.74c-0.78-2.93-2.49-5.41-5.42-6.19C55.79,.13,34,0,34,0S12.21,.13,6.9,1.55 C3.97,2.33,2.27,4.81,1.48,7.74C0.06,13.05,0,24,0,24s0.06,10.95,1.48,16.26c0.78,2.93,2.49,5.41,5.42,6.19 C12.21,47.87,34,48,34,48s21.79-0.13,27.1-1.55c2.93-0.78,4.64-3.26,5.42-6.19C67.94,34.95,68,24,68,24S67.94,13.05,66.52,7.74z" fill="#f00"></path>
5                <path d="M 45,24 27,14 27,34" fill="#fff"></path>
6            </svg>
7        `;return button}
8function loadIframe(container,videoId){const iframe=document.createElement('iframe');iframe.setAttribute('src',`https://www.youtube.com/embed/${videoId}?autoplay=1&rel=0`);iframe.setAttribute('frameborder','0');iframe.setAttribute('allow','accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture');iframe.setAttribute('allowfullscreen','true');iframe.setAttribute('referrerpolicy','strict-origin-when-cross-origin');iframe.setAttribute('title','YouTube video player');container.classList.add('zonYoutube-loaded');container.innerHTML='';container.appendChild(iframe)}
9function initYouTubeLazy(container){if(container.dataset.initialized==='true'||container.classList.contains('zonYoutube-loaded')){return}
10container.dataset.initialized='true';const videoId=container.dataset.videoId;if(!videoId){console.error('YouTube video ID not found');return}
11const thumbnail=createThumbnail(videoId);const playButton=createPlayButton();const noscript=container.querySelector('noscript');if(noscript){container.insertBefore(thumbnail,noscript);container.insertBefore(playButton,noscript)}else{container.appendChild(thumbnail);container.appendChild(playButton)}
12container.addEventListener('click',function handleClick(){loadIframe(this,videoId);this.removeEventListener('click',handleClick)},{once:!0})}
13function initAllYouTubeLazy(){const containers=document.querySelectorAll('.zonYoutube-lazy:not([data-initialized="true"]):not(.zonYoutube-loaded)');containers.forEach(initYouTubeLazy)}
14if(document.readyState==='loading'){document.addEventListener('DOMContentLoaded',initAllYouTubeLazy)}else{initAllYouTubeLazy()}
15if(typeof MutationObserver!=='undefined'){const observer=new MutationObserver(function(mutations){const nodesToCheck=new Set();mutations.forEach(function(mutation){mutation.addedNodes.forEach(function(node){if(node.nodeType===1){nodesToCheck.add(node)}})});nodesToCheck.forEach(function(node){if(node.classList&&node.classList.contains('zonYoutube-lazy')&&!node.classList.contains('zonYoutube-loaded')&&node.dataset.initialized!=='true'){initYouTubeLazy(node)}
16if(node.querySelectorAll){const children=node.querySelectorAll('.zonYoutube-lazy:not([data-initialized="true"]):not(.zonYoutube-loaded)');children.forEach(initYouTubeLazy)}})});observer.observe(document.body,{childList:!0,subtree:!0})}})()

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.