if(window.NodeList&&!NodeList.prototype.forEach){NodeList.prototype.forEach=function(callback,thisArg){thisArg=thisArg||window;for(var i=0;i0){setTimeout(function(){dlClass.loadImagesWithoutObserver(containers);},30);}} this.observerCallback=function(container,entries,observer,iteration){var dlClass=this;var skippedImages=0;entries.forEach(function(entry){if(entry.isIntersecting){var imgs=container.querySelectorAll('.dlImg');imgs.forEach(function(img){if(img.clientWidth==0){skippedImages++;} else if(img.className.indexOf('dlImgH')!=-1&&img.clientHeight==0){skippedImages++;} else{var clientHeight=img.clientHeight;var clientWidth=img.clientWidth;if(typeof(window.devicePixelRatio)!=='undefined'){if(window.devicePixelRatio>1.5&&window.devicePixelRatio<=2){clientHeight*=1.2;clientWidth*=1.2;} else if(window.devicePixelRatio>2&&window.devicePixelRatio<=2.5){clientHeight*=1.3;clientWidth*=1.3;} else if(window.devicePixelRatio>2.5&&window.devicePixelRatio<3){clientHeight*=1.5;clientWidth*=1.5;} else if(window.devicePixelRatio>3){clientHeight*=window.devicePixelRatio/2;clientWidth*=window.devicePixelRatio/2;}} clientHeight=Math.ceil(clientHeight);clientWidth=Math.ceil(clientWidth);var replaceResize='resizeimage=w:'+clientWidth;if(img.className.indexOf('dlImgH')!=-1)replaceResize+=',h:'+clientHeight;if(img.className.indexOf('dlImgC')!=-1)replaceResize+=',c:1';if(img.className.indexOf('dlImgBg')!=-1){img.style.backgroundImage=img.style.backgroundImage.replace(/(\?|\&)resizeimage=w:[a-z0-9]+/i,'$1'+replaceResize);} else{img.src=img.src.replace(/(\?|\&)resizeimage=w:[a-z0-9]+/i,'$1'+replaceResize);} dlClass.removeCssClass(img,'dlImg');dlClass.addCssClass(img,'dlImgR');}});}});if(skippedImages>0){setTimeout(function(){dlClass.observerCallback(container,entries,observer,iteration+1);},(iteration>100)?400:30);}} this.loadImagesWithObserver=function(containers){var dlClass=this;containers.forEach(function(container){var observer=new IntersectionObserver(function(entries,observer){dlClass.observerCallback(container,entries,observer,0);},{rootMargin:'60% 0px 60% 0px'});observer.observe(container);});} this.removeCssClass=function(element,className){var classes=element.className;classes=classes.split(' ');var result=new Array();classes.forEach(function(c){c=c.trim();if(!(c==className||c=='')){result.push(c);}});element.className=result.join(' ');} this.addCssClass=function(element,className){element.className+=' '+className;} this.loadBiggerImages=function(){var images=document.querySelectorAll('.dlImgR');images.forEach(function(img){if(img.clientWidth>0){if(img.className.indexOf('dlImgBg')!=-1){var link=img.style.backgroundImage;} else{var link=img.src;} var r=link.match(/resizeimage=w:([0-9]*)+/i);if(r!=null){if(parseInt(r[1])0){replaceResize+=',h:'+img.clientHeight;} if(img.className.indexOf('dlImgBg')!=-1){img.style.backgroundImage=img.style.backgroundImage.replace(/(\?|\&)resizeimage=w:[a-z0-9]+/i,'$1'+replaceResize);} else{img.src=img.src.replace(/(\?|\&)resizeimage=w:[a-z0-9]+/i,'$1'+replaceResize);}}}}});} this.init=function(){var dlClass=this;window.addEventListener('DOMContentLoaded',function(){var containers=document.querySelectorAll('.delayedLoad');var observerAvailable=(typeof(IntersectionObserver)!=='undefined');if(!observerAvailable){dlClass.loadImagesWithoutObserver(containers);} else{dlClass.loadImagesWithObserver(containers);}});window.addEventListener('resize',function(){try{clearTimeout(dlClass.resizeTimeout);dlClass.resizeTimeout=null;} catch(e){} dlClass.resizeTimeout=setTimeout(function(){dlClass.loadBiggerImages();},100);});}} var dl=new DelayedLoad();dl.init();