forked from aFarkas/lazysizes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathls.attrchange.min.js
2 lines (2 loc) · 1.73 KB
/
ls.attrchange.min.js
1
2
/*! lazysizes - v5.1.2 */
!function(a,b){if(a){var c=function(){b(a.lazySizes),a.removeEventListener("lazyunveilread",c,!0)};b=b.bind(null,a,a.document),"object"==typeof module&&module.exports?b(require("lazysizes")):a.lazySizes?c():a.addEventListener("lazyunveilread",c,!0)}}("undefined"!=typeof window?window:0,function(a,b,c){"use strict";var d=function(){var e,f,g,h,i=c.cfg,j={"data-bgset":1,"data-include":1,"data-poster":1,"data-bg":1,"data-script":1},k="(\\s|^)("+i.loadedClass,l=b.documentElement,m=function(a){c.rAF(function(){c.rC(a,i.loadedClass),i.unloadedClass&&c.rC(a,i.unloadedClass),c.aC(a,i.lazyClass),("none"==a.style.display||a.parentNode&&"none"==a.parentNode.style.display)&&setTimeout(function(){c.loader.unveil(a)},0)})},n=function(a){var b,c,d,e;for(b=0,c=a.length;b<c;b++)d=a[b],e=d.target,e.getAttribute(d.attributeName)&&("source"==e.localName&&e.parentNode&&(e=e.parentNode.querySelector("img")),e&&k.test(e.className)&&m(e))};i.unloadedClass&&(k+="|"+i.unloadedClass),k+="|"+i.loadingClass+")(\\s|$)",k=new RegExp(k),j[i.srcAttr]=1,j[i.srcsetAttr]=1,a.MutationObserver?(g=new MutationObserver(n),e=function(){h||(h=!0,g.observe(l,{subtree:!0,attributes:!0,attributeFilter:Object.keys(j)}))},f=function(){h&&(h=!1,g.disconnect())}):(l.addEventListener("DOMAttrModified",function(){var a,b=[],c=function(){n(b),b=[],a=!1};return function(d){h&&j[d.attrName]&&d.newValue&&(b.push({target:d.target,attributeName:d.attrName}),a||(setTimeout(c),a=!0))}}(),!0),e=function(){h=!0},f=function(){h=!1}),addEventListener("lazybeforeunveil",f,!0),addEventListener("lazybeforeunveil",e),addEventListener("lazybeforesizes",f,!0),addEventListener("lazybeforesizes",e),e(),removeEventListener("lazybeforeunveil",d)};addEventListener("lazybeforeunveil",d)});