]>
git.wh0rd.org - tt-rss.git/blob - lib/dojo/NodeList-fx.js.uncompressed.js
1 define("dojo/NodeList-fx", ["./query", "./_base/lang", "./_base/connect", "./_base/fx", "./fx"],
2 function(query
, lang
, connectLib
, baseFx
, coreFx
){
10 // Adds dojo.fx animation support to dojo.query() by extending the NodeList class
11 // with additional FX functions. NodeList is the array-like object used to hold query results.
15 var NodeList
= query
.NodeList
;
17 lang
.extend(NodeList
, {
18 _anim: function(obj
, method
, args
){
20 var a
= coreFx
.combine(
21 this.map(function(item
){
22 var tmpArgs
= { node
: item
};
23 lang
.mixin(tmpArgs
, args
);
24 return obj
[method
](tmpArgs
);
27 return args
.auto
? a
.play() && this : a
; // dojo/_base/fx.Animation|dojo/NodeList
30 wipeIn: function(args
){
32 // wipe in all elements of this NodeList via `dojo/fx.wipeIn()`
35 // Additional dojo/_base/fx.Animation arguments to mix into this set with the addition of
36 // an `auto` parameter.
38 // returns: dojo/_base/fx.Animation|dojo/NodeList
39 // A special args member `auto` can be passed to automatically play the animation.
40 // If args.auto is present, the original dojo/NodeList will be returned for further
41 // chaining. Otherwise the dojo/_base/fx.Animation instance is returned and must be .play()'ed
44 // Fade in all tables with class "blah":
45 // | dojo.query("table.blah").wipeIn().play();
48 // Utilizing `auto` to get the NodeList back:
49 // | dojo.query(".titles").wipeIn({ auto:true }).onclick(someFunction);
51 return this._anim(coreFx
, "wipeIn", args
); // dojo/_base/fx.Animation|dojo/NodeList
54 wipeOut: function(args
){
56 // wipe out all elements of this NodeList via `dojo/fx.wipeOut()`
59 // Additional dojo/_base/fx.Animation arguments to mix into this set with the addition of
60 // an `auto` parameter.
62 // returns: dojo/_base/fx.Animation|dojo/NodeList
63 // A special args member `auto` can be passed to automatically play the animation.
64 // If args.auto is present, the original dojo/NodeList will be returned for further
65 // chaining. Otherwise the dojo/_base/fx.Animation instance is returned and must be .play()'ed
68 // Wipe out all tables with class "blah":
69 // | dojo.query("table.blah").wipeOut().play();
70 return this._anim(coreFx
, "wipeOut", args
); // dojo/_base/fx.Animation|dojo/NodeList
73 slideTo: function(args
){
75 // slide all elements of the node list to the specified place via `dojo/fx.slideTo()`
78 // Additional dojo/_base/fx.Animation arguments to mix into this set with the addition of
79 // an `auto` parameter.
81 // returns: dojo/_base/fx.Animation|dojo/NodeList
82 // A special args member `auto` can be passed to automatically play the animation.
83 // If args.auto is present, the original dojo/NodeList will be returned for further
84 // chaining. Otherwise the dojo/_base/fx.Animation instance is returned and must be .play()'ed
87 // | Move all tables with class "blah" to 300/300:
88 // | dojo.query("table.blah").slideTo({
92 return this._anim(coreFx
, "slideTo", args
); // dojo/_base/fx.Animation|dojo/NodeList
96 fadeIn: function(args
){
98 // fade in all elements of this NodeList via `dojo.fadeIn`
101 // Additional dojo/_base/fx.Animation arguments to mix into this set with the addition of
102 // an `auto` parameter.
104 // returns: dojo/_base/fx.Animation|dojo/NodeList
105 // A special args member `auto` can be passed to automatically play the animation.
106 // If args.auto is present, the original dojo/NodeList will be returned for further
107 // chaining. Otherwise the dojo/_base/fx.Animation instance is returned and must be .play()'ed
110 // Fade in all tables with class "blah":
111 // | dojo.query("table.blah").fadeIn().play();
112 return this._anim(baseFx
, "fadeIn", args
); // dojo/_base/fx.Animation|dojo/NodeList
115 fadeOut: function(args
){
117 // fade out all elements of this NodeList via `dojo.fadeOut`
120 // Additional dojo/_base/fx.Animation arguments to mix into this set with the addition of
121 // an `auto` parameter.
123 // returns: dojo/_base/fx.Animation|dojo/NodeList
124 // A special args member `auto` can be passed to automatically play the animation.
125 // If args.auto is present, the original dojo/NodeList will be returned for further
126 // chaining. Otherwise the dojo/_base/fx.Animation instance is returned and must be .play()'ed
129 // Fade out all elements with class "zork":
130 // | dojo.query(".zork").fadeOut().play();
132 // Fade them on a delay and do something at the end:
133 // | var fo = dojo.query(".zork").fadeOut();
134 // | dojo.connect(fo, "onEnd", function(){ /*...*/ });
138 // | dojo.query("li").fadeOut({ auto:true }).filter(filterFn).forEach(doit);
140 return this._anim(baseFx
, "fadeOut", args
); // dojo/_base/fx.Animation|dojo/NodeList
143 animateProperty: function(args
){
145 // Animate all elements of this NodeList across the properties specified.
146 // syntax identical to `dojo.animateProperty`
149 // Additional dojo/_base/fx.Animation arguments to mix into this set with the addition of
150 // an `auto` parameter.
152 // returns: dojo/_base/fx.Animation|dojo/NodeList
153 // A special args member `auto` can be passed to automatically play the animation.
154 // If args.auto is present, the original dojo/NodeList will be returned for further
155 // chaining. Otherwise the dojo/_base/fx.Animation instance is returned and must be .play()'ed
158 // | dojo.query(".zork").animateProperty({
161 // | color: { start: "black", end: "white" },
162 // | left: { end: 300 }
167 // | dojo.query(".grue").animateProperty({
172 // | }).onclick(handler);
173 return this._anim(baseFx
, "animateProperty", args
); // dojo/_base/fx.Animation|dojo/NodeList
176 anim: function( /*Object*/ properties
,
177 /*Integer?*/ duration
,
178 /*Function?*/ easing
,
182 // Animate one or more CSS properties for all nodes in this list.
183 // The returned animation object will already be playing when it
184 // is returned. See the docs for `dojo.anim` for full details.
185 // properties: Object
186 // the properties to animate. does NOT support the `auto` parameter like other
187 // NodeList-fx methods.
188 // duration: Integer?
189 // Optional. The time to run the animations for
191 // Optional. The easing function to use.
193 // A function to be called when the animation ends
195 // how long to delay playing the returned animation
197 // Another way to fade out:
198 // | dojo.query(".thinger").anim({ opacity: 0 });
200 // animate all elements with the "thigner" class to a width of 500
201 // pixels over half a second
202 // | dojo.query(".thinger").anim({ width: 500 }, 700);
203 var canim
= coreFx
.combine(
204 this.map(function(item
){
205 return baseFx
.animateProperty({
207 properties
: properties
,
208 duration
: duration
||350,
214 connectLib
.connect(canim
, "onEnd", onEnd
);
216 return canim
.play(delay
||0); // dojo/_base/fx.Animation