-
Notifications
You must be signed in to change notification settings - Fork 1
/
lazier.min.js
1 lines (1 loc) · 4.11 KB
/
lazier.min.js
1
var mul_table=[1,57,41,21,203,34,97,73,227,91,149,62,105,45,39,137,241,107,3,173,39,71,65,238,219,101,187,87,81,151,141,133,249,117,221,209,197,187,177,169,5,153,73,139,133,127,243,233,223,107,103,99,191,23,177,171,165,159,77,149,9,139,135,131,253,245,119,231,224,109,211,103,25,195,189,23,45,175,171,83,81,79,155,151,147,9,141,137,67,131,129,251,123,30,235,115,113,221,217,53,13,51,50,49,193,189,185,91,179,175,43,169,83,163,5,79,155,19,75,147,145,143,35,69,17,67,33,65,255,251,247,243,239,59,29,229,113,111,219,27,213,105,207,51,201,199,49,193,191,47,93,183,181,179,11,87,43,85,167,165,163,161,159,157,155,77,19,75,37,73,145,143,141,35,138,137,135,67,33,131,129,255,63,250,247,61,121,239,237,117,29,229,227,225,111,55,109,216,213,211,209,207,205,203,201,199,197,195,193,48,190,47,93,185,183,181,179,178,176,175,173,171,85,21,167,165,41,163,161,5,79,157,78,154,153,19,75,149,74,147,73,144,143,71,141,140,139,137,17,135,134,133,66,131,65,129,1],shg_table=[0,9,10,10,14,12,14,14,16,15,16,15,16,15,15,17,18,17,12,18,16,17,17,19,19,18,19,18,18,19,19,19,20,19,20,20,20,20,20,20,15,20,19,20,20,20,21,21,21,20,20,20,21,18,21,21,21,21,20,21,17,21,21,21,22,22,21,22,22,21,22,21,19,22,22,19,20,22,22,21,21,21,22,22,22,18,22,22,21,22,22,23,22,20,23,22,22,23,23,21,19,21,21,21,23,23,23,22,23,23,21,23,22,23,18,22,23,20,22,23,23,23,21,22,20,22,21,22,24,24,24,24,24,22,21,24,23,23,24,21,24,23,24,22,24,24,22,24,24,22,23,24,24,24,20,23,22,23,24,24,24,24,24,24,24,23,21,23,22,23,24,24,24,22,24,24,24,23,22,24,24,25,23,25,25,23,24,25,25,24,22,25,25,25,24,23,24,25,25,25,25,25,25,25,25,25,25,25,25,23,25,23,24,25,25,25,25,25,25,25,25,25,24,22,25,25,23,25,25,20,24,25,24,25,25,22,24,25,24,25,24,25,25,24,25,25,25,25,22,25,25,25,24,25,24,25,18];function boxBlurCanvasRGBA(e,a,r,t,o,l,n){if(!(isNaN(l)||l<1)){l|=0,isNaN(n)&&(n=1),(n|=0)>3&&(n=3),n<1&&(n=1);var i,c=e.getContext("2d");try{try{i=c.getImageData(a,r,t,o)}catch(e){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"),i=c.getImageData(a,r,t,o)}catch(e){throw alert("Cannot access local image"),new Error("unable to access local image data: "+e)}}}catch(e){throw alert("Cannot access image"),new Error("unable to access image data: "+e)}for(var s,d,u,g,f,m,v,z,y,C,h,B,w,b,P=i.data,S=t-1,q=o-1,I=l+1,L=mul_table[l],k=shg_table[l],A=[],R=[],x=[],N=[],_=[],D=[];n-- >0;){for(w=B=0,m=0;m<o;m++){for(s=P[w]*I,d=P[w+1]*I,u=P[w+2]*I,g=P[w+3]*I,v=1;v<=l;v++)z=w+((v>S?S:v)<<2),s+=P[z++],d+=P[z++],u+=P[z++],g+=P[z];for(f=0;f<t;f++)A[B]=s,R[B]=d,x[B]=u,N[B]=g,0==m&&(_[f]=((z=f+I)<S?z:S)<<2,D[f]=(z=f-l)>0?z<<2:0),y=w+_[f],C=w+D[f],s+=P[y++]-P[C++],d+=P[y++]-P[C++],u+=P[y++]-P[C++],g+=P[y]-P[C],B++;w+=t<<2}for(f=0;f<t;f++){for(s=A[h=f]*I,d=R[h]*I,u=x[h]*I,g=N[h]*I,v=1;v<=l;v++)s+=A[h+=v>q?0:t],d+=R[h],u+=x[h],g+=N[h];for(B=f<<2,m=0;m<o;m++)P[B+3]=b=g*L>>>k,b>0?(b=255/b,P[B]=(s*L>>>k)*b,P[B+1]=(d*L>>>k)*b,P[B+2]=(u*L>>>k)*b):P[B]=P[B+1]=P[B+2]=0,0==f&&(_[m]=((z=m+I)<q?z:q)*t,D[m]=(z=m-l)>0?z*t:0),y=f+_[m],C=f+D[m],s+=A[y]-A[C],d+=R[y]-R[C],u+=x[y]-x[C],g+=N[y]-N[C],B+=t<<2}}c.putImageData(i,a,r)}}for(var lazierSmallProcess=function(e){var a=e.querySelector(".lazierLowFy");a.src=a.dataset.src,a.onload=function(){a.classList.add("loaded")}},lazierCanvasProcess=function(e){var a=e.querySelector(".lazierCanvas"),r=a.getContext("2d"),t=e.querySelector(".lazierLowFy"),o=new Image;o.src=t.dataset.src,o.onload=function(){var e=a.width,t=a.height;r.drawImage(o,0,0,e,t),boxBlurCanvasRGBA(a,0,0,e,t,20,1)}},lazierBigProcess=function(e){var a=e.querySelector(".lazierRender");a.src=a.dataset.src,a.onload=function(){a.classList.add("loaded")}},lazierContainers=document.querySelectorAll(".lazierContainer"),i=0;i<lazierContainers.length;i++)lazierCanvasProcess(lazierContainers.item(i));var lazierBigBckgProcess=function(e){var a=e.querySelector(".lazierBackgroundRender");a.style.backgroundImage='url("'+a.dataset.src+'")',a.onload=function(){a.classList.add("loaded")},a.classList.remove("blur")};window.onload=function(){for(var e=document.querySelectorAll(".lazierContainer"),a=document.querySelectorAll(".lazierBackgroundContainer"),r=0;r<e.length;r++)lazierBigProcess(e.item(r));for(r=0;r<a.length;r++)lazierBigBckgProcess(a.item(r))};