]> git.wh0rd.org - tt-rss.git/blobdiff - lib/dojo/fx.js
pngcrush.sh
[tt-rss.git] / lib / dojo / fx.js
index 5c70d5b9ed25c60d729fe1be3f96efcf43b80063..6e35041a71be4c626758f1d3b365cab1c6171868 100644 (file)
@@ -1,404 +1,8 @@
 /*
-       Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+       Copyright (c) 2004-2016, The JS Foundation All Rights Reserved.
        Available via Academic Free License >= 2.1 OR the modified BSD license.
        see: http://dojotoolkit.org/license for details
 */
 
-
-if(!dojo._hasResource["dojo.fx"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dojo.fx"] = true;
-dojo.provide("dojo.fx");
-dojo.require("dojo.fx.Toggler"); // FIXME: remove this back-compat require in 2.0 
-/*=====
-dojo.fx = {
-       // summary: Effects library on top of Base animations
-};
-=====*/
-(function(){
-       
-       var d = dojo, 
-               _baseObj = {
-                       _fire: function(evt, args){
-                               if(this[evt]){
-                                       this[evt].apply(this, args||[]);
-                               }
-                               return this;
-                       }
-               };
-
-       var _chain = function(animations){
-               this._index = -1;
-               this._animations = animations||[];
-               this._current = this._onAnimateCtx = this._onEndCtx = null;
-
-               this.duration = 0;
-               d.forEach(this._animations, function(a){
-                       this.duration += a.duration;
-                       if(a.delay){ this.duration += a.delay; }
-               }, this);
-       };
-       d.extend(_chain, {
-               _onAnimate: function(){
-                       this._fire("onAnimate", arguments);
-               },
-               _onEnd: function(){
-                       d.disconnect(this._onAnimateCtx);
-                       d.disconnect(this._onEndCtx);
-                       this._onAnimateCtx = this._onEndCtx = null;
-                       if(this._index + 1 == this._animations.length){
-                               this._fire("onEnd");
-                       }else{
-                               // switch animations
-                               this._current = this._animations[++this._index];
-                               this._onAnimateCtx = d.connect(this._current, "onAnimate", this, "_onAnimate");
-                               this._onEndCtx = d.connect(this._current, "onEnd", this, "_onEnd");
-                               this._current.play(0, true);
-                       }
-               },
-               play: function(/*int?*/ delay, /*Boolean?*/ gotoStart){
-                       if(!this._current){ this._current = this._animations[this._index = 0]; }
-                       if(!gotoStart && this._current.status() == "playing"){ return this; }
-                       var beforeBegin = d.connect(this._current, "beforeBegin", this, function(){
-                                       this._fire("beforeBegin");
-                               }),
-                               onBegin = d.connect(this._current, "onBegin", this, function(arg){
-                                       this._fire("onBegin", arguments);
-                               }),
-                               onPlay = d.connect(this._current, "onPlay", this, function(arg){
-                                       this._fire("onPlay", arguments);
-                                       d.disconnect(beforeBegin);
-                                       d.disconnect(onBegin);
-                                       d.disconnect(onPlay);
-                               });
-                       if(this._onAnimateCtx){
-                               d.disconnect(this._onAnimateCtx);
-                       }
-                       this._onAnimateCtx = d.connect(this._current, "onAnimate", this, "_onAnimate");
-                       if(this._onEndCtx){
-                               d.disconnect(this._onEndCtx);
-                       }
-                       this._onEndCtx = d.connect(this._current, "onEnd", this, "_onEnd");
-                       this._current.play.apply(this._current, arguments);
-                       return this;
-               },
-               pause: function(){
-                       if(this._current){
-                               var e = d.connect(this._current, "onPause", this, function(arg){
-                                               this._fire("onPause", arguments);
-                                               d.disconnect(e);
-                                       });
-                               this._current.pause();
-                       }
-                       return this;
-               },
-               gotoPercent: function(/*Decimal*/percent, /*Boolean?*/ andPlay){
-                       this.pause();
-                       var offset = this.duration * percent;
-                       this._current = null;
-                       d.some(this._animations, function(a){
-                               if(a.duration <= offset){
-                                       this._current = a;
-                                       return true;
-                               }
-                               offset -= a.duration;
-                               return false;
-                       });
-                       if(this._current){
-                               this._current.gotoPercent(offset / this._current.duration, andPlay);
-                       }
-                       return this;
-               },
-               stop: function(/*boolean?*/ gotoEnd){
-                       if(this._current){
-                               if(gotoEnd){
-                                       for(; this._index + 1 < this._animations.length; ++this._index){
-                                               this._animations[this._index].stop(true);
-                                       }
-                                       this._current = this._animations[this._index];
-                               }
-                               var e = d.connect(this._current, "onStop", this, function(arg){
-                                               this._fire("onStop", arguments);
-                                               d.disconnect(e);
-                                       });
-                               this._current.stop();
-                       }
-                       return this;
-               },
-               status: function(){
-                       return this._current ? this._current.status() : "stopped";
-               },
-               destroy: function(){
-                       if(this._onAnimateCtx){ d.disconnect(this._onAnimateCtx); }
-                       if(this._onEndCtx){ d.disconnect(this._onEndCtx); }
-               }
-       });
-       d.extend(_chain, _baseObj);
-
-       dojo.fx.chain = function(/*dojo.Animation[]*/ animations){
-               // summary: 
-               //              Chain a list of `dojo.Animation`s to run in sequence
-               //
-               // description:
-               //              Return a `dojo.Animation` which will play all passed
-               //              `dojo.Animation` instances in sequence, firing its own
-               //              synthesized events simulating a single animation. (eg:
-               //              onEnd of this animation means the end of the chain, 
-               //              not the individual animations within)
-               //
-               // example:
-               //      Once `node` is faded out, fade in `otherNode`
-               //      |       dojo.fx.chain([
-               //      |               dojo.fadeIn({ node:node }),
-               //      |               dojo.fadeOut({ node:otherNode })
-               //      |       ]).play();
-               //
-               return new _chain(animations) // dojo.Animation
-       };
-
-       var _combine = function(animations){
-               this._animations = animations||[];
-               this._connects = [];
-               this._finished = 0;
-
-               this.duration = 0;
-               d.forEach(animations, function(a){
-                       var duration = a.duration;
-                       if(a.delay){ duration += a.delay; }
-                       if(this.duration < duration){ this.duration = duration; }
-                       this._connects.push(d.connect(a, "onEnd", this, "_onEnd"));
-               }, this);
-               
-               this._pseudoAnimation = new d.Animation({curve: [0, 1], duration: this.duration});
-               var self = this;
-               d.forEach(["beforeBegin", "onBegin", "onPlay", "onAnimate", "onPause", "onStop", "onEnd"], 
-                       function(evt){
-                               self._connects.push(d.connect(self._pseudoAnimation, evt,
-                                       function(){ self._fire(evt, arguments); }
-                               ));
-                       }
-               );
-       };
-       d.extend(_combine, {
-               _doAction: function(action, args){
-                       d.forEach(this._animations, function(a){
-                               a[action].apply(a, args);
-                       });
-                       return this;
-               },
-               _onEnd: function(){
-                       if(++this._finished > this._animations.length){
-                               this._fire("onEnd");
-                       }
-               },
-               _call: function(action, args){
-                       var t = this._pseudoAnimation;
-                       t[action].apply(t, args);
-               },
-               play: function(/*int?*/ delay, /*Boolean?*/ gotoStart){
-                       this._finished = 0;
-                       this._doAction("play", arguments);
-                       this._call("play", arguments);
-                       return this;
-               },
-               pause: function(){
-                       this._doAction("pause", arguments);
-                       this._call("pause", arguments);
-                       return this;
-               },
-               gotoPercent: function(/*Decimal*/percent, /*Boolean?*/ andPlay){
-                       var ms = this.duration * percent;
-                       d.forEach(this._animations, function(a){
-                               a.gotoPercent(a.duration < ms ? 1 : (ms / a.duration), andPlay);
-                       });
-                       this._call("gotoPercent", arguments);
-                       return this;
-               },
-               stop: function(/*boolean?*/ gotoEnd){
-                       this._doAction("stop", arguments);
-                       this._call("stop", arguments);
-                       return this;
-               },
-               status: function(){
-                       return this._pseudoAnimation.status();
-               },
-               destroy: function(){
-                       d.forEach(this._connects, dojo.disconnect);
-               }
-       });
-       d.extend(_combine, _baseObj);
-
-       dojo.fx.combine = function(/*dojo.Animation[]*/ animations){
-               // summary: 
-               //              Combine a list of `dojo.Animation`s to run in parallel
-               //
-               // description:
-               //              Combine an array of `dojo.Animation`s to run in parallel, 
-               //              providing a new `dojo.Animation` instance encompasing each
-               //              animation, firing standard animation events.
-               //
-               // example:
-               //      Fade out `node` while fading in `otherNode` simultaneously
-               //      |       dojo.fx.combine([
-               //      |               dojo.fadeIn({ node:node }),
-               //      |               dojo.fadeOut({ node:otherNode })
-               //      |       ]).play();
-               //
-               // example:
-               //      When the longest animation ends, execute a function:
-               //      |       var anim = dojo.fx.combine([
-               //      |               dojo.fadeIn({ node: n, duration:700 }),
-               //      |               dojo.fadeOut({ node: otherNode, duration: 300 })
-               //      |       ]);
-               //      |       dojo.connect(anim, "onEnd", function(){
-               //      |               // overall animation is done.
-               //      |       });
-               //      |       anim.play(); // play the animation
-               //
-               return new _combine(animations); // dojo.Animation
-       };
-
-       dojo.fx.wipeIn = function(/*Object*/ args){
-               // summary:
-               //              Expand a node to it's natural height.
-               //
-               // description:
-               //              Returns an animation that will expand the
-               //              node defined in 'args' object from it's current height to
-               //              it's natural height (with no scrollbar).
-               //              Node must have no margin/border/padding.
-               //
-               // args: Object
-               //              A hash-map of standard `dojo.Animation` constructor properties
-               //              (such as easing: node: duration: and so on)
-               //
-               // example:
-               //      |       dojo.fx.wipeIn({
-               //      |               node:"someId"
-               //      |       }).play()
-               var node = args.node = d.byId(args.node), s = node.style, o;
-
-               var anim = d.animateProperty(d.mixin({
-                       properties: {
-                               height: {
-                                       // wrapped in functions so we wait till the last second to query (in case value has changed)
-                                       start: function(){
-                                               // start at current [computed] height, but use 1px rather than 0
-                                               // because 0 causes IE to display the whole panel
-                                               o = s.overflow;
-                                               s.overflow = "hidden";
-                                               if(s.visibility == "hidden" || s.display == "none"){
-                                                       s.height = "1px";
-                                                       s.display = "";
-                                                       s.visibility = "";
-                                                       return 1;
-                                               }else{
-                                                       var height = d.style(node, "height");
-                                                       return Math.max(height, 1);
-                                               }
-                                       },
-                                       end: function(){
-                                               return node.scrollHeight;
-                                       }
-                               }
-                       }
-               }, args));
-
-               d.connect(anim, "onEnd", function(){ 
-                       s.height = "auto";
-                       s.overflow = o;
-               });
-
-               return anim; // dojo.Animation
-       }
-
-       dojo.fx.wipeOut = function(/*Object*/ args){
-               // summary:
-               //              Shrink a node to nothing and hide it. 
-               //
-               // description:
-               //              Returns an animation that will shrink node defined in "args"
-               //              from it's current height to 1px, and then hide it.
-               //
-               // args: Object
-               //              A hash-map of standard `dojo.Animation` constructor properties
-               //              (such as easing: node: duration: and so on)
-               // 
-               // example:
-               //      |       dojo.fx.wipeOut({ node:"someId" }).play()
-               
-               var node = args.node = d.byId(args.node), s = node.style, o;
-               
-               var anim = d.animateProperty(d.mixin({
-                       properties: {
-                               height: {
-                                       end: 1 // 0 causes IE to display the whole panel
-                               }
-                       }
-               }, args));
-
-               d.connect(anim, "beforeBegin", function(){
-                       o = s.overflow;
-                       s.overflow = "hidden";
-                       s.display = "";
-               });
-               d.connect(anim, "onEnd", function(){
-                       s.overflow = o;
-                       s.height = "auto";
-                       s.display = "none";
-               });
-
-               return anim; // dojo.Animation
-       }
-
-       dojo.fx.slideTo = function(/*Object*/ args){
-               // summary:
-               //              Slide a node to a new top/left position
-               //
-               // description:
-               //              Returns an animation that will slide "node" 
-               //              defined in args Object from its current position to
-               //              the position defined by (args.left, args.top).
-               //
-               // args: Object
-               //              A hash-map of standard `dojo.Animation` constructor properties
-               //              (such as easing: node: duration: and so on). Special args members
-               //              are `top` and `left`, which indicate the new position to slide to.
-               //
-               // example:
-               //      |       dojo.fx.slideTo({ node: node, left:"40", top:"50", units:"px" }).play()
-
-               var node = args.node = d.byId(args.node), 
-                       top = null, left = null;
-
-               var init = (function(n){
-                       return function(){
-                               var cs = d.getComputedStyle(n);
-                               var pos = cs.position;
-                               top = (pos == 'absolute' ? n.offsetTop : parseInt(cs.top) || 0);
-                               left = (pos == 'absolute' ? n.offsetLeft : parseInt(cs.left) || 0);
-                               if(pos != 'absolute' && pos != 'relative'){
-                                       var ret = d.position(n, true);
-                                       top = ret.y;
-                                       left = ret.x;
-                                       n.style.position="absolute";
-                                       n.style.top=top+"px";
-                                       n.style.left=left+"px";
-                               }
-                       };
-               })(node);
-               init();
-
-               var anim = d.animateProperty(d.mixin({
-                       properties: {
-                               top: args.top || 0,
-                               left: args.left || 0
-                       }
-               }, args));
-               d.connect(anim, "beforeBegin", anim, init);
-
-               return anim; // dojo.Animation
-       }
-
-})();
-
-}
+//>>built
+define("dojo/fx",["./_base/lang","./Evented","./_base/kernel","./_base/array","./aspect","./_base/fx","./dom","./dom-style","./dom-geometry","./ready","require"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9,_a,_b){if(!_3.isAsync){_a(0,function(){var _c=["./fx/Toggler"];_b(_c);});}var _d=_3.fx={};var _e={_fire:function(_f,_10){if(this[_f]){this[_f].apply(this,_10||[]);}return this;}};var _11=function(_12){this._index=-1;this._animations=_12||[];this._current=this._onAnimateCtx=this._onEndCtx=null;this.duration=0;_4.forEach(this._animations,function(a){if(a){if(typeof a.duration!="undefined"){this.duration+=a.duration;}if(a.delay){this.duration+=a.delay;}}},this);};_11.prototype=new _2();_1.extend(_11,{_onAnimate:function(){this._fire("onAnimate",arguments);},_onEnd:function(){this._onAnimateCtx.remove();this._onEndCtx.remove();this._onAnimateCtx=this._onEndCtx=null;if(this._index+1==this._animations.length){this._fire("onEnd");}else{this._current=this._animations[++this._index];this._onAnimateCtx=_5.after(this._current,"onAnimate",_1.hitch(this,"_onAnimate"),true);this._onEndCtx=_5.after(this._current,"onEnd",_1.hitch(this,"_onEnd"),true);this._current.play(0,true);}},play:function(_13,_14){if(!this._current){this._current=this._animations[this._index=0];}if(!_14&&this._current.status()=="playing"){return this;}var _15=_5.after(this._current,"beforeBegin",_1.hitch(this,function(){this._fire("beforeBegin");}),true),_16=_5.after(this._current,"onBegin",_1.hitch(this,function(arg){this._fire("onBegin",arguments);}),true),_17=_5.after(this._current,"onPlay",_1.hitch(this,function(arg){this._fire("onPlay",arguments);_15.remove();_16.remove();_17.remove();}));if(this._onAnimateCtx){this._onAnimateCtx.remove();}this._onAnimateCtx=_5.after(this._current,"onAnimate",_1.hitch(this,"_onAnimate"),true);if(this._onEndCtx){this._onEndCtx.remove();}this._onEndCtx=_5.after(this._current,"onEnd",_1.hitch(this,"_onEnd"),true);this._current.play.apply(this._current,arguments);return this;},pause:function(){if(this._current){var e=_5.after(this._current,"onPause",_1.hitch(this,function(arg){this._fire("onPause",arguments);e.remove();}),true);this._current.pause();}return this;},gotoPercent:function(_18,_19){this.pause();var _1a=this.duration*_18;this._current=null;_4.some(this._animations,function(a,_1b){if(_1a<=a.duration){this._current=a;this._index=_1b;return true;}_1a-=a.duration;return false;},this);if(this._current){this._current.gotoPercent(_1a/this._current.duration);}if(_19){this.play();}return this;},stop:function(_1c){if(this._current){if(_1c){for(;this._index+1<this._animations.length;++this._index){this._animations[this._index].stop(true);}this._current=this._animations[this._index];}var e=_5.after(this._current,"onStop",_1.hitch(this,function(arg){this._fire("onStop",arguments);e.remove();}),true);this._current.stop();}return this;},status:function(){return this._current?this._current.status():"stopped";},destroy:function(){this.stop();if(this._onAnimateCtx){this._onAnimateCtx.remove();}if(this._onEndCtx){this._onEndCtx.remove();}}});_1.extend(_11,_e);_d.chain=function(_1d){return new _11(_1.isArray(_1d)?_1d:Array.prototype.slice.call(_1d,0));};var _1e=function(_1f){this._animations=_1f||[];this._connects=[];this._finished=0;this.duration=0;_4.forEach(_1f,function(a){var _20=a.duration;if(a.delay){_20+=a.delay;}if(this.duration<_20){this.duration=_20;}this._connects.push(_5.after(a,"onEnd",_1.hitch(this,"_onEnd"),true));},this);this._pseudoAnimation=new _6.Animation({curve:[0,1],duration:this.duration});var _21=this;_4.forEach(["beforeBegin","onBegin","onPlay","onAnimate","onPause","onStop","onEnd"],function(evt){_21._connects.push(_5.after(_21._pseudoAnimation,evt,function(){_21._fire(evt,arguments);},true));});};_1.extend(_1e,{_doAction:function(_22,_23){_4.forEach(this._animations,function(a){a[_22].apply(a,_23);});return this;},_onEnd:function(){if(++this._finished>this._animations.length){this._fire("onEnd");}},_call:function(_24,_25){var t=this._pseudoAnimation;t[_24].apply(t,_25);},play:function(_26,_27){this._finished=0;this._doAction("play",arguments);this._call("play",arguments);return this;},pause:function(){this._doAction("pause",arguments);this._call("pause",arguments);return this;},gotoPercent:function(_28,_29){var ms=this.duration*_28;_4.forEach(this._animations,function(a){a.gotoPercent(a.duration<ms?1:(ms/a.duration),_29);});this._call("gotoPercent",arguments);return this;},stop:function(_2a){this._doAction("stop",arguments);this._call("stop",arguments);return this;},status:function(){return this._pseudoAnimation.status();},destroy:function(){this.stop();_4.forEach(this._connects,function(_2b){_2b.remove();});}});_1.extend(_1e,_e);_d.combine=function(_2c){return new _1e(_1.isArray(_2c)?_2c:Array.prototype.slice.call(_2c,0));};_d.wipeIn=function(_2d){var _2e=_2d.node=_7.byId(_2d.node),s=_2e.style,o;var _2f=_6.animateProperty(_1.mixin({properties:{height:{start:function(){o=s.overflow;s.overflow="hidden";if(s.visibility=="hidden"||s.display=="none"){s.height="1px";s.display="";s.visibility="";return 1;}else{var _30=_8.get(_2e,"height");return Math.max(_30,1);}},end:function(){return _2e.scrollHeight;}}}},_2d));var _31=function(){s.height="auto";s.overflow=o;};_5.after(_2f,"onStop",_31,true);_5.after(_2f,"onEnd",_31,true);return _2f;};_d.wipeOut=function(_32){var _33=_32.node=_7.byId(_32.node),s=_33.style,o;var _34=_6.animateProperty(_1.mixin({properties:{height:{end:1}}},_32));_5.after(_34,"beforeBegin",function(){o=s.overflow;s.overflow="hidden";s.display="";},true);var _35=function(){s.overflow=o;s.height="auto";s.display="none";};_5.after(_34,"onStop",_35,true);_5.after(_34,"onEnd",_35,true);return _34;};_d.slideTo=function(_36){var _37=_36.node=_7.byId(_36.node),top=null,_38=null;var _39=(function(n){return function(){var cs=_8.getComputedStyle(n);var pos=cs.position;top=(pos=="absolute"?n.offsetTop:parseInt(cs.top)||0);_38=(pos=="absolute"?n.offsetLeft:parseInt(cs.left)||0);if(pos!="absolute"&&pos!="relative"){var ret=_9.position(n,true);top=ret.y;_38=ret.x;n.style.position="absolute";n.style.top=top+"px";n.style.left=_38+"px";}};})(_37);_39();var _3a=_6.animateProperty(_1.mixin({properties:{top:_36.top||0,left:_36.left||0}},_36));_5.after(_3a,"beforeBegin",_39,true);return _3a;};return _d;});
\ No newline at end of file