Project

General

Profile

Statistics
| Revision:

root / trunk / web / dojo / dojox / fx / style.js @ 11

History | View | Annotate | Download (1.87 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.style"]){
9
dojo._hasResource["dojox.fx.style"]=true;
10
dojo.provide("dojox.fx.style");
11
dojo.experimental("dojox.fx.style");
12
dojo.require("dojo.fx");
13
(function(){
14
var d=dojo;
15
var _1=function(_2){
16
return d.map(dojox.fx._allowedProperties,function(_3){
17
return _2[_3];
18
});
19
};
20
var _4=function(_5,_6,_7){
21
_5=d.byId(_5);
22
var cs=d.getComputedStyle(_5);
23
var _8=_1(cs);
24
d[(_7?"addClass":"removeClass")](_5,_6);
25
var _9=_1(cs);
26
d[(_7?"removeClass":"addClass")](_5,_6);
27
var _a={},i=0;
28
d.forEach(dojox.fx._allowedProperties,function(_b){
29
if(_8[i]!=_9[i]){
30
_a[_b]=parseInt(_9[i]);
31
}
32
i++;
33
});
34
return _a;
35
};
36
d.mixin(dojox.fx,{addClass:function(_c,_d,_e){
37
_c=d.byId(_c);
38
var _f=(function(n){
39
return function(){
40
d.addClass(n,_d);
41
n.style.cssText=_10;
42
};
43
})(_c);
44
var _11=_4(_c,_d,true);
45
var _10=_c.style.cssText;
46
var _12=d.animateProperty(d.mixin({node:_c,properties:_11},_e));
47
d.connect(_12,"onEnd",_12,_f);
48
return _12;
49
},removeClass:function(_13,_14,_15){
50
_13=d.byId(_13);
51
var _16=(function(n){
52
return function(){
53
d.removeClass(n,_14);
54
n.style.cssText=_17;
55
};
56
})(_13);
57
var _18=_4(_13,_14);
58
var _17=_13.style.cssText;
59
var _19=d.animateProperty(d.mixin({node:_13,properties:_18},_15));
60
d.connect(_19,"onEnd",_19,_16);
61
return _19;
62
},toggleClass:function(_1a,_1b,_1c,_1d){
63
if(typeof _1c=="undefined"){
64
_1c=!d.hasClass(_1a,_1b);
65
}
66
return dojox.fx[(_1c?"addClass":"removeClass")](_1a,_1b,_1d);
67
},_allowedProperties:["width","height","left","top","backgroundColor","color","borderBottomWidth","borderTopWidth","borderLeftWidth","borderRightWidth","paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginTop","marginRight","marginBottom","lineHeight","letterSpacing","fontSize"]});
68
})();
69
}