diff --git a/ajax/libs/rainyday.js/0.1.1/rainyday.min.js b/ajax/libs/rainyday.js/0.1.1/rainyday.min.js new file mode 100644 index 000000000..8116b85ba --- /dev/null +++ b/ajax/libs/rainyday.js/0.1.1/rainyday.min.js @@ -0,0 +1 @@ +function RainyDay(t,i,e,s,a,r){this.canvasid=t,this.canvas=document.getElementById(t),this.sourceid=i,this.img=document.getElementById(i),this.prepareBackground(r?r:20,e,s),this.w=this.canvas.width,this.h=this.canvas.height,this.prepareGlass(a?a:1),this.reflection||(this.reflection=this.REFLECTION_MINIATURE),this.trail||(this.trail=this.TRAIL_DROPS),this.gravity||(this.gravity=this.GRAVITY_NONE),this.VARIABLE_GRAVITY_THRESHOLD=3,this.VARIABLE_GRAVITY_ANGLE=Math.PI/2,this.VARIABLE_FPS=25,this.VARIABLE_FILL_STYLE="#8ED6FF"}function Drop(t,i,e,s,a){this.x=Math.floor(i),this.y=Math.floor(e),this.r1=Math.random()*a+s,this.rainyday=t;var r=4;this.r2=.8*this.r1,this.linepoints=t.getLinepoints(r),this.context=t.context,this.reflection=t.reflected}function BlurStack(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}RainyDay.prototype.prepareReflections=function(){this.reflected=document.createElement("canvas"),this.reflected.width=this.canvas.width,this.reflected.height=this.canvas.height;var t=this.reflected.getContext("2d");t.translate(this.reflected.width/2,this.reflected.height/2),t.rotate(Math.PI),t.drawImage(this.img,-this.reflected.width/2,-this.reflected.height/2,this.reflected.width,this.reflected.height)},RainyDay.prototype.prepareGlass=function(t){this.glass=document.createElement("canvas"),this.glass.width=this.canvas.width,this.glass.height=this.canvas.height,this.glass.style.position="absolute",this.glass.style.top=this.canvas.offsetTop,this.glass.style.left=this.canvas.offsetLeft,this.glass.style.zIndex=this.canvas.style.zIndex+100,this.canvas.parentNode.appendChild(this.glass),this.context=this.glass.getContext("2d"),this.glass.style.opacity=t},RainyDay.prototype.preset=function(t,i,e){return{min:t,base:i,quan:e}},RainyDay.prototype.rain=function(t,i){if(this.reflection!=this.REFLECTION_NONE&&this.prepareReflections(),i>0)this.presets=t,this.PRIVATE_GRAVITY_FORCE_FACTOR_Y=.005*this.VARIABLE_FPS/25,this.PRIVATE_GRAVITY_FORCE_FACTOR_X=.005*(Math.PI/2-this.VARIABLE_GRAVITY_ANGLE)*this.VARIABLE_FPS/50,setInterval(function(i){return function(){for(var e,s=Math.random(),a=0;athis.VARIABLE_GRAVITY_THRESHOLD&&t.animate()},RainyDay.prototype.getLinepoints=function(t){var i={};i.first={x:0,y:1};var e,s,a,r,n,h={x:1,y:1},o=1,y=1;i.first.next=h;for(var l=0;t>l;l++)for(e=i.first;null!=e.next;){s=e.next,a=s.x-e.x,r=.5*(e.x+s.x),n=.5*(e.y+s.y),n+=a*(2*Math.random()-1);var c={x:r,y:n};o>n?o=n:n>y&&(y=n),c.next=s,e.next=c,e=s}if(y!=o){var R=1/(y-o);for(e=i.first;null!=e;)e.y=R*(e.y-o),e=e.next}else for(e=i.first;null!=e;)e.y=1,e=e.next;return i},Drop.prototype.draw=function(){var t,i,e,s,a,r=0;for(this.context.save(),this.context.beginPath(),t=this.linepoints.first,e=r,i=this.r2+.5*Math.random()*(this.r2-this.r1),s=this.x+i*Math.cos(e),a=this.y+i*Math.sin(e),this.context.lineTo(s,a);null!=t.next;)t=t.next,e=2*Math.PI*t.x+r,i=this.r2+.5*Math.random()*(this.r2-this.r1),s=this.x+i*Math.cos(e),a=this.y+i*Math.sin(e),this.context.lineTo(s,a);this.context.clip(),this.rainyday.reflection&&this.rainyday.reflection(this),this.context.restore()},Drop.prototype.clear=function(){return this.y-this.r1>this.rainyday.h?(clearInterval(this.intid),!0):this.x-this.r1>this.rainyday.w||this.x+this.r1<0?(clearInterval(this.intid),!0):(this.context.clearRect(this.x-this.r1-1,this.y-this.r1-1,2*this.r1+2,2*this.r1+2),!1)},Drop.prototype.animate=function(){this.intid=setInterval(function(t){return function(){if(t.rainyday.gravity){var i=t.rainyday.gravity(t);!i&&t.rainyday.trail&&t.rainyday.trail(t)}}}(this),Math.floor(1e3/this.rainyday.VARIABLE_FPS))},RainyDay.prototype.TRAIL_NONE=function(){},RainyDay.prototype.TRAIL_DROPS=function(t){(!t.trail_y||t.y-t.trail_y>=10*Math.random()*t.r1)&&(t.trail_y=t.y,this.putDrop(new Drop(this,t.x,t.y-t.r1-5,0,Math.ceil(t.r1/5))))},RainyDay.prototype.GRAVITY_NONE=function(){return!0},RainyDay.prototype.GRAVITY_LINEAR=function(t){return t.clear()?!0:(t.yspeed?(t.yspeed+=this.PRIVATE_GRAVITY_FORCE_FACTOR_Y*Math.floor(t.r1),t.xspeed+=this.PRIVATE_GRAVITY_FORCE_FACTOR_X*Math.floor(t.r1)):(t.yspeed=this.PRIVATE_GRAVITY_FORCE_FACTOR_Y,t.xspeed=this.PRIVATE_GRAVITY_FORCE_FACTOR_X),t.y+=t.yspeed,t.draw(),!1)},RainyDay.prototype.GRAVITY_NON_LINEAR=function(t){return t.clear()?!0:((!t.seed||t.seed<0)&&(t.seed=Math.floor(Math.random()*this.VARIABLE_FPS),t.skipping=0==t.skipping?!0:!1,t.slowing=!0),t.seed--,t.yspeed?t.slowing?(t.yspeed/=1.1,t.xspeed/=1.1,t.yspeedt||this.stackBlurCanvasRGB(0,0,i,e,t)},RainyDay.prototype.stackBlurCanvasRGB=function(t,i,e,s,a){a|=0;var r,n,h,o,y,l,c,R,p,d,f,_,A,I,g,x,E,u,T,v,V=this.canvas.getContext("2d"),O=V.getImageData(t,i,e,s),F=O.data,C=a+a+1,m=e-1,D=s-1,L=a+1,w=L*(L+1)/2,M=new BlurStack,Y=M;for(h=1;C>h;h++)if(Y=Y.next=new BlurStack,h==L)var G=Y;Y.next=M;var N=null,P=null;c=l=0;var B=mul_table[a],b=shg_table[a];for(n=0;s>n;n++){for(I=g=x=R=p=d=0,f=L*(E=F[l]),_=L*(u=F[l+1]),A=L*(T=F[l+2]),R+=w*E,p+=w*u,d+=w*T,Y=M,h=0;L>h;h++)Y.r=E,Y.g=u,Y.b=T,Y=Y.next;for(h=1;L>h;h++)o=l+((h>m?m:h)<<2),R+=(Y.r=E=F[o])*(v=L-h),p+=(Y.g=u=F[o+1])*v,d+=(Y.b=T=F[o+2])*v,I+=E,g+=u,x+=T,Y=Y.next;for(N=M,P=G,r=0;e>r;r++)F[l]=R*B>>b,F[l+1]=p*B>>b,F[l+2]=d*B>>b,R-=f,p-=_,d-=A,f-=N.r,_-=N.g,A-=N.b,o=c+((o=r+a+1)r;r++){for(g=x=I=p=d=R=0,l=r<<2,f=L*(E=F[l]),_=L*(u=F[l+1]),A=L*(T=F[l+2]),R+=w*E,p+=w*u,d+=w*T,Y=M,h=0;L>h;h++)Y.r=E,Y.g=u,Y.b=T,Y=Y.next;for(y=e,h=1;a>=h;h++)l=y+r<<2,R+=(Y.r=E=F[l])*(v=L-h),p+=(Y.g=u=F[l+1])*v,d+=(Y.b=T=F[l+2])*v,I+=E,g+=u,x+=T,Y=Y.next,D>h&&(y+=e);for(l=r,N=M,P=G,n=0;s>n;n++)o=l<<2,F[o]=R*B>>b,F[o+1]=p*B>>b,F[o+2]=d*B>>b,R-=f,p-=_,d-=A,f-=N.r,_-=N.g,A-=N.b,o=r+((o=n+L)=d;d++){this.matrix[d]=new Array(b);for(var e=0;b+5>=e;++e)this.matrix[d][e]=new DropItem(null)}}function DropItem(a){this.drop=a,this.next=null}RainyDay.prototype.prepareCanvas=function(){var a=document.createElement("canvas");return a.style.position=this.options.position,a.style.top=this.options.top,a.style.left=this.options.left,a.width=this.options.width,a.height=this.options.height,this.options.parentElement.appendChild(a),this.enableSizeChange&&this.setResizeHandler(),a},RainyDay.prototype.setResizeHandler=function(){null!==window.onresize?window.setInterval(this.checkSize.bind(this),100):(window.onresize=this.checkSize.bind(this),window.onorientationchange=this.checkSize.bind(this))},RainyDay.prototype.checkSize=function(){var a=this.img.clientWidth,b=this.img.clientHeight,c=this.img.offsetLeft,d=this.img.offsetTop,e=this.canvas.width,f=this.canvas.height,g=this.canvas.offsetLeft,h=this.canvas.offsetTop;(e!==a||f!==b)&&(this.canvas.width=this.canvas.width,this.canvas.height=this.canvas.height,this.prepareBackground(this.canvas.width,this.canvas.height),this.glass.width=this.canvas.width,this.glass.height=this.canvas.height,this.prepareReflections()),(g!==c||h!==d)&&(this.canvas.offsetLeft=c,this.canvas.offsetTop=d)},RainyDay.prototype.animateDrops=function(){this.addDropCallback&&this.addDropCallback();for(var a=this.drops.slice(),b=[],c=0;cc&&(c=Math.floor(a[d][0]+a[d][1]));if(c>0){var e=Math.ceil(this.canvas.width/c),f=Math.ceil(this.canvas.height/c);this.matrix=new CollisionMatrix(e,f,c)}else this.options.enableCollisions=!1}for(var d=0;dc-g)){g=c;var d=this.canvas.getContext("2d");d.clearRect(0,0,this.canvas.width,this.canvas.height),d.drawImage(this.background,0,0,this.canvas.width,this.canvas.height);for(var e,f=0;f1||-1===a[f][3]){if(0!==a[f][3]){a[f][3]--;for(var h=0;hthis.options.gravityThreshold&&(this.options.enableCollisions&&this.matrix.update(a),this.drops.push(a))},RainyDay.prototype.clearDrop=function(a,b){var c=a.clear(b);if(c){var d=this.drops.indexOf(a);d>=0&&this.drops.splice(d,1)}return c},Drop.prototype.draw=function(){this.context.save(),this.context.beginPath();var a=this.r;if(this.r=.95*this.r,this.r<3)this.context.arc(this.x,this.y,this.r,0,2*Math.PI,!0),this.context.closePath();else if(this.colliding||this.yspeed>2){if(this.colliding){var b=this.colliding;this.r=1.001*(this.r>b.r?this.r:b.r),this.x+=b.x-this.x,this.colliding=null}var c=1+.1*this.yspeed;this.context.moveTo(this.x-this.r/c,this.y),this.context.bezierCurveTo(this.x-this.r,this.y-2*this.r,this.x+this.r,this.y-2*this.r,this.x+this.r/c,this.y),this.context.bezierCurveTo(this.x+this.r,this.y+c*this.r,this.x-this.r,this.y+c*this.r,this.x-this.r/c,this.y)}else this.context.arc(this.x,this.y,.9*this.r,0,2*Math.PI,!0),this.context.closePath();this.context.clip(),this.r=a,this.rainyday.reflection&&this.rainyday.reflection(this),this.context.restore()},Drop.prototype.clear=function(a){return this.context.clearRect(this.x-this.r-1,this.y-this.r-2,2*this.r+2,2*this.r+2),a?(this.terminate=!0,!0):this.y-this.r>this.rainyday.h||this.x-this.r>this.rainyday.w||this.x+this.r<0?!0:!1},Drop.prototype.animate=function(){if(this.terminate)return!1;var a=this.rainyday.gravity(this);if(!a&&this.rainyday.trail&&this.rainyday.trail(this),this.rainyday.options.enableCollisions){var b=this.rainyday.matrix.update(this,a);b&&this.rainyday.collision(this,b)}return!a||this.terminate},RainyDay.prototype.TRAIL_NONE=function(){},RainyDay.prototype.TRAIL_DROPS=function(a){(!a.trailY||a.y-a.trailY>=100*Math.random()*a.r)&&(a.trailY=a.y,this.putDrop(new Drop(this,a.x+(2*Math.random()-1)*Math.random(),a.y-a.r-5,Math.ceil(a.r/5),0)))},RainyDay.prototype.TRAIL_SMUDGE=function(a){var b=a.y-a.r-3,c=a.x-a.r/2+2*Math.random();0>b||0>c||this.context.drawImage(this.clearbackground,c,b,a.r,2,c,b,a.r,2)},RainyDay.prototype.GRAVITY_NONE=function(){return!0},RainyDay.prototype.GRAVITY_LINEAR=function(a){return this.clearDrop(a)?!0:(a.yspeed?(a.yspeed+=this.PRIVATE_GRAVITY_FORCE_FACTOR_Y*Math.floor(a.r),a.xspeed+=this.PRIVATE_GRAVITY_FORCE_FACTOR_X*Math.floor(a.r)):(a.yspeed=this.PRIVATE_GRAVITY_FORCE_FACTOR_Y,a.xspeed=this.PRIVATE_GRAVITY_FORCE_FACTOR_X),a.y+=a.yspeed,a.draw(),!1)},RainyDay.prototype.GRAVITY_NON_LINEAR=function(a){return this.clearDrop(a)?!0:(a.collided?(a.collided=!1,a.seed=Math.floor(a.r*Math.random()*this.options.fps),a.skipping=!1,a.slowing=!1):(!a.seed||a.seed<0)&&(a.seed=Math.floor(a.r*Math.random()*this.options.fps),a.skipping=a.skipping===!1?!0:!1,a.slowing=!0),a.seed--,a.yspeed?a.slowing?(a.yspeed/=1.1,a.xspeed/=1.1,a.yspeeda?0>=a?b:a:0>=b?a:b,0>=c?1:c},RainyDay.prototype.REFLECTION_NONE=function(){this.context.fillStyle=this.options.fillStyle,this.context.fill()},RainyDay.prototype.REFLECTION_MINIATURE=function(a){var b=Math.max((a.x-this.options.reflectionDropMappingWidth)/this.options.reflectionScaledownFactor,0),c=Math.max((a.y-this.options.reflectionDropMappingHeight)/this.options.reflectionScaledownFactor,0),d=this.positiveMin(2*this.options.reflectionDropMappingWidth/this.options.reflectionScaledownFactor,this.reflected.width-b),e=this.positiveMin(2*this.options.reflectionDropMappingHeight/this.options.reflectionScaledownFactor,this.reflected.height-c),f=Math.max(a.x-1.1*a.r,0),g=Math.max(a.y-1.1*a.r,0);this.context.drawImage(this.reflected,b,c,d,e,f,g,2*a.r,2*a.r)},RainyDay.prototype.COLLISION_SIMPLE=function(a,b){for(var c,d=b;null!=d;){var e=d.drop;if(Math.sqrt(Math.pow(a.x-e.x,2)+Math.pow(a.y-e.y,2))c.y?(f=a,g=c):(f=c,g=a),this.clearDrop(g),this.clearDrop(f,!0),this.matrix.remove(f),g.draw(),g.colliding=f,g.collided=!0}},RainyDay.prototype.prepareBackground=function(){this.background=document.createElement("canvas"),this.background.width=this.canvas.width,this.background.height=this.canvas.height,this.clearbackground=document.createElement("canvas"),this.clearbackground.width=this.canvas.width,this.clearbackground.height=this.canvas.height;var a=this.background.getContext("2d");a.clearRect(0,0,this.canvas.width,this.canvas.height),a.drawImage(this.img,this.options.crop[0],this.options.crop[1],this.options.crop[2],this.options.crop[3],0,0,this.canvas.width,this.canvas.height),a=this.clearbackground.getContext("2d"),a.clearRect(0,0,this.canvas.width,this.canvas.height),a.drawImage(this.img,this.options.crop[0],this.options.crop[1],this.options.crop[2],this.options.crop[3],0,0,this.canvas.width,this.canvas.height),!isNaN(this.options.blur)&&this.options.blur>=1&&this.stackBlurCanvasRGB(this.canvas.width,this.canvas.height,this.options.blur)},RainyDay.prototype.stackBlurCanvasRGB=function(a,b,c){var d=[[0,9],[1,11],[2,12],[3,13],[5,14],[7,15],[11,16],[15,17],[22,18],[31,19],[45,20],[63,21],[90,22],[127,23],[181,24]],e=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259];c|=0;var f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z=this.background.getContext("2d"),A=z.getImageData(0,0,a,b),B=A.data,C=c+1,D=C*(C+1)/2,E=new BlurStack,F=new BlurStack,G=E;for(h=1;2*c+1>h;h++)G=G.next=new BlurStack,h===C&&(F=G);G.next=E;var H=null,I=null;l=k=0;for(var J,K=e[c],L=0;Lg;g++){for(s=t=u=m=n=o=0,p=C*(v=B[k]),q=C*(w=B[k+1]),r=C*(x=B[k+2]),m+=D*v,n+=D*w,o+=D*x,G=E,h=0;C>h;h++)G.r=v,G.g=w,G.b=x,G=G.next;for(h=1;C>h;h++)i=k+((h>a-1?a-1:h)<<2),m+=(G.r=v=B[i])*(y=C-h),n+=(G.g=w=B[i+1])*y,o+=(G.b=x=B[i+2])*y,s+=v,t+=w,u+=x,G=G.next;for(H=E,I=F,f=0;a>f;f++)B[k]=m*K>>J,B[k+1]=n*K>>J,B[k+2]=o*K>>J,m-=p,n-=q,o-=r,p-=H.r,q-=H.g,r-=H.b,i=l+((i=f+c+1)f;f++){for(t=u=s=n=o=m=0,k=f<<2,p=C*(v=B[k]),q=C*(w=B[k+1]),r=C*(x=B[k+2]),m+=D*v,n+=D*w,o+=D*x,G=E,h=0;C>h;h++)G.r=v,G.g=w,G.b=x,G=G.next;for(j=a,h=1;C>h;h++)k=j+f<<2,m+=(G.r=v=B[k])*(y=C-h),n+=(G.g=w=B[k+1])*y,o+=(G.b=x=B[k+2])*y,s+=v,t+=w,u+=x,G=G.next,b-1>h&&(j+=a);for(k=f,H=E,I=F,g=0;b>g;g++)i=k<<2,B[i]=m*K>>J,B[i+1]=n*K>>J,B[i+2]=o*K>>J,m-=p,n-=q,o-=r,p-=H.r,q-=H.g,r-=H.b,i=f+((i=g+C)0&&c>0&&b0)this.presets=t,setInterval(function(i){return function(){for(var a,n=Math.random(),s=0;sl;l++)for(a=i.first;null!=a.next;){n=a.next,s=n.x-a.x,e=.5*(a.x+n.x),r=.5*(a.y+n.y),r+=s*(2*Math.random()-1);var c={x:e,y:r};o>r?o=r:r>y&&(y=r),c.next=n,a.next=c,a=n}if(y!=o){var p=1/(y-o);for(a=i.first;null!=a;)a.y=p*(a.y-o),a=a.next}else for(a=i.first;null!=a;)a.y=1,a=a.next;return i},Drop.prototype.draw=function(){var t,i,a,n,s,e=0;for(this.context.save(),this.context.beginPath(),t=this.linepoints.first,a=e,i=this.r2+t.y*(this.r1-this.r2),n=this.x+i*Math.cos(a),s=this.y+i*Math.sin(a),this.context.lineTo(n,s);null!=t.next;)t=t.next,a=2*Math.PI*t.x+e,i=this.r2+t.y*(this.r1-this.r2),n=this.x+i*Math.cos(a),s=this.y+i*Math.sin(a),this.context.lineTo(n,s);this.context.clip(),this.rainyday.reflection&&this.rainyday.reflection(this),this.context.restore()},Drop.prototype.animate=function(){this.intid=setInterval(function(t){return function(){if(t.rainyday.gravity){var i=t.rainyday.gravity(t);i||t.rainyday.trail&&t.rainyday.trail(t)}}}(this),10)},RainyDay.prototype.TRAIL_DROPS=function(t){(!t.trail_y||t.y-t.trail_y>=10*Math.random()*t.r1)&&(t.trail_y=t.y,this.putDrop(new Drop(this,t.x,t.y-t.r1-5,0,Math.ceil(t.r1/5))))},RainyDay.prototype.GRAVITY_SIMPLE=function(t){return t.r1<3?(clearInterval(t.intid),!0):(this.context.clearRect(t.x-t.r1-1,t.y-t.r1-1,2*t.r1+2,2*t.r1+2),t.y-t.r1>this.glass.height?(clearInterval(t.intid),!0):(t.speed?t.speed+=.005*Math.floor(t.r1):t.speed=.1,t.y+=t.speed,t.draw(),!1))},RainyDay.prototype.REFLECTION_NONE=function(){this.context.fillStyle="#8ED6FF",this.context.fill()},RainyDay.prototype.REFLECTION_HQ=function(t){var i=t.x*this.mini.width/this.glass.width,a=t.y*this.mini.height/this.glass.height,n=10*t.r1,s=10*t.r1;this.context.drawImage(this.mini,0>i-n?0:i-n,0>a-s?0:a-s,2*n,2*s,t.x-t.r1,t.y-t.r1,2*t.r1,2*t.r1)};var mul_table=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],shg_table=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];RainyDay.prototype.prepareBackground=function(t,i,a){i&&a?(this.canvas.style.width=i+"px",this.canvas.style.height=a+"px",this.canvas.width=i,this.canvas.height=a):(i=this.canvas.width,a=this.canvas.height);var n=this.canvas.getContext("2d");n.clearRect(0,0,i,a),n.drawImage(this.img,0,0,i,a),isNaN(t)||1>t||this.stackBlurCanvasRGB(0,0,i,a,t)},RainyDay.prototype.stackBlurCanvasRGB=function(t,i,a,n,s){s|=0;var e,r,h,o,y,l,c,p,g,f,d,u,x,v,m,w,D,R,b,M,I=this.canvas.getContext("2d"),B=I.getImageData(t,i,a,n),E=B.data,_=s+s+1,C=a-1,k=n-1,L=s+1,N=L*(L+1)/2,T=new BlurStack,S=T;for(h=1;_>h;h++)if(S=S.next=new BlurStack,h==L)var G=S;S.next=T;var P=null,F=null;c=l=0;var O=mul_table[s],q=shg_table[s];for(r=0;n>r;r++){for(v=m=w=p=g=f=0,d=L*(D=E[l]),u=L*(R=E[l+1]),x=L*(b=E[l+2]),p+=N*D,g+=N*R,f+=N*b,S=T,h=0;L>h;h++)S.r=D,S.g=R,S.b=b,S=S.next;for(h=1;L>h;h++)o=l+((h>C?C:h)<<2),p+=(S.r=D=E[o])*(M=L-h),g+=(S.g=R=E[o+1])*M,f+=(S.b=b=E[o+2])*M,v+=D,m+=R,w+=b,S=S.next;for(P=T,F=G,e=0;a>e;e++)E[l]=p*O>>q,E[l+1]=g*O>>q,E[l+2]=f*O>>q,p-=d,g-=u,f-=x,d-=P.r,u-=P.g,x-=P.b,o=c+((o=e+s+1)e;e++){for(m=w=v=g=f=p=0,l=e<<2,d=L*(D=E[l]),u=L*(R=E[l+1]),x=L*(b=E[l+2]),p+=N*D,g+=N*R,f+=N*b,S=T,h=0;L>h;h++)S.r=D,S.g=R,S.b=b,S=S.next;for(y=a,h=1;s>=h;h++)l=y+e<<2,p+=(S.r=D=E[l])*(M=L-h),g+=(S.g=R=E[l+1])*M,f+=(S.b=b=E[l+2])*M,v+=D,m+=R,w+=b,S=S.next,k>h&&(y+=a);for(l=e,P=T,F=G,r=0;n>r;r++)o=l<<2,E[o]=p*O>>q,E[o+1]=g*O>>q,E[o+2]=f*O>>q,p-=d,g-=u,f-=x,d-=P.r,u-=P.g,x-=P.b,o=e+((o=r+L)