-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
ls.artdirect.min.js
3 lines (2 loc) · 2.06 KB
/
ls.artdirect.min.js
1
2
3
/*! lazysizes - v5.3.2 */
!function(e,t){var i;e&&(i=function(){t(e.lazySizes),e.removeEventListener("lazyunveilread",i,!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?i():e.addEventListener("lazyunveilread",i,!0))}("undefined"!=typeof window?window:0,function(o,e,u){"use strict";var d,t,l,f,m,h,p,s;function g(e){return'source[data-tag~="'+e+'"]'}function n(e){var t,i,a,r,s,n,c=e.getAttribute("media");return{source:e,aspectRatio:(t=e,s=parseFloat(t.getAttribute("data-aspectratio")),n=t.getAttribute(d.srcsetAttr)||t.getAttribute("srcset"),s||(r=(i=n.match(f))?"w"==i[2]?(a=i[1],i[3]):(a=i[3],i[1]):(a=t.getAttribute("width"),t.getAttribute("height")),s=a/r),s),isSelected:!c||o.matchMedia(c).matches}}function c(e,t){return e.aspectRatio<t.aspectRatio}function y(e,t){e._lsMedia=t,u.rAF(function(){e._lsMedia&&delete e._lsMedia,e.setAttribute("media",t)})}function b(t){var e,i=(e=t.img).offsetWidth/e.offsetHeight,a=s.call(t.picture.getElementsByTagName("source")).map(n).sort(c),r=function(e,t){for(var i=e[0],a=1,r=e.length;a<r;a++)Math.abs(i.aspectRatio-t)>Math.abs(e[a].aspectRatio-t)&&(i=e[a]);return i}(t.selector?a.filter(function(e){return e.source.matches(t.selector)}):a,i);r.isSelected||y(r.source,"(min-width: 1px)"),a.filter(function(e){return e!=r&&e.isSelected}).forEach(function(e){y(e.source,"(x)")})}o.addEventListener&&(d=u.cfg,t=(o.Element||Node||o.HTMLElement).prototype,l=/artdirect/,f=/\s+(\d+)(w|h)\s+(\d+)(w|h)/,m=/artdirect["']*\s*:\s*["']*(.+?)(?=($|'|"|;))/,h=/^picture$/i,p=/[\s,]+/g,s=[].slice,t.matches||(t.matches=t.matchesSelector||t.webkitMatchesSelector||t.msMatchesSelector||t.oMatchesSelector),o.addEventListener("lazybeforesizes",function(e){var t,i,a,r,s,n,c;e.detail.instance==u&&(t=e.target,r=(a=t).parentNode,s=h.test(r.nodeName||""),n=(o.getComputedStyle(a)||{}).fontFamily,c=null,s&&(d.autoArtDirect||l.test(n||""))&&(c={picture:r,img:a,tags:n.match(m)}).tags&&(c.selector=c.tags[1].split(p).map(g).join(",")),(i=c)&&b(i))},!0))});