forked from aFarkas/lazysizes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathls.blur-up.min.js
3 lines (2 loc) · 2.6 KB
/
ls.blur-up.min.js
1
2
3
/*! lazysizes - v5.2.2 */
!function(e,t){var n;e&&(n=function(){t(e.lazySizes),e.removeEventListener("lazyunveilread",n,!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?n():e.addEventListener("lazyunveilread",n,!0))}("undefined"!=typeof window?window:0,function(l,m,g){"use strict";function i(e,t){var r;return(e?n.call(e.querySelectorAll("source, img")):[t]).forEach(function(e){var t,n,a,i;r||(!(t=e.getAttribute("data-lowsrc"))||(a=(n=e).getAttribute("data-media")||n.getAttribute("media"),(i=n.getAttribute("type"))&&!u.test(i)||a&&!l.matchMedia(g.cfg.customMedia[a]||a).matches)||(r=t))}),r}function r(e,t,n,a){function i(){l&&g.rAF(function(){g.rC(t,"ls-blur-up-is-loading");try{l.parentNode.removeChild(l)}catch(e){}l=null})}function r(e){c++,s=e||s,e?i():1<c&&setTimeout(i,5e3)}var l,o,u=!1,s=!1,d="always"==a?0:Date.now(),c=0,f=(e||t).parentNode,v=function(){t.removeEventListener("load",v),t.removeEventListener("error",v),l&&g.rAF(function(){l&&g.aC(l,"ls-original-loaded")}),"always"!=a&&(!u||Date.now()-d<66)?r(!0):r()};n&&(o=function(e){u=!0,l=l||e.target,g.rAF(function(){g.rC(t,"ls-blur-up-is-loading"),l&&g.aC(l,"ls-blur-up-loaded")}),l&&(l.removeEventListener("load",o),l.removeEventListener("error",o))},(l=m.createElement("img")).addEventListener("load",o),l.addEventListener("error",o),l.className="ls-blur-up-img",l.cssText=t.cssText,l.src=n,l.alt="",l.setAttribute("aria-hidden","true"),f.insertBefore(l,(e||t).nextSibling),"always"!=a&&(l.style.visibility="hidden",g.rAF(function(){l&&setTimeout(function(){l&&g.rAF(function(){!s&&l&&(l.style.visibility="")})},g.cfg.blurupCacheDelay||33)}))),t.addEventListener("load",v),t.addEventListener("error",v),g.aC(t,"ls-blur-up-is-loading");var A=function(e){f==e.target&&(g.aC(l||t,"ls-inview"),r(),f.removeEventListener("lazybeforeunveil",A))};f.getAttribute("data-expand")||f.setAttribute("data-expand",-1),f.addEventListener("lazybeforeunveil",A),g.aC(f,g.cfg.lazyClass)}var n=[].slice,o=/blur-up["']*\s*:\s*["']*(always|auto)/,u=/image\/(jpeg|png|gif|svg\+xml)/;l.addEventListener("lazybeforeunveil",function(e){var t,n,a=e.detail;a.instance==g&&a.blurUp&&("PICTURE"!=(n=(t=e.target).parentNode).nodeName&&(n=null),r(n,t,i(n,t)||"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",a.blurUp))}),l.addEventListener("lazyunveilread",function(e){var t,n,a=e.detail;a.instance==g&&(t=e.target,((n=(getComputedStyle(t,null)||{fontFamily:""}).fontFamily.match(o))||t.getAttribute("data-lowsrc"))&&(a.blurUp=n&&n[1]||g.cfg.blurupMode||"always"))})});