-
Notifications
You must be signed in to change notification settings - Fork 1
/
lazy-auto.min.js
2 lines (2 loc) · 3.88 KB
/
lazy-auto.min.js
1
2
/*! Lazy JS v1.0.8 | https://github.com/noordawod/lazy-js */
(function(R,L,p){var E=!0,aa=!1,f="document",T="Element",M="head",m="loaded",S="prototype",X="firstChild",O="readyState",w="call",N="shift",j="push",U="substr",h="load",I="add",ac="length",c="handlers",q="queue",u="prefix",ab="baseURI",H="on"+h,y=h+"ing",W="onreadystatechange",x="className",l="removeChild",V="get"+T+"sByTagName",n="toLowerCase",z="slice",ad="replace",o="canStart",d="onSuccess",k="onProgress",K="onChunk",e="onError",g=R.document,G=g[V]("html")[0]||g[f+T],r=g[M]||g[V](M)[0],Z=function(){},D=function(ae,af,ag){if(p===ae||L===ae){return aa}ag=R.Object[S].toString[w](ae)[z](8,-1)[n]();return ag===af[n]()},v=function(ae){return D(ae,"function")},B=function(ae){return D(ae,"array")},C=function(af,ae){return R.Array[S].slice[w](af,ae||0)},Y=function(){return E},J=function(ae,af){throw"Unable to load: "+af+" ["+ae+"]"},Q=function(af){var ae=this,ag=ae[c][af];if(D(ag,"string")){ag=R[ag]}return v(ag)?ag.apply(ae,C(arguments,1)):p},a=function(ae){return !ae?"":ae[ad](/(^\s+|\s+$)/g,"")},A=function(ae){G[x]=a(G[x]+" "+ae)},t=function(ae){G[x]=a(G[x][ad](new RegExp("\\s*"+ae+"\\s*","g")," "))},s=function(){return +new R.Date()},i=function(ae,ag,ai){var am=this,al=g["create"+T]("script"),af,ak=function(){al[H]=L;r[l](al);ag(ae,s()-af)},ah=function(){am.quit=E;al[H]=al[W]=L;r[l](al);ai(ae)};if(!am.quit){al.src=ae;al.async=E;al.type="text/javascript";al.onerror=ah;al[H]=ak;al[W]=function(){if(m===this[O]||"complete"===this[O]){al[W]=L;ak()}};try{af=s();if(r[X]){r.insertBefore(al,r[X])}else{r.appendChild(al)}}catch(aj){ah()}}},b=function(aj,an,af,am){var ap=this,ai=ap[ab],aq=an[ac],ak=0,ae,ag=0,ah=function(){t(ap[u]+"-"+aj)},ao=function(at,ar){ak++;Q[w](ap,k,aj,at,ar);ag+=ar;if(ak===aq){ah();A(ap[u]+"-"+aj+"-"+m);af(aj,ag)}},al=function(ar){ah();am(aj,ar)};A(ap[u]+"-"+aj);while(!!(ae=an[N]())){i[w](ap,ai+ae,ao,al)}},F=function(){var ah=this,aj,af,ae=function(){t(ah[u]+"-"+y)},ag=function(ak,al){if(!aj){aj=E;ae();Q[w](ah,e,ak,al)}},ai=function(ak,al){if(!ah.quit){if(ak){Q[w](ah,K,ak,al)}af=ah[q][N]();if(af&&af[ac]){b[w](ah,af[0],af[1],ai,ag)}else{ae();Q[w](ah,d);ah[H]=p}}};if(s()<ah[H]+9999){if(E!==Q[w](ah,o)){setTimeout(F,100)}else{A(ah[u]+"-"+y);ai(aa)}}else{Q[w](ah,e,"*")}},P=(function(){var ae=function(ai){var ah=this,ak,am,al,aj,ag,an;if(!(ah instanceof ae)){throw"LazyJS must be instantiated using the new operator."}if(ai){if(!B(ai)||0===ai[ac]||ai[ac]%2){throw"Configuration must be an Array holding even number of entries."}aj=C(ai)}ah[u]="lazy";ah[ab]="";ah[q]=[];ah[c]={};ah[c][o]=Y;ah[c][k]=Z;ah[c][K]=Z;ah[c][d]=Z;ah[c][e]=J;if(aj){al=aj[ac];for(ag=0;al>ag;){ak=aj[ag++];am=aj[ag++];switch(ak){case"can-start":case"on-progress":case"on-chunk":case"on-success":case"on-error":an=ak.indexOf("-");ak=ak[U](0,an)+ak.charAt(++an).toUpperCase()+ak[U](++an,7);case o:case k:case K:case d:case e:ah[ak](am);break;case u:ah[ak]=am;break;case ab:ah[ak]=am;break;default:if(!B(am)){am=am.split(" ")}ah[I](ak,am)}}aj=L}},af=ae[S];af[o]=function(ag){if(!ag){return this[c][o]}return(this[c][o]=ag)};af[k]=function(ag){if(!ag){return this[c][k]}return(this[c][k]=ag)};af[K]=function(ag){if(!ag){return this[c][K]}return(this[c][K]=ag)};af[d]=function(ag){if(!ag){return this[c][d]}return(this[c][d]=ag)};af[e]=function(ag){if(!ag){return this[c][e]}return(this[c][e]=ag)};af[I]=function(ah,ag){if(!B(ag)){ag=[ag]}if(ag&&ag[ac]){this[q][j]([ah,ag])}};af[h]=function(){var ag=this;if(!ag[q][ac]){ag[c][d]()}else{if(!ag[H]){ag[H]=s();F[w](ag)}}};return ae})();R.LazyJS=P;setTimeout(function(){var ag=/^data-/,am="test",al="nodeName",ai=g[V]("script"),ae=ai[ac],ak=0,ah,an,aj,af=[];do{ah=ai[ak];if(/lazy[\w\._-]*(\.min)?\.js/[am](ah.getAttribute("src"))){aj=ah.attributes;if(1<aj[ac]){for(ak=0;aj[ac]>ak;ak++){ah=aj.item(ak);if(ag[am](ah[al])){an=ah.nodeValue;ah=ah[al][ad](ag,"");if(ah){af[j](ah,an)}}}}ak=ae}}while(ae>++ak);if(0<af[ac]){(new P(af))[h]()}af=L},50)})(window,null);