1document.addEventListener("DOMContentLoaded", function() { 2 let lazyYoutubes = [].slice.call(document.querySelectorAll("div.youtube")); 3 let active = false; 4 5 const lazyLoadYoutube = function() { 6 if (active === false) { 7 active = true; 8 9 setTimeout(function() { 10 lazyYoutubes.forEach(function(lazyYoutube) { 11 if ((lazyYoutube.getBoundingClientRect().top <= window.innerHeight && lazyYoutube.getBoundingClientRect().bottom >= 0) && getComputedStyle(lazyYoutube).display !== "none") { 12 // videos[i].style.backgroundImage = 'url(https://i.ytimg.com/vi/' + videos[i].id + '/sddefault.jpg)'; 13 lazyYoutube.style.backgroundImage = lazyYoutube.dataset.src; 14 // lazyYoutube.classList.add(lazyYoutube.dataset.src); 15 // lazyYoutube.srcset = lazyYoutube.dataset.srcset; 16 // lazyYoutube.classList.remove("lazy"); 17 18 lazyYoutubes = lazyYoutubes.filter(function(image) { 19 return image !== lazyYoutube; 20 }); 21 22 if (lazyYoutubes.length === 0) { 23 document.removeEventListener("scroll", lazyLoadYoutube); 24 window.removeEventListener("resize", lazyLoadYoutube); 25 window.removeEventListener("orientationchange", lazyLoadYoutube); 26 } 27 } 28 }); 29 30 active = false; 31 }, 200); 32 } 33 }; 34 35 document.addEventListener("scroll", lazyLoadYoutube); 36 window.addEventListener("resize", lazyLoadYoutube); 37 window.addEventListener("orientationchange", lazyLoadYoutube); 38});
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.