UNPKG

generator-craftskeleton

Version:

Starterkit for Craft CMS 2.x (Multi-Environment Configs with HeartyConfig, Gulp, and Bower for Dependencie-Management) made by interpunkt. ag

2 lines 4.07 kB
/*! lazysizes - v1.5.0 */ !function(a,b,c){"use strict";var d,e,f=a.lazySizes&&lazySizes.cfg||a.lazySizesConfig,g=b.createElement("img"),h="sizes"in g&&"srcset"in g,i=/\s+\d+h/g,j=Array.prototype.forEach,k=function(a){var b=a.getAttribute(lazySizesConfig.srcsetAttr);b&&a.setAttribute(lazySizesConfig.srcsetAttr,b.replace(i,""))};if(f||(f={},a.lazySizesConfig=f),f.supportsType||(f.supportsType=function(a){return!a}),!(a.picturefill||a.respimage||f.pf)){if(a.HTMLPictureElement&&h)return b.msElementsFromPoint&&(e=navigator.userAgent.match(/Edge\/(\d+)/))&&e[1]<15&&b.addEventListener("lazybeforeunveil",function(a){var b=a.target.parentNode;b&&j.call(b.getElementsByTagName("source"),k),k(a.target)}),void(f.pf=function(){});f.pf=function(b){var c,e;if(!a.picturefill&&!a.respimage)for(c=0,e=b.elements.length;e>c;c++)d(b.elements[c])},d=function(){var c=function(a,b){return a.w-b.w},e=/^\s*\d+px\s*$/,g=function(a){var b,c,d=a.length,e=a[d-1],f=0;for(f;d>f;f++)if(e=a[f],e.d=e.w/a.w,e.d>=a.d){!e.cached&&(b=a[f-1])&&b.d>a.d-.13*Math.pow(a.d,2.2)&&(c=Math.pow(b.d-.6,1.6),b.cached&&(b.d+=.15*c),b.d+(e.d-a.d)*c>a.d&&(e=b));break}return e},j=function(){var a,b=/(([^,\s].[^\s]+)\s+(\d+)w)/g,c=/\s/,d=function(b,c,d,e){a.push({c:c,u:d,w:1*e})};return function(e){return a=[],e=e.trim(),e.replace(i,"").replace(b,d),a.length||!e||c.test(e)||a.push({c:e,u:e,w:99}),a}}(),k=function(){k.init||(k.init=!0,addEventListener("resize",function(){var a,c=b.getElementsByClassName("lazymatchmedia"),e=function(){var a,b;for(a=0,b=c.length;b>a;a++)d(c[a])};return function(){clearTimeout(a),a=setTimeout(e,66)}}()))},l=function(b,c){var d,e=b.getAttribute("srcset")||b.getAttribute(f.srcsetAttr);!e&&c&&(e=b._lazypolyfill?b._lazypolyfill._set:b.getAttribute("src")||b.getAttribute(f.srcAttr)),b._lazypolyfill&&b._lazypolyfill._set==e||(d=j(e||""),c&&b.parentNode&&(d.isPicture="PICTURE"==b.parentNode.nodeName.toUpperCase(),d.isPicture&&(a.matchMedia||a.Modernizr&&Modernizr.mq)&&(lazySizes.aC(b,"lazymatchmedia"),k())),d._set=e,Object.defineProperty(b,"_lazypolyfill",{value:d,writable:!0}))},m=function(b){var c=a.devicePixelRatio||1,d=lazySizes.getX&&lazySizes.getX(b);return Math.min(d||c,2.5,c)},n=function(b){return a.matchMedia?(n=function(a){return!a||(matchMedia(a)||{}).matches})(b):a.Modernizr&&Modernizr.mq?!b||Modernizr.mq(b):!b},o=function(a){var b,d,h,i,j,k,o;if(i=a,l(i,!0),j=i._lazypolyfill,j.isPicture)for(d=0,b=a.parentNode.getElementsByTagName("source"),h=b.length;h>d;d++)if(f.supportsType(b[d].getAttribute("type"),a)&&n(b[d].getAttribute("media"))){i=b[d],l(i),j=i._lazypolyfill;break}return j.length>1?(o=i.getAttribute("sizes")||"",o=e.test(o)&&parseInt(o,10)||lazySizes.gW(a,a.parentNode),j.d=m(a),(!j.w||j.w<o)&&(j.w=o,k=g(j.sort(c)))):k=j[0],k},p=function(a){if(!h||!a.parentNode||"PICTURE"==a.parentNode.nodeName.toUpperCase()){var b=o(a);b&&b.u&&a._lazypolyfill.cur!=b.u&&(a._lazypolyfill.cur=b.u,b.cached=!0,a.setAttribute(f.srcAttr,b.u),a.setAttribute("src",b.u))}};return p.parse=j,p}(),f.loadedClass&&f.loadingClass&&!function(){var a=[];['img[sizes$="px"][srcset].',"picture > img:not([srcset])."].forEach(function(b){a.push(b+f.loadedClass),a.push(b+f.loadingClass)}),f.pf({elements:b.querySelectorAll(a.join(", "))})}()}}(window,document),function(a){"use strict";var b,c=a.createElement("img");!("srcset"in c)||"sizes"in c||window.HTMLPictureElement||(b=/^picture$/i,a.addEventListener("lazybeforeunveil",function(c){var d,e,f,g,h,i,j;!c.defaultPrevented&&!lazySizesConfig.noIOSFix&&(d=c.target)&&(f=d.getAttribute(lazySizesConfig.srcsetAttr))&&(e=d.parentNode)&&((h=b.test(e.nodeName||""))||(g=d.getAttribute("sizes")||d.getAttribute(lazySizesConfig.sizesAttr)))&&(i=h?e:a.createElement("picture"),d._lazyImgSrc||Object.defineProperty(d,"_lazyImgSrc",{value:a.createElement("source"),writable:!0}),j=d._lazyImgSrc,g&&j.setAttribute("sizes",g),j.setAttribute(lazySizesConfig.srcsetAttr,f),d.setAttribute("data-pfsrcset",f),d.removeAttribute(lazySizesConfig.srcsetAttr),h||(e.insertBefore(i,d),i.appendChild(d)),i.insertBefore(j,d))}))}(document);