1(function (d, w) { 2 var lazyPictures = [].slice.call(d.querySelectorAll("picture.lazy")); 3 var manageLaziness = function (lazyPicture) { 4 var lazyImage = lazyPicture.querySelector("img"); 5 lazyImage.src = lazyImage.getAttribute("data-src"); 6 var lazySources = lazyPicture.querySelectorAll("source"); 7 for (var j = 0; j < lazySources.length; j++) { 8 var lazySource = lazySources[j]; 9 lazySource.srcset = lazySource.getAttribute("data-srcset"); 10 } 11 if (w.addEventListener) { 12 var fallbackTimeout = setTimeout(function () { 13 lazyPicture.className = lazyPicture.className.replace("lazy", ""); 14 }, 500); 15 lazyImage.addEventListener("load", function () { 16 lazyPicture.className = lazyPicture.className.replace("lazy", ""); 17 clearTimeout(fallbackTimeout); 18 }); 19 return; 20 } 21 lazyPicture.className = lazyPicture.className.replace("lazy", ""); 22 }; 23 if ("IntersectionObserver" in w) { 24 var lazyImageObserver = new IntersectionObserver(function (entries, observer) { 25 for (var i = 0; i < entries.length; i++) { 26 var entry = entries[i]; 27 if (!entry.isIntersecting) { 28 continue; 29 } 30 var lazyPicture = entry.target; 31 manageLaziness(lazyPicture); 32 lazyImageObserver.unobserve(lazyPicture); 33 } 34 }); 35 36 for (var i = 0; i < lazyPictures.length; i++) { 37 var lazyPicture = lazyPictures[i]; 38 lazyImageObserver.observe(lazyPicture); 39 } 40 } else { 41 var lazyFallback = function () { 42 for (var x = 0; x < lazyPictures.length; x++) { 43 var lazyPicture = lazyPictures[x]; 44 if ((lazyPicture.getBoundingClientRect().top <= w.innerHeight && lazyPicture.getBoundingClientRect().bottom >= 0) && getComputedStyle(lazyPicture).display !== "none") { 45 manageLaziness(lazyPicture); 46 } 47 } 48 if (d.querySelectorAll("picture.lazy").length) { 49 requestAnimationFrame(lazyFallback); 50 } 51 }; 52 requestAnimationFrame(lazyFallback); 53 } 54}(document, window));
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.