Files
SIG/Scripts/AjaxControlToolkit/Release/Animation.js
2024-11-05 10:47:20 -07:00

1 line
8.2 KiB
JavaScript

Type.registerNamespace("Sys.Extended.UI.Animation"),Sys.Extended.UI.Animation.AnimationBehavior=function(e){Sys.Extended.UI.Animation.AnimationBehavior.initializeBase(this,[e]),this._onLoad=null,this._onClick=null,this._onMouseOver=null,this._onMouseOut=null,this._onHoverOver=null,this._onHoverOut=null,this._onClickHandler=null,this._onMouseOverHandler=null,this._onMouseOutHandler=null},Sys.Extended.UI.Animation.AnimationBehavior.prototype={initialize:function(){Sys.Extended.UI.Animation.AnimationBehavior.callBaseMethod(this,"initialize");var e=this.get_element();e&&(this._onClickHandler=Function.createDelegate(this,this.playOnClick),$addHandler(e,"click",this._onClickHandler),this._onMouseOverHandler=Function.createDelegate(this,this.playOnMouseOver),$addHandler(e,"mouseover",this._onMouseOverHandler),this._onMouseOutHandler=Function.createDelegate(this,this.playOnMouseOut),$addHandler(e,"mouseout",this._onMouseOutHandler))},dispose:function(){var e=this.get_element();e&&(this._onClickHandler&&($removeHandler(e,"click",this._onClickHandler),this._onClickHandler=null),this._onMouseOverHandler&&($removeHandler(e,"mouseover",this._onMouseOverHandler),this._onMouseOverHandler=null),this._onMouseOutHandler&&($removeHandler(e,"mouseout",this._onMouseOutHandler),this._onMouseOutHandler=null)),this._onLoad=null,this._onClick=null,this._onMouseOver=null,this._onMouseOut=null,this._onHoverOver=null,this._onHoverOut=null,Sys.Extended.UI.Animation.AnimationBehavior.callBaseMethod(this,"dispose")},get_onLoad:function(){return this._onLoad?this._onLoad.get_json():null},get_OnLoad:function(){return Sys.Extended.Deprecated("get_OnLoad()","get_onLoad()"),this.get_onLoad()},set_onLoad:function(e){this._onLoad||(this._onLoad=new Sys.Extended.UI.Animation.GenericAnimationBehavior(this.get_element()),this._onLoad.initialize()),this._onLoad.set_json(e),this.raisePropertyChanged("OnLoad"),this._onLoad.play()},set_OnLoad:function(e){Sys.Extended.Deprecated("set_OnLoad(value)","set_onLoad(value)"),this.set_onLoad(e)},get_onLoadBehavior:function(){return this._onLoad},get_OnLoadBehavior:function(){return Sys.Extended.Deprecated("get_OnLoadBehavior()","get_OnLoadBehavior()"),this.get_onLoadBehavior()},get_onClick:function(){return this._onClick?this._onClick.get_json():null},get_OnClick:function(){return Sys.Extended.Deprecated("get_OnClick()","get_onClick()"),this.get_onClick()},set_OnClick:function(e){Sys.Extended.Deprecated("set_OnClick(value)","set_onClick(value)"),this.set_onClick(e)},set_onClick:function(e){this._onClick||(this._onClick=new Sys.Extended.UI.Animation.GenericAnimationBehavior(this.get_element()),this._onClick.initialize()),this._onClick.set_json(e),this.raisePropertyChanged("OnClick")},get_onClickBehavior:function(){return this._onClick},get_OnClickBehavior:function(){return Sys.Extended.Deprecated("get_OnClickBehavior()","get_onClickBehavior()"),this.get_onClickBehavior()},OnClick:function(){Sys.Extended.Deprecated("OnClick()"),this.playOnClick()},playOnClick:function(){this._onClick&&this._onClick.play()},get_onMouseOver:function(){return this._onMouseOver?this._onMouseOver.get_json():null},get_OnMouseOver:function(){return Sys.Extended.Deprecated("get_OnMouseOver()","get_onMouseOver()"),this.get_onMouseOver()},set_onMouseOver:function(e){this._onMouseOver||(this._onMouseOver=new Sys.Extended.UI.Animation.GenericAnimationBehavior(this.get_element()),this._onMouseOver.initialize()),this._onMouseOver.set_json(e),this.raisePropertyChanged("OnMouseOver")},set_OnMouseOver:function(e){Sys.Extended.Deprecated("set_OnMouseOver(value)","set_onMouseOver(value)"),this.set_onMouseOver(e)},get_onMouseOverBehavior:function(){return this._onMouseOver},get_OnMouseOverBehavior:function(){Sys.Extended.Deprecated("get_OnMouseOverBehavior()","get_onMouseOverBehavior()")},OnMouseOver:function(){Sys.Extended.Deprecated("OnMouseOver()"),this.playOnMouseOver()},playOnMouseOver:function(){this._mouseHasEntered||(this._onMouseOver&&this._onMouseOver.play(),this._onHoverOver&&(this._onHoverOut&&this._onHoverOut.quit(),this._onHoverOver.play()),this._mouseHasEntered=!0)},get_onMouseOut:function(){return this._onMouseOut?this._onMouseOut.get_json():null},get_OnMouseOut:function(){return Sys.Extended.Deprecated("get_OnMouseOut()","get_onMouseOut()"),this.get_onMouseOut()},set_onMouseOut:function(e){this._onMouseOut||(this._onMouseOut=new Sys.Extended.UI.Animation.GenericAnimationBehavior(this.get_element()),this._onMouseOut.initialize()),this._onMouseOut.set_json(e),this.raisePropertyChanged("OnMouseOut")},set_OnMouseOut:function(e){Sys.Extended.Deprecated("set_OnMouseOut(value)","set_OnMouseOut(value)"),this.set_onMouseOut(e)},get_onMouseOutBehavior:function(){return this._onMouseOut},get_OnMouseOutBehavior:function(){return Sys.Extended.Deprecated("get_OnMouseOutBehavior()","get_onMouseOutBehavior"),this.get_onMouseOutBehavior()},OnMouseOut:function(e){Sys.Extended.Deprecated("OnMouseOut()"),this.playOnMouseOut()},playOnMouseOut:function(e){var n=e.rawEvent,t=this.get_element(),o=e.target;if(o.nodeName===t.nodeName){var i=n.relatedTarget||n.toElement;t==i||this._isChild(t,i)||(this._mouseHasEntered=!1,this._onMouseOut&&this._onMouseOut.play(),this._onHoverOut&&(this._onHoverOver&&this._onHoverOver.quit(),this._onHoverOut.play()))}},_isChild:function(e,n){for(var t=document.body;n&&e!=n&&t!=n;)try{n=n.parentNode}catch(e){return!1}return e==n},get_onHoverOver:function(){return this._onHoverOver?this._onHoverOver.get_json():null},get_OnHoverOver:function(){return Sys.Extended.Deprecated("get_OnHoverOver()","get_onHoverOver"),this.get_onHoverOver()},set_onHoverOver:function(e){this._onHoverOver||(this._onHoverOver=new Sys.Extended.UI.Animation.GenericAnimationBehavior(this.get_element()),this._onHoverOver.initialize()),this._onHoverOver.set_json(e),this.raisePropertyChanged("OnHoverOver")},set_OnHoverOver:function(e){Sys.Extended.Deprecated("set_OnHoverOver(value)","set_OnHoverOver(value)"),this.set_onHoverOver(e)},get_onHoverOverBehavior:function(){return this._onHoverOver},get_OnHoverOverBehavior:function(){return Sys.Extended.Deprecated("get_OnHoverOverBehavior()","get_onHoverOverBehavior()"),this.get_onHoverOverBehavior()},get_onHoverOut:function(){return this._onHoverOut?this._onHoverOut.get_json():null},get_OnHoverOut:function(){return Sys.Extended.Deprecated("get_OnHoverOut()","get_onHoverOut()"),this.get_onHoverOut()},set_onHoverOut:function(e){this._onHoverOut||(this._onHoverOut=new Sys.Extended.UI.Animation.GenericAnimationBehavior(this.get_element()),this._onHoverOut.initialize()),this._onHoverOut.set_json(e),this.raisePropertyChanged("OnHoverOut")},set_OnHoverOut:function(e){Sys.Extended.Deprecated("set_OnHoverOut(value)","set_onHoverOut(value)"),this.set_onHoverOut(e)},get_onHoverOutBehavior:function(){return this._onHoverOut},get_OnHoverOutBehavior:function(){return Sys.Extended.Deprecated("get_OnHoverOutBehavior()","get_onHoverOutBehavior()"),this.get_onHoverOutBehavior()}},Sys.Extended.UI.Animation.AnimationBehavior.registerClass("Sys.Extended.UI.Animation.AnimationBehavior",Sys.Extended.UI.BehaviorBase),Sys.Extended.UI.Animation.GenericAnimationBehavior=function(e){Sys.Extended.UI.Animation.GenericAnimationBehavior.initializeBase(this,[e]),this._json=null,this._animation=null},Sys.Extended.UI.Animation.GenericAnimationBehavior.prototype={dispose:function(){this.disposeAnimation(),Sys.Extended.UI.Animation.GenericAnimationBehavior.callBaseMethod(this,"dispose")},disposeAnimation:function(){this._animation&&this._animation.dispose(),this._animation=null},play:function(){this._animation&&!this._animation.get_isPlaying()&&(this.stop(),this._animation.play())},stop:function(){this._animation&&this._animation.get_isPlaying()&&this._animation.stop(!0)},quit:function(){this._animation&&this._animation.get_isPlaying()&&this._animation.stop(!1)},get_json:function(){return this._json},set_json:function(e){if(this._json!=e){this._json=e,this.raisePropertyChanged("json"),this.disposeAnimation();var n=this.get_element();n&&(this._animation=Sys.Extended.UI.Animation.buildAnimation(this._json,n),this._animation&&this._animation.initialize(),this.raisePropertyChanged("animation"))}},get_animation:function(){return this._animation}},Sys.Extended.UI.Animation.GenericAnimationBehavior.registerClass("Sys.Extended.UI.Animation.GenericAnimationBehavior",Sys.Extended.UI.BehaviorBase);