333 lines
13 KiB
Plaintext
333 lines
13 KiB
Plaintext
Type.registerNamespace("Telerik.Web.UI.Animations");
|
|
(function(){var b=$telerik.$;
|
|
var a=Telerik.Web.UI;
|
|
a.Animations.playJQueryAnimation=function(d,e,n,p,o,f,q,k,c){if(!d){return;
|
|
}if(!e){e=2;
|
|
}if(!n){n=new Sys.UI.Bounds(1,1,1,1);
|
|
}if(!p){p=new Sys.UI.Bounds(1,1,1,1);
|
|
}var h=k?k:500;
|
|
if(!o){o=32;
|
|
}o+="";
|
|
var g=parseInt(o.substr(0,1));
|
|
var l=parseInt(o.substr(1,1));
|
|
if(f){f();
|
|
}b(d).stop(false,true);
|
|
if(e==2){b(d).css({left:p.x,top:p.y}).fadeIn(h,q);
|
|
return;
|
|
}if(e==8){var j=$telerik.getClientBounds();
|
|
var m=$telerik.getClientBounds();
|
|
n.x=m.width/2;
|
|
n.y=m.height;
|
|
switch(l){case 2:n.x=p.x;
|
|
break;
|
|
case 3:n.x=j.width;
|
|
break;
|
|
case 1:n.x=j.x;
|
|
}switch(g){case 2:n.y=p.y;
|
|
break;
|
|
case 1:n.y=j.y-p.height;
|
|
break;
|
|
case 3:n.y=j.height;
|
|
}}else{if(e==4){n.x=p.x;
|
|
n.y=p.y;
|
|
n.width=p.width;
|
|
n.height=1;
|
|
switch(l){case 2:n.x=p.x;
|
|
break;
|
|
case 3:n.x=p.x;
|
|
break;
|
|
case 1:var i=p.x;
|
|
if(2==g){i+=p.width;
|
|
}n.x=i;
|
|
}switch(g){case 2:n.y=p.y;
|
|
n.height=p.height;
|
|
n.width=1;
|
|
break;
|
|
case 1:n.y=p.y+p.height;
|
|
break;
|
|
case 3:n.y=p.y;
|
|
}}else{if(e==1){}}}b(d).css({width:n.width,height:n.height,left:n.x,top:n.y,opacity:0.1,filter:"alpha(opacity=10)"}).show().animate({width:p.width,height:p.height,left:p.x,top:p.y,opacity:c?c:1},h,null,q);
|
|
};
|
|
b.fx.prototype.oldstep=b.fx.prototype.step;
|
|
b.fx.prototype.step=function(e){var d=this.prop;
|
|
if(d=="left"||d=="top"||d=="telerikCarouselAngle"||d=="telerikCoverFlowIndex"){if(this.elem.getAttribute("paused")){if(!this.elem.getAttribute("elapsedTime")){var c=(+new Date)-this.startTime;
|
|
this.elem.setAttribute("elapsedTime",c);
|
|
}return true;
|
|
}if(this.elem.getAttribute("elapsedTime")){this.startTime=(+new Date)-this.elem.getAttribute("elapsedTime");
|
|
this.elem.removeAttribute("elapsedTime");
|
|
}}return this.oldstep(e);
|
|
};
|
|
a.Animations.jMoveBase=function(c,d,e,f){a.Animations.jMoveBase.initializeBase(this);
|
|
this._owner=c;
|
|
this._element=d;
|
|
this._duration=e;
|
|
this._events=null;
|
|
this._animationEndedDelegate=null;
|
|
this._isPlaying=false;
|
|
this._isPaused=false;
|
|
this._isCyclic=false;
|
|
this._easing=f;
|
|
this._isDisposed=false;
|
|
};
|
|
a.Animations.jMoveBase.prototype={initialize:function(){a.Animations.jMoveBase.callBaseMethod(this,"initialize");
|
|
this._animationEndedDelegate=Function.createDelegate(this,this._animationEnded);
|
|
},dispose:function(){if(this._isDisposed){return;
|
|
}this._getAnimationQuery().stop(true,false);
|
|
this._owner=null;
|
|
this._element=null;
|
|
this._animationEndedDelegate=null;
|
|
a.Animations.jMoveBase.callBaseMethod(this,"dispose");
|
|
this._isDisposed=true;
|
|
},get_isPlaying:function(){return this._isPlaying;
|
|
},get_isCyclic:function(){return this._isCyclic;
|
|
},set_isCyclic:function(c){this._isCyclic=c;
|
|
},get_easing:function(){return this._easing;
|
|
},set_easing:function(c){this._easing=c;
|
|
},get_duration:function(){return this._duration;
|
|
},set_duration:function(c){this._duration=c;
|
|
},get_isActive:function(){return true;
|
|
},play:function(c){var h=this._getAnimationQuery().filter("[paused='true']");
|
|
var e=h.attr("paused");
|
|
h.removeAttr("paused");
|
|
if(e&&h.attr("elapsedTime")){this._isPlaying=true;
|
|
this._isPaused=false;
|
|
}else{var f=this._owner;
|
|
var g=f.get_frameDuration();
|
|
if(this._isPaused&&this._isCyclic&&(g>0&&!c)&&f._setAnimationTimeout){f._setAnimationTimeout(g);
|
|
}else{var d=this._animationStarted();
|
|
if(d!=false){this._playAnimation();
|
|
this._isPlaying=true;
|
|
this._isPaused=false;
|
|
}}}},stop:function(){this._getAnimationQuery().stop(false,this._isPlaying);
|
|
this._isPlaying=false;
|
|
},pause:function(){if(this._isPlaying){this._getAnimationQuery().filter(":animated").attr("paused",true);
|
|
}this._isPlaying=false;
|
|
this._isPaused=true;
|
|
},add_started:function(c){this.get_events().addHandler("started",c);
|
|
},remove_started:function(c){this.get_events().removeHandler("started",c);
|
|
},add_ended:function(c){this.get_events().addHandler("ended",c);
|
|
},remove_ended:function(c){this.get_events().removeHandler("ended",c);
|
|
},_getAnimationQuery:function(){return b(this._element);
|
|
},_playAnimation:function(){},_animationStarted:function(){var c=new Sys.CancelEventArgs();
|
|
this._raiseEvent("started",c);
|
|
return !c.get_cancel();
|
|
},_animationEnded:function(){this._isPlaying=false;
|
|
this._raiseEvent("ended",Sys.EventArgs.Empty);
|
|
},_raiseEvent:function(d,e){var c=this.get_events().getHandler(d);
|
|
if(c){if(!e){e=Sys.EventArgs.Empty;
|
|
}c(this,e);
|
|
}}};
|
|
a.Animations.jMoveBase.registerClass("Telerik.Web.UI.Animations.jMoveBase",Sys.Component);
|
|
a.Animations.jMove=function(f,c,e,h,g,d){a.Animations.jMove.initializeBase(this,[f,c,e,d]);
|
|
this._horizontal=(typeof(h)=="undefined"||h==null)?0:h;
|
|
this._vertical=(typeof(g)=="undefined"||g==null)?0:g;
|
|
};
|
|
a.Animations.jMove.prototype={initialize:function(){a.Animations.jMove.callBaseMethod(this,"initialize");
|
|
},dispose:function(){a.Animations.jMove.callBaseMethod(this,"dispose");
|
|
},get_vertical:function(){return this._vertical;
|
|
},set_vertical:function(c){this._vertical=c;
|
|
},get_horizontal:function(){return this._horizontal;
|
|
},set_horizontal:function(c){this._horizontal=c;
|
|
},_getFinalPosition:function(){return(isNaN(parseInt(this._vertical)))?this._horizontal:this._vertical;
|
|
},_getAnimatedProperty:function(){return(isNaN(parseInt(this._vertical)))?"left":"top";
|
|
},_getPosition:function(){return this._element.style[this._getAnimatedProperty()];
|
|
},_playAnimation:function(){var d=this._getFinalPosition();
|
|
var e=this._getAnimationQuery();
|
|
var f=this._getAnimatedProperty();
|
|
var c={queue:true};
|
|
c[f]=d;
|
|
e.stop(true,!this._isCyclic).animate(c,this._duration,this._easing,this._animationEndedDelegate);
|
|
}};
|
|
a.Animations.jMove.registerClass("Telerik.Web.UI.Animations.jMove",a.Animations.jMoveBase);
|
|
a.Animations.jCarousel=function(f,c,h,e,d,g,i){a.Animations.jCarousel.initializeBase(this,[f,c,e,i]);
|
|
this._items=h;
|
|
this._minScale=d.minScale;
|
|
this._x=d.xO;
|
|
this._y=d.yO;
|
|
this._xRadius=d.xR;
|
|
this._yRadius=d.yR;
|
|
this._customProperties=g;
|
|
this._angle=Math.PI/2;
|
|
this._query=null;
|
|
};
|
|
a.Animations.jCarousel.prototype={initialize:function(){a.Animations.jCarousel.callBaseMethod(this,"initialize");
|
|
},dispose:function(){a.Animations.jCarousel.callBaseMethod(this,"dispose");
|
|
this._items=null;
|
|
this._customProperties=null;
|
|
this._query=null;
|
|
},get_angle:function(){return this._angle;
|
|
},set_angle:function(c){this._angle=c;
|
|
},_getFinalPosition:function(){return this._angle;
|
|
},_getAnimatedProperty:function(){return"telerikCarouselAngle";
|
|
},_getAnimationQuery:function(){var c=this._query;
|
|
if(!c){b.each(this._items,function(e,d){var f=this.element;
|
|
if(!c){c=b(f);
|
|
}else{c=c.add(f);
|
|
}});
|
|
this._query=c;
|
|
}return c;
|
|
},_playAnimation:function(){this._getAnimationQuery().stop(true,!this._isCyclic);
|
|
var e=this._items;
|
|
var f=(e.length>0)?((Math.PI*2)/e.length):0;
|
|
var d=this._angle;
|
|
var c=this;
|
|
b.each(e,function(g,h){if(d.toString().indexOf("e")>-1){d=(Math.round(d*10000)/10000);
|
|
}b(this.element).stop(true,false).animate({queue:true,telerikCarouselAngle:d},{xO:c._x,yO:c._y,xR:c._xRadius,yR:c._yRadius,minScale:c._minScale,reflection:this.reflection,width:this.width,height:this.height,outerWidth:this.outerWidth,outerHeight:this.outerHeight,customProperties:c._customProperties,duration:c._duration,easing:c._easing,complete:c._animationEndedDelegate});
|
|
d+=f;
|
|
});
|
|
}};
|
|
a.Animations.jCarousel.registerClass("Telerik.Web.UI.Animations.jCarousel",a.Animations.jMoveBase);
|
|
b.fx.step.telerikCarouselAngle=function(h){var m=h.now;
|
|
var n=h.options;
|
|
var e=Math.sin(m);
|
|
var g=n.minScale;
|
|
var i=g+(e+1)*((1-g)/2);
|
|
var c=n.xO+(((Math.cos(m+Math.PI)*n.xR)-n.outerWidth/2)*i);
|
|
var d=n.yO+((e*n.yR)*i);
|
|
h.elem.telerikCarouselAngle=h.now;
|
|
var o=b.extend({},n.customProperties);
|
|
if(n.customProperties){var k=/^([\d+-.]+)(.*)$/;
|
|
b.each(o,function(r,p){var q=k.exec(p);
|
|
if(q){o[r]=q?(q[1]*i+q[2]):p;
|
|
}});
|
|
}var l=!b.support.opacity&&(n.customProperties&&n.customProperties.opacity)&&n.reflection;
|
|
var j="px";
|
|
var f=b.extend(o,{width:n.width*i+j,height:n.height*i*(l?2:1)+j,left:c+j,top:d+j,zIndex:parseInt(i*100)});
|
|
b(h.elem).css("display","none").css(f).css("display","");
|
|
};
|
|
a.Animations.jCoverFlow=function(f,c,h,e,d,g,i){a.Animations.jCoverFlow.initializeBase(this,[f,c,e,i]);
|
|
this._items=h;
|
|
this._minScale=d.minScale;
|
|
this._x=d.xO;
|
|
this._y=d.yO;
|
|
this._xRadius=d.xR;
|
|
this._yRadius=d.yR;
|
|
this._xItemSpacing=d.xItemSpacing;
|
|
this._yItemSpacing=d.yItemSpacing;
|
|
this._selectedItemOffsetX=d.selectedItemOffsetX;
|
|
this._selectedItemOffsetY=d.selectedItemOffsetY;
|
|
this._matrix=d.matrix;
|
|
this._customProperties=g;
|
|
this._index=0;
|
|
this._query=null;
|
|
};
|
|
a.Animations.jCoverFlow.prototype={initialize:function(){a.Animations.jCoverFlow.callBaseMethod(this,"initialize");
|
|
},dispose:function(){a.Animations.jCoverFlow.callBaseMethod(this,"dispose");
|
|
this._items=null;
|
|
this._customProperties=null;
|
|
this._matrix=null;
|
|
this._query=null;
|
|
},get_index:function(){return this._index;
|
|
},set_index:function(c){this._index=c;
|
|
},_getFinalPosition:function(){return this._index;
|
|
},_getAnimatedProperty:function(){return"telerikCoverFlowIndex";
|
|
},_getAnimationQuery:function(){if(!this._query){var f=this._items;
|
|
var e=b();
|
|
for(var c=0,d=f.length;
|
|
c<d;
|
|
c++){e.add(f[c].element);
|
|
}this._query=e;
|
|
}return this._query;
|
|
},_getTransformProperty:function(){var c="transform";
|
|
if($telerik.isIE9Mode){c="msTransform";
|
|
}else{if($telerik.isIE){c="filter";
|
|
}else{if($telerik.isFirefox){c="MozTransform";
|
|
}else{if($telerik.isSafari){c="WebkitTransform";
|
|
}else{if($telerik.isOpera){c="OTransform";
|
|
}}}}}return c;
|
|
},_playAnimation:function(){this._getAnimationQuery().stop(true,!this._isCyclic);
|
|
var j=this._items;
|
|
var c=j.length;
|
|
var f=this._owner.isVertical();
|
|
var k=this._index;
|
|
var d=j[k];
|
|
if(!d){return;
|
|
}var h={top:this._y-d.outerHeight/2,right:this._x+d.outerWidth/2,bottom:this._y+d.outerHeight/2,left:this._x-d.outerWidth/2};
|
|
var g=this._matrix;
|
|
if(g.m11==1&&g.m22==1&&g.m12==0&&g.m21==0){g=null;
|
|
}var i=this._getTransformProperty();
|
|
var l=this;
|
|
var e=$telerik.getContentSize(this._owner._clipElement);
|
|
b.each(j,function(p,A){var K=(p-k);
|
|
var H=(K==0);
|
|
var v=H?1:l._minScale;
|
|
var s=this.element;
|
|
var I=parseInt(s.telerikCoverFlowIndex);
|
|
var F=(I==0);
|
|
var C=F?1:l._minScale;
|
|
var t=(K>0);
|
|
var G=l._x+this.outerWidth/2;
|
|
var n=f?(G-this.outerWidth*v):(h[t?"right":"left"]);
|
|
var r=f?(G-this.outerWidth*C):(h[I>0?"right":"left"]);
|
|
var u=l._y+this.outerHeight/2;
|
|
var o=f?(h[t?"bottom":"top"]):(u-this.outerHeight*v);
|
|
var E=f?(h[I>0?"bottom":"top"]):(u-this.outerHeight*C);
|
|
var J={};
|
|
var z=(F||H);
|
|
if(f||z){J.top={start:E,end:o};
|
|
}if(!f||z){J.left={start:r,end:n};
|
|
}for(var B=0;
|
|
B<2;
|
|
B++){var m=(B==0);
|
|
var D=m?K:I;
|
|
var w=m?v:C;
|
|
if(D>0){if(f){J.top[m?"end":"start"]+=l._yRadius+(--D*l._yItemSpacing);
|
|
}else{J.left[m?"end":"start"]+=l._xRadius+(--D*l._xItemSpacing);
|
|
}}else{if(D<0){if(f){J.top[m?"end":"start"]+=-(l._yRadius+this.outerHeight*w)+(++D*l._yItemSpacing);
|
|
}else{J.left[m?"end":"start"]+=-(l._xRadius+this.outerWidth*w)+(++D*l._xItemSpacing);
|
|
}}else{J.left[m?"end":"start"]+=l._selectedItemOffsetX;
|
|
J.top[m?"end":"start"]+=l._selectedItemOffsetY;
|
|
}}}if(z||((!J.top||((J.top.start>=-this.outerHeight*C&&J.top.start<=e.height)||(J.top.end>=-this.outerHeight*v&&J.top.end<=e.height)))&&(!J.left||((J.left.start>=-this.outerWidth*C&&J.left.start<=e.width)||(J.left.end>=-this.outerWidth*v&&J.left.end<=e.width))))){var q={zIndex:((c-Math.abs(I))*100)};
|
|
if(J.top){q.top=J.top.start+"px";
|
|
}if(J.left){q.left=J.left.start+"px";
|
|
}if(Math.abs(I-K)>1){q.zIndex=((c-Math.abs(K))*100);
|
|
}b(s).stop(true,false).css(q).animate({queue:true,telerikCoverFlowIndex:K},{isVertical:f,animateSize:z,steps:J,minScale:l._minScale,width:this.width,height:this.height,outerWidth:this.outerWidth,outerHeight:this.outerHeight,matrix:g,transformProperty:i,reflection:this.reflection,itemsCount:c,customProperties:l._customProperties,duration:l._duration,easing:l._easing,complete:l._animationEndedDelegate});
|
|
}else{b(s).stop(true,false).attr("telerikCoverFlowIndex",K);
|
|
}});
|
|
}};
|
|
a.Animations.jCoverFlow.registerClass("Telerik.Web.UI.Animations.jCoverFlow",a.Animations.jMoveBase);
|
|
b.fx.step.telerikCoverFlowIndex=function(g){var x=g.now;
|
|
var r=g.options;
|
|
g.elem.telerikCoverFlowIndex=x;
|
|
var i=Math.abs((x-g.start)/(g.end-g.start));
|
|
var k="px";
|
|
var e={};
|
|
if(Math.abs(g.start-g.end)<=1){e.zIndex=parseInt((r.itemsCount-Math.abs(x))*100);
|
|
}var o=0;
|
|
var j=0;
|
|
var t=r.isVertical;
|
|
var f=r.minScale;
|
|
var u=r.animateSize?(g.end==0?(f+(1-f)*i):(1-(1-f)*i)):f;
|
|
if(r.animateSize){if(r.customProperties){var s=b.extend({},r.customProperties);
|
|
var m=/^([\d+-.]+)(.*)$/;
|
|
b.each(s,function(A,y){var z=m.exec(y);
|
|
s[A]=z?(z[1]*u+z[2]):y;
|
|
});
|
|
e=b.extend(s,e);
|
|
}e=b.extend(e,{width:r.width*u+k,height:r.height*u+k});
|
|
}if(r.matrix){var p=b.extend({},r.matrix);
|
|
var c=r.animateSize?(g.end==0?(1-i):i):1;
|
|
var q=(x==0)?0:(x<0?-1:1);
|
|
if(g.start*g.end<0){if((g.start<0&&x<0)||(g.start>0&&x>0)){c=1-i*Math.abs((g.end-g.start)/g.start);
|
|
}else{c=i*Math.abs((g.end-g.start)/g.end)-Math.abs(g.start/g.end);
|
|
}}p={m11:1-(1-p.m11)*c,m12:(p.m12*c)*q,m21:(p.m21*c)*q,m22:1-(1-p.m22)*c};
|
|
var n=("filter"==r.transformProperty);
|
|
var w="matrix("+p.m11+", "+p.m21+", "+p.m12+", "+p.m22+", 0, 0)";
|
|
if(n){w="progid:DXImageTransform.Microsoft.Matrix(FilterType='bilinear',M11="+p.m11+", M12="+p.m12+", M21="+p.m21+", M22="+p.m22+",sizingMethod='auto expand')";
|
|
}e[r.transformProperty]=w;
|
|
var l=Math.abs(p.m11)+Math.abs(p.m12);
|
|
var h=Math.abs(p.m21)+Math.abs(p.m22);
|
|
if(!t){o=q*((1-l)/2);
|
|
}else{j=q*((1-h)/2);
|
|
}if(n){o+=(l-1)/2;
|
|
j+=(h-1)/2;
|
|
if(r.matrix.m12&&r.reflection){o*=2;
|
|
}}}var d=r.animateSize;
|
|
var v=r.steps;
|
|
if((t||d)&&v.top){e.top=(v.top.start+(v.top.end-v.top.start)*i)-j*u*r.outerHeight+k;
|
|
}if((!t||d)&&v.left){e.left=(v.left.start+(v.left.end-v.left.start)*i)-o*u*r.outerWidth+k;
|
|
}if("filter"==r.transformProperty&&r.matrix&&r.reflection){e.height=2*(e.height?parseInt(e.height):(f*r.height))+k;
|
|
}b(g.elem).css("display","none").css(e).css("display","");
|
|
};
|
|
})();
|