This repository has been archived by the owner on Jul 8, 2019. It is now read-only.
forked from aFarkas/lazysizes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ls.include.min.js
2 lines (2 loc) · 6.22 KB
/
ls.include.min.js
1
2
/*! lazysizes - v4.1.2 */
!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(a){var b;(b=a.match(D))?this.urls[b[1]]=w.map[b[2]]||b[2]:this.urls.include=w.map[a]||a}function e(a){var b,c,e;return a=a.trim(),a=w.map[a]||a,c=a.match(E),c?(e=c[1],b={condition:v.include.conditions[c[3]]||v.customMedia[c[3]]||c[2]||null,name:c[3]}):(e=a,b={condition:null,name:""}),b.urls={},(w.map[e]||e).split(C).forEach(d,b),!b.urls.include&&b.urls.amd&&(this.saved=!0,b.initial=this),b}function f(a){var b,d,f=a.getAttribute("data-include")||"",g=a.lazyInclude;return(!g||g.str!=f||w.allowReload)&&(d={saved:!1,content:null},g={str:f,candidates:(w.map[f]||f).split(z).map(e,d)},!(b=g.candidates.length)||g.candidates[b-1].condition?(d.saved=!0,g.candidates.push({urls:{},condition:null,name:"initial",content:d})):d.saved&&1==g.candidates.length&&(d.saved=!1),g.initialContent=d,d.saved&&(d.content=a.innerHTML),a.lazyInclude=g,g.candidates.length>1?c.aC(a,"lazyconditionalinclude"):c.rC(a,"lazyconditionalinclude")),g}function g(b,c){var d=!c.condition;return c.condition&&(h(),y[c.name]?d=!0:a.matchMedia&&"string"==typeof c.condition?d=(matchMedia(c.condition)||{}).matches:"function"==typeof c.condition&&(d=c.condition(b,c))),d}function h(){var a;y||(x||(x=b.querySelector(w.contentElement)),x?(a=(I(x,":after").getPropertyValue("content")||"none").replace(F,""),y={},a&&(y[a]=1),a=(I(x,":before").getPropertyValue("content")||"none").replace(F,""),a&&(y[a]=1)):y={})}function i(a){var b,c,d=a.lazyInclude;if(d&&d.candidates)for(b=0;b<d.candidates.length&&(c=d.candidates[b],!g(a,c));b++);return c&&c!=d.current||(c=null),c}function j(a,b){var c=new XMLHttpRequest;c.addEventListener("readystatechange",function(){var a=this.DONE||4;this.readyState===a&&(b(c),c=null)},!1),c.open.apply(c,a.openArgs),c.setRequestHeader("X-Requested-With","XMLHttpRequest"),a.xhrModifier&&a.xhrModifier(c,a.candidate),c.send(a.sendData)}function k(a,b){a=a.split("|,|");var d=a.length-1;c.cfg.requireJs?c.cfg.requireJs(a,b):a.forEach(function(a,c){n(a,c==d?b:null)})}function l(a,b){c.cfg.systemJs?c.cfg.systemJs(a,b):n(a,b)}function m(a){for(var c=!1,d=b.styleSheets,e=a.href,f=0,g=d.length;g>f;f++)if(d[f].href==e){c=!0;break}return c}function n(a,c,d){if(B[a])d&&(B[a]===!0?setTimeout(d):B[a].push(d));else{var e=b.createElement(c===!0?"script":"link"),f=b.getElementsByTagName("script")[0];if(c?(e.src=a,e.async=!1):(e.rel="stylesheet",e.href=a),B[a]=[],B[e.href]=!0,d){var g,h=function(b){if("readystatechange"!=b.type||A[b.target.readyState]){var c=B[a];for(e.removeEventListener("load",h),e.removeEventListener("error",h),e.removeEventListener("readystatechange",h),e.removeEventListener("loadcssdefined",h),g&&clearInterval(g),B[a]=!0;c.length;)c.shift()()}};c||(g=setInterval(function(){m(e)&&h({})},60)),e.addEventListener("load",h),e.addEventListener("error",h),e.addEventListener("readystatechange",h),e.addEventListener("loadcssdefined",h),B[a][0]=d}f.parentNode.insertBefore(e,f)}}function o(a,b){a=a.split("|,|");var c=a.length-1;a.forEach(function(a,d){n(a,!1,d==c?b:null)})}function p(a){a&&"function"==typeof a.lazytransform&&a.lazytransform(this)}function q(a){a&&"function"==typeof a.lazyunload&&a.lazyunload(this)}function r(a){a&&"function"==typeof a.lazyload&&a.lazyload(this)}function s(a,b){var d,e,f,g,h,i=a.lazyInclude.current||null,m={candidate:b,openArgs:["GET",b.urls.include,!0],sendData:null,xhrModifier:null,content:b.content&&b.content.content||b.content,oldCandidate:i},n=c.fire(a,"lazyincludeload",m);if(n.defaultPrevented)return void J.d();if(h=function(){e&&f&&!g&&d()},d=function(){var d,g=e.status,h=e.content||e.responseText,j=!(null!=h||!i||!i.urls.include),k={candidate:b,content:h,text:e.responseText||e.content,response:e.response,xml:e.responseXML,isSuccess:"status"in e?g>=200&&300>g||304===g:!0,oldCandidate:i,insert:!0,resetHTML:j},l={target:a,details:k,detail:k};b.modules=f,i&&i.modules&&(i.modules.forEach(q,l),i.modules=null,k.resetHTML&&null==k.content&&b.initial&&b.initial.saved&&(k.content=b.initial.content)),f.forEach(p,l),d=c.fire(a,"lazyincludeloaded",k),k.insert&&k.isSuccess&&!d.defaultPrevented&&null!=k.content&&k.content!=a.innerHTML&&(a.innerHTML=k.content),J.d(),f.forEach(r,l),setTimeout(function(){c.fire(a,"lazyincluded",k)}),e=null,f=null},a.lazyInclude.current=b,a.setAttribute("data-currentinclude",b.name),b.urls.css&&(g=!0,o(b.urls.css,function(){g=!1,h()})),null==m.content&&b.urls.include?j(m,function(a){e=a,h()}):e=m,b.urls.amd||b.urls.module){var s=function(){f=Array.prototype.slice.call(arguments),h()};b.urls.amd?k(b.urls.amd,s):l(b.urls.module,s)}else f=[];h()}function t(a){var b,c=f(a);return c.candidates.length&&G.contains(a)?(b=i(a),b&&s(a,b),!0):void 0}function u(a){a.detail.instance==c&&!a.defaultPrevented&&a.target.getAttribute("data-include")&&(J.q(a.target),a.detail.firesLoad=!0)}if(b.getElementsByClassName){var v,w,x,y,z=/\s*,+\s+/,A={complete:1,loaded:1},B={},C=/\s+/,D=/^(amd|css|module)\:(.+)/i,E=/(.+)\s+(\(\s*(.+)\s*\))/,F=/['"]/g,G=b.documentElement,H=b.getElementsByClassName("lazyconditionalinclude"),I=function(b,c){var d=b.ownerDocument.defaultView;return d.opener||(d=a),d.getComputedStyle(b,c||null)||{getPropertyValue:function(){},isNull:!0}},J=function(){var a=2,b=3,c=a,d=0,e=0,f=[],g=function(){var a,b=function(){f.length&&(d=0,f.d())};return function(){clearTimeout(a),a=setTimeout(b,999)}}();return{q:function(a){var h=null==a.getAttribute("data-lazyqueue");h&&(e++,c=b),d>c?f[h?"unshift":"push"](a):t(a)&&(d++,g())},d:function(){if(d&&d--,e>0&&(e--,e||(c=a)),!(d>c)){for(;f.length;)if(t(f.shift())){d++;break}g()}}}}(),K=function(){var a,b=function(){for(var a=0,b=H.length;b>a;a++)!c.hC(H[a],v.lazyClass)&&i(H[a])&&c.aC(H[a],v.lazyClass)};return function(c){clearTimeout(a),y=null,a=setTimeout(b,"resize"==c.type?31:0)}}();v=c&&c.cfg||a.lazySizesConfig,v||(v={},a.lazySizesConfig=v),v.include||(v.include={}),w=v.include,w.contentElement||(w.contentElement="html"),w.conditions||(w.conditions={}),w.map||(w.map={}),addEventListener("lazybeforeunveil",u,!1),addEventListener("resize",K,!1),addEventListener("lazyrefreshincludes",K,!1)}});