]> git.wh0rd.org - tt-rss.git/blob - lib/dojo/fx/Toggler.js.uncompressed.js
upgrade dojo to 1.8.3 (refs #570)
[tt-rss.git] / lib / dojo / fx / Toggler.js.uncompressed.js
1 define("dojo/fx/Toggler", ["../_base/lang","../_base/declare","../_base/fx", "../_base/connect"],
2 function(lang, declare, baseFx, connectUtil){
3 // module:
4 // dojo/fx/Toggler
5
6 return declare("dojo.fx.Toggler", null, {
7 // summary:
8 // A simple `dojo.Animation` toggler API.
9 // description:
10 // class constructor for an animation toggler. It accepts a packed
11 // set of arguments about what type of animation to use in each
12 // direction, duration, etc. All available members are mixed into
13 // these animations from the constructor (for example, `node`,
14 // `showDuration`, `hideDuration`).
15 // example:
16 // | var t = new dojo/fx/Toggler({
17 // | node: "nodeId",
18 // | showDuration: 500,
19 // | // hideDuration will default to "200"
20 // | showFunc: dojo/fx/wipeIn,
21 // | // hideFunc will default to "fadeOut"
22 // | });
23 // | t.show(100); // delay showing for 100ms
24 // | // ...time passes...
25 // | t.hide();
26
27 // node: DomNode
28 // the node to target for the showing and hiding animations
29 node: null,
30
31 // showFunc: Function
32 // The function that returns the `dojo.Animation` to show the node
33 showFunc: baseFx.fadeIn,
34
35 // hideFunc: Function
36 // The function that returns the `dojo.Animation` to hide the node
37 hideFunc: baseFx.fadeOut,
38
39 // showDuration:
40 // Time in milliseconds to run the show Animation
41 showDuration: 200,
42
43 // hideDuration:
44 // Time in milliseconds to run the hide Animation
45 hideDuration: 200,
46
47 // FIXME: need a policy for where the toggler should "be" the next
48 // time show/hide are called if we're stopped somewhere in the
49 // middle.
50 // FIXME: also would be nice to specify individual showArgs/hideArgs mixed into
51 // each animation individually.
52 // FIXME: also would be nice to have events from the animations exposed/bridged
53
54 /*=====
55 _showArgs: null,
56 _showAnim: null,
57
58 _hideArgs: null,
59 _hideAnim: null,
60
61 _isShowing: false,
62 _isHiding: false,
63 =====*/
64
65 constructor: function(args){
66 var _t = this;
67
68 lang.mixin(_t, args);
69 _t.node = args.node;
70 _t._showArgs = lang.mixin({}, args);
71 _t._showArgs.node = _t.node;
72 _t._showArgs.duration = _t.showDuration;
73 _t.showAnim = _t.showFunc(_t._showArgs);
74
75 _t._hideArgs = lang.mixin({}, args);
76 _t._hideArgs.node = _t.node;
77 _t._hideArgs.duration = _t.hideDuration;
78 _t.hideAnim = _t.hideFunc(_t._hideArgs);
79
80 connectUtil.connect(_t.showAnim, "beforeBegin", lang.hitch(_t.hideAnim, "stop", true));
81 connectUtil.connect(_t.hideAnim, "beforeBegin", lang.hitch(_t.showAnim, "stop", true));
82 },
83
84 show: function(delay){
85 // summary:
86 // Toggle the node to showing
87 // delay: Integer?
88 // Amount of time to stall playing the show animation
89 return this.showAnim.play(delay || 0);
90 },
91
92 hide: function(delay){
93 // summary:
94 // Toggle the node to hidden
95 // delay: Integer?
96 // Amount of time to stall playing the hide animation
97 return this.hideAnim.play(delay || 0);
98 }
99 });
100
101 });