-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
ls.respimg.min.js
3 lines (2 loc) · 3.51 KB
/
ls.respimg.min.js
1
2
3
/*! lazysizes - v5.3.2 */
!function(e,t){var r;e&&(r=function(){t(e.lazySizes),e.removeEventListener("lazyunveilread",r,!0)},t=t.bind(null,e,e.document),"object"==typeof module&&module.exports?t(require("lazysizes")):"function"==typeof define&&define.amd?define(["lazysizes"],t):e.lazySizes?r():e.addEventListener("lazyunveilread",r,!0))}("undefined"!=typeof window?window:0,function(d,n,p){"use strict";var i,a,s,l,t,r,f,o,c,m,u,y=p.cfg,e=n.createElement("img"),g="sizes"in e&&"srcset"in e,h=/\s+\d+h/g,z=(a=/\s+(\d+)(w|h)\s+(\d+)(w|h)/,s=Array.prototype.forEach,function(){function r(e){var t,r,i=e.getAttribute(y.srcsetAttr);i&&(r=i.match(a))&&((t="w"==r[2]?r[1]/r[3]:r[3]/r[1])&&e.setAttribute("data-aspectratio",t),e.setAttribute(y.srcsetAttr,i.replace(h,"")))}function e(e){var t;e.detail.instance==p&&((t=e.target.parentNode)&&"PICTURE"==t.nodeName&&s.call(t.getElementsByTagName("source"),r),r(e.target))}function t(){i.currentSrc&&n.removeEventListener("lazybeforeunveil",e)}var i=n.createElement("img");n.addEventListener("lazybeforeunveil",e),i.onload=t,i.onerror=t,i.srcset="data:,a 1w 1h",i.complete&&t()});function v(e,t){return e.w-t.w}function w(e,t,r,i){l.push({c:t,u:r,w:+i})}function b(e,t){var r,i=e.getAttribute("srcset")||e.getAttribute(y.srcsetAttr);!i&&t&&(i=e._lazypolyfill?e._lazypolyfill._set:e.getAttribute(y.srcAttr)||e.getAttribute("src")),e._lazypolyfill&&e._lazypolyfill._set==i||(r=o(i||""),t&&e.parentNode&&(r.isPicture="PICTURE"==e.parentNode.nodeName.toUpperCase(),r.isPicture&&d.matchMedia&&(p.aC(e,"lazymatchmedia"),c())),r._set=i,Object.defineProperty(e,"_lazypolyfill",{value:r,writable:!0}))}function A(e){var t,r,i,n,a,s,l,o,c,u=e;if(b(u,!0),(n=u._lazypolyfill).isPicture)for(r=0,i=(t=e.parentNode.getElementsByTagName("source")).length;r<i;r++)if(y.supportsType(t[r].getAttribute("type"),e)&&m(t[r].getAttribute("media"))){u=t[r],b(u),n=u._lazypolyfill;break}return 1<n.length?(s=u.getAttribute("sizes")||"",s=f.test(s)&&parseInt(s,10)||p.gW(e,e.parentNode),n.d=(l=e,o=d.devicePixelRatio||1,c=p.getX&&p.getX(l),Math.min(c||o,2.5,o)),!n.src||!n.w||n.w<s?(n.w=s,a=function(e){for(var t,r,i=e.length,n=e[i-1],a=0;a<i;a++)if((n=e[a]).d=n.w/e.w,n.d>=e.d){!n.cached&&(t=e[a-1])&&t.d>e.d-.13*Math.pow(e.d,2.2)&&(r=Math.pow(t.d-.6,1.6),t.cached&&(t.d+=.15*r),t.d+(n.d-e.d)*r>e.d&&(n=t));break}return n}(n.sort(v)),n.src=a):a=n.src):a=n[0],a}function E(e){var t;g&&e.parentNode&&"PICTURE"!=e.parentNode.nodeName.toUpperCase()||(t=A(e))&&t.u&&e._lazypolyfill.cur!=t.u&&(e._lazypolyfill.cur=t.u,t.cached=!0,e.setAttribute(y.srcAttr,t.u),e.setAttribute("src",t.u))}y.supportsType||(y.supportsType=function(e){return!e}),d.HTMLPictureElement&&g?!p.hasHDescriptorFix&&n.msElementsFromPoint&&(p.hasHDescriptorFix=!0,z()):d.picturefill||y.pf||(y.pf=function(e){var t,r;if(!d.picturefill)for(t=0,r=e.elements.length;t<r;t++)i(e.elements[t])},f=/^\s*\d+\.*\d*px\s*$/,t=/(([^,\s].[^\s]+)\s+(\d+)w)/g,r=/\s/,c=function(){var e,r;function t(){for(var e=0,t=r.length;e<t;e++)i(r[e])}c.init||(c.init=!0,addEventListener("resize",(r=n.getElementsByClassName("lazymatchmedia"),function(){clearTimeout(e),e=setTimeout(t,66)})))},m=function(e){return d.matchMedia?(m=function(e){return!e||(matchMedia(e)||{}).matches})(e):!e},E.parse=o=function(e){return l=[],(e=e.trim()).replace(h,"").replace(t,w),l.length||!e||r.test(e)||l.push({c:e,u:e,w:99}),l},i=E,y.loadedClass&&y.loadingClass&&(u=[],['img[sizes$="px"][srcset].',"picture > img:not([srcset])."].forEach(function(e){u.push(e+y.loadedClass),u.push(e+y.loadingClass)}),y.pf({elements:n.querySelectorAll(u.join(", "))})))});