LoveIt/assets/js/lib/lazysizes/ls.native-loading.min.js
2020-02-24 17:00:39 +08:00

2 lines
No EOL
1.5 KiB
JavaScript

/*! lazysizes - v5.2.0 */
!function(a,b){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)}(window,function(a,b,c){"use strict";function d(){var d=c.loader,e=d.checkElems,f=function(){setTimeout(function(){a.removeEventListener("scroll",d._aLSL,!0)},1e3)},g="object"==typeof j.nativeLoading.disableListeners?j.nativeLoading.disableListeners:k;g.scroll&&(a.addEventListener("load",f),f(),a.removeEventListener("scroll",e,!0)),g.resize&&a.removeEventListener("resize",e,!0),Object.keys(g).forEach(function(a){g[a]&&b.removeEventListener(a,e,!0)})}function e(){h||(h=!0,f&&g&&j.nativeLoading.disableListeners&&(!0===j.nativeLoading.disableListeners&&(j.nativeLoading.setLoadingAttribute=!0),d()),j.nativeLoading.setLoadingAttribute&&a.addEventListener("lazybeforeunveil",function(a){var b=a.target;"loading"in b&&!b.getAttribute("loading")&&b.setAttribute("loading","lazy")},!0))}var f="loading"in HTMLImageElement.prototype,g="loading"in HTMLIFrameElement.prototype,h=!1,i=c.prematureUnveil,j=c.cfg,k={focus:1,mouseover:1,click:1,load:1,transitionend:1,animationend:1,scroll:1,resize:1};j.nativeLoading||(j.nativeLoading={}),a.addEventListener&&a.MutationObserver&&(f||g)&&(c.prematureUnveil=function(a){return h||e(),!(!("loading"in a&&(j.nativeLoading.setLoadingAttribute||a.getAttribute("loading")))||"auto"==a.getAttribute("data-sizes")&&!a.offsetWidth)||(i?i(a):void 0)})});