root / trunk / web / dojo / dojox / fx / _base.js @ 12
History | View | Annotate | Download (3.5 KB)
1 | 9 | andrej.cim | /*
|
---|---|---|---|
2 | Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||
3 | Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||
4 | see: http://dojotoolkit.org/license for details
|
||
5 | */
|
||
6 | |||
7 | |||
8 | if(!dojo._hasResource["dojox.fx._base"]){ |
||
9 | dojo._hasResource["dojox.fx._base"]=true; |
||
10 | dojo.provide("dojox.fx._base");
|
||
11 | dojo.require("dojo.fx");
|
||
12 | dojo.mixin(dojox.fx,{anim:dojo.anim,animateProperty:dojo.animateProperty,fadeTo:dojo._fade,fadeIn:dojo.fadeIn,fadeOut:dojo.fadeOut,combine:dojo.fx.combine,chain:dojo.fx.chain,slideTo:dojo.fx.slideTo,wipeIn:dojo.fx.wipeIn,wipeOut:dojo.fx.wipeOut}); |
||
13 | dojox.fx.sizeTo=function(_1){ |
||
14 | var _2=_1.node=dojo.byId(_1.node),_3="absolute"; |
||
15 | var _4=_1.method||"chain"; |
||
16 | if(!_1.duration){
|
||
17 | _1.duration=500;
|
||
18 | } |
||
19 | if(_4=="chain"){ |
||
20 | _1.duration=Math.floor(_1.duration/2);
|
||
21 | } |
||
22 | var _5,_6,_7,_8,_9,_a=null; |
||
23 | var _b=(function(n){ |
||
24 | return function(){ |
||
25 | var cs=dojo.getComputedStyle(n),_c=cs.position,w=cs.width,h=cs.height;
|
||
26 | _5=(_c==_3?n.offsetTop:parseInt(cs.top)||0);
|
||
27 | _7=(_c==_3?n.offsetLeft:parseInt(cs.left)||0);
|
||
28 | _9=(w=="auto"?0:parseInt(w)); |
||
29 | _a=(h=="auto"?0:parseInt(h)); |
||
30 | _8=_7-Math.floor((_1.width-_9)/2);
|
||
31 | _6=_5-Math.floor((_1.height-_a)/2);
|
||
32 | if(_c!=_3&&_c!="relative"){ |
||
33 | var _d=dojo.coords(n,true); |
||
34 | _5=_d.y; |
||
35 | _7=_d.x; |
||
36 | n.style.position=_3; |
||
37 | n.style.top=_5+"px";
|
||
38 | n.style.left=_7+"px";
|
||
39 | } |
||
40 | }; |
||
41 | })(_2); |
||
42 | var _e=dojo.animateProperty(dojo.mixin({properties:{height:function(){ |
||
43 | _b(); |
||
44 | return {end:_1.height||0,start:_a}; |
||
45 | },top:function(){ |
||
46 | return {start:_5,end:_6}; |
||
47 | }}},_1)); |
||
48 | var _f=dojo.animateProperty(dojo.mixin({properties:{width:function(){ |
||
49 | return {start:_9,end:_1.width||0}; |
||
50 | },left:function(){ |
||
51 | return {start:_7,end:_8}; |
||
52 | }}},_1)); |
||
53 | var _10=dojo.fx[(_1.method=="combine"?"combine":"chain")]([_e,_f]); |
||
54 | return _10;
|
||
55 | }; |
||
56 | dojox.fx.slideBy=function(_11){ |
||
57 | var _12=_11.node=dojo.byId(_11.node),top,_13;
|
||
58 | var _14=(function(n){ |
||
59 | return function(){ |
||
60 | var cs=dojo.getComputedStyle(n);
|
||
61 | var pos=cs.position;
|
||
62 | top=(pos=="absolute"?n.offsetTop:parseInt(cs.top)||0); |
||
63 | _13=(pos=="absolute"?n.offsetLeft:parseInt(cs.left)||0); |
||
64 | if(pos!="absolute"&&pos!="relative"){ |
||
65 | var ret=dojo.coords(n,true); |
||
66 | top=ret.y; |
||
67 | _13=ret.x; |
||
68 | n.style.position="absolute";
|
||
69 | n.style.top=top+"px";
|
||
70 | n.style.left=_13+"px";
|
||
71 | } |
||
72 | }; |
||
73 | })(_12); |
||
74 | _14(); |
||
75 | var _15=dojo.animateProperty(dojo.mixin({properties:{top:top+(_11.top||0),left:_13+(_11.left||0)}},_11)); |
||
76 | dojo.connect(_15,"beforeBegin",_15,_14);
|
||
77 | return _15;
|
||
78 | }; |
||
79 | dojox.fx.crossFade=function(_16){ |
||
80 | var _17=_16.nodes[0]=dojo.byId(_16.nodes[0]),op1=dojo.style(_17,"opacity"),_18=_16.nodes[1]=dojo.byId(_16.nodes[1]),op2=dojo.style(_18,"opacity"); |
||
81 | var _19=dojo.fx.combine([dojo[(op1==0?"fadeIn":"fadeOut")](dojo.mixin({node:_17},_16)),dojo[(op1==0?"fadeOut":"fadeIn")](dojo.mixin({node:_18},_16))]); |
||
82 | return _19;
|
||
83 | }; |
||
84 | dojox.fx.highlight=function(_1a){ |
||
85 | var _1b=_1a.node=dojo.byId(_1a.node);
|
||
86 | _1a.duration=_1a.duration||400;
|
||
87 | var _1c=_1a.color||"#ffff99",_1d=dojo.style(_1b,"backgroundColor"); |
||
88 | if(_1d=="rgba(0, 0, 0, 0)"){ |
||
89 | _1d="transparent";
|
||
90 | } |
||
91 | var _1e=dojo.animateProperty(dojo.mixin({properties:{backgroundColor:{start:_1c,end:_1d}}},_1a)); |
||
92 | if(_1d=="transparent"){ |
||
93 | dojo.connect(_1e,"onEnd",_1e,function(){ |
||
94 | _1b.style.backgroundColor=_1d; |
||
95 | }); |
||
96 | } |
||
97 | return _1e;
|
||
98 | }; |
||
99 | dojox.fx.wipeTo=function(_1f){ |
||
100 | _1f.node=dojo.byId(_1f.node); |
||
101 | var _20=_1f.node,s=_20.style;
|
||
102 | var dir=(_1f.width?"width":"height"),_21=_1f[dir],_22={}; |
||
103 | _22[dir]={start:function(){ |
||
104 | s.overflow="hidden";
|
||
105 | if(s.visibility=="hidden"||s.display=="none"){ |
||
106 | s[dir]="1px";
|
||
107 | s.display="";
|
||
108 | s.visibility="";
|
||
109 | return 1; |
||
110 | }else{
|
||
111 | var now=dojo.style(_20,dir);
|
||
112 | return Math.max(now,1); |
||
113 | } |
||
114 | },end:_21};
|
||
115 | var _23=dojo.animateProperty(dojo.mixin({properties:_22},_1f)); |
||
116 | return _23;
|
||
117 | }; |
||
118 | } |