1/************************************/ 2/* EEPHUS LAZY LOADER */ 3/* FOR BACKGROUND IMAGES */ 4/* */ 5/* DW GREEN - OCT. 2019 */ 6/************************************/ 7 8var lazyload = function(){}; 9 10if(typeof lazyloadImages == "undefined"); 11 var lazyloadImages = jQuery(); 12 13 14$(document).ready(function() { 15 16 /* LAZY LOADING IMAGES */ 17 var sizeSrc; 18 var sizeSrcAlt; 19 20 if (sizeState == 'mobile') { 21 sizeSrc = 'data-src-m'; 22 sizeSrcAlt = 'data-src-d'; 23 } else { 24 sizeSrc = 'data-src-d'; 25 sizeSrcAlt = 'data-src-m'; 26 } 27 lazyloadImages = $.merge(lazyloadImages,$('['+ sizeSrc +'], ['+ sizeSrcAlt +']')); 28 console.log(lazyloadImages); 29 var lazyloadThrottleTimeout; 30 31 if ("IntersectionObserver" in window) { 32 var imageObserver = new IntersectionObserver(function(entries, observer) { 33 entries.forEach(function(entry) { 34 if (entry.isIntersecting) { 35 var $img = $(entry.target); 36 log($img,'target'); 37 var src = $img.attr(sizeSrc); 38 if (!src) { 39 src = $img.attr(sizeSrcAlt); 40 } 41 $img.css('background-image',"url("+src+")"); 42 } 43 }); 44 }); 45 lazyloadImages.each(function(i,img){ 46 imageObserver.observe(img); 47 }); 48 49 } else { 50 lazyload = function() { 51 if (lazyloadThrottleTimeout) 52 clearTimeout(lazyloadThrottleTimeout); 53 54 lazyloadThrottleTimeout = setTimeout(function(){ 55 var scrollTop = window.pageYOffset; 56 lazyloadImages.each(function(i,img){ 57 var $img = $(img); 58 log('ll',$img,img.offsetTop,(window.innerHeight + scrollTop)); 59 if(img.offsetTop < (window.innerHeight + scrollTop)) { 60 var src = $img.attr(sizeSrc); 61 if (!src) { 62 src = $img.attr(sizeSrcAlt); 63 } 64 $img.css('background-image',"url('"+src+"')"); 65 } 66 }); 67 if (lazyloadImages.length == 0) { 68 document.removeEventListener("scroll", lazyload); 69 window.removeEventListener("resize", lazyload); 70 window.removeEventListener("orientationChange", lazyload); 71 } 72 }, 20); 73 } 74 75 document.addEventListener("scroll", lazyload); 76 window.addEventListener("resize", lazyload); 77 window.addEventListener("orientationChange", lazyload); 78 lazyload(); 79 } 80}); 81
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.