7
7
*
8
8
* http://docs.jquery.com/UI/Effects/
9
9
*/
10
- ; jQuery . effects || ( function ( $ , undefined ) {
10
+ ; ( jQuery . effects || ( function ( $ , undefined ) {
11
11
12
- var backCompat = $ . uiBackCompat !== false ;
12
+ var backCompat = $ . uiBackCompat !== false ,
13
+ // prefix used for storing data on .data()
14
+ dataSpace = "ui-effects-" ;
13
15
14
16
$ . effects = {
15
17
effect : { }
@@ -18,6 +20,7 @@ $.effects = {
18
20
/******************************************************************************/
19
21
/****************************** COLOR ANIMATIONS ******************************/
20
22
/******************************************************************************/
23
+ ( function ( ) {
21
24
22
25
// override the animation for color styles
23
26
$ . each ( [ "backgroundColor" , "borderBottomColor" , "borderLeftColor" ,
@@ -46,28 +49,34 @@ function getRGB(color) {
46
49
var result ;
47
50
48
51
// Check if we're already dealing with an array of colors
49
- if ( color && color . constructor === Array && color . length === 3 )
50
- return color ;
52
+ if ( color && color . constructor === Array && color . length === 3 ) {
53
+ return color ;
54
+ }
51
55
52
56
// Look for rgb(num,num,num)
53
- if ( result = / r g b \( \s * ( [ 0 - 9 ] { 1 , 3 } ) \s * , \s * ( [ 0 - 9 ] { 1 , 3 } ) \s * , \s * ( [ 0 - 9 ] { 1 , 3 } ) \s * \) / . exec ( color ) )
54
- return [ parseInt ( result [ 1 ] , 10 ) , parseInt ( result [ 2 ] , 10 ) , parseInt ( result [ 3 ] , 10 ) ] ;
57
+ if ( result = / r g b \( \s * ( [ 0 - 9 ] { 1 , 3 } ) \s * , \s * ( [ 0 - 9 ] { 1 , 3 } ) \s * , \s * ( [ 0 - 9 ] { 1 , 3 } ) \s * \) / . exec ( color ) ) {
58
+ return [ parseInt ( result [ 1 ] , 10 ) , parseInt ( result [ 2 ] , 10 ) , parseInt ( result [ 3 ] , 10 ) ] ;
59
+ }
55
60
56
61
// Look for rgb(num%,num%,num%)
57
- if ( result = / r g b \( \s * ( [ 0 - 9 ] + (?: \. [ 0 - 9 ] + ) ? ) \% \s * , \s * ( [ 0 - 9 ] + (?: \. [ 0 - 9 ] + ) ? ) \% \s * , \s * ( [ 0 - 9 ] + (?: \. [ 0 - 9 ] + ) ? ) \% \s * \) / . exec ( color ) )
58
- return [ parseFloat ( result [ 1 ] ) * 2.55 , parseFloat ( result [ 2 ] ) * 2.55 , parseFloat ( result [ 3 ] ) * 2.55 ] ;
62
+ if ( result = / r g b \( \s * ( [ 0 - 9 ] + (?: \. [ 0 - 9 ] + ) ? ) \% \s * , \s * ( [ 0 - 9 ] + (?: \. [ 0 - 9 ] + ) ? ) \% \s * , \s * ( [ 0 - 9 ] + (?: \. [ 0 - 9 ] + ) ? ) \% \s * \) / . exec ( color ) ) {
63
+ return [ parseFloat ( result [ 1 ] ) * 2.55 , parseFloat ( result [ 2 ] ) * 2.55 , parseFloat ( result [ 3 ] ) * 2.55 ] ;
64
+ }
59
65
60
66
// Look for #a0b1c2
61
- if ( result = / # ( [ a - f A - F 0 - 9 ] { 2 } ) ( [ a - f A - F 0 - 9 ] { 2 } ) ( [ a - f A - F 0 - 9 ] { 2 } ) / . exec ( color ) )
62
- return [ parseInt ( result [ 1 ] , 16 ) , parseInt ( result [ 2 ] , 16 ) , parseInt ( result [ 3 ] , 16 ) ] ;
67
+ if ( result = / # ( [ a - f A - F 0 - 9 ] { 2 } ) ( [ a - f A - F 0 - 9 ] { 2 } ) ( [ a - f A - F 0 - 9 ] { 2 } ) / . exec ( color ) ) {
68
+ return [ parseInt ( result [ 1 ] , 16 ) , parseInt ( result [ 2 ] , 16 ) , parseInt ( result [ 3 ] , 16 ) ] ;
69
+ }
63
70
64
71
// Look for #fff
65
- if ( result = / # ( [ a - f A - F 0 - 9 ] ) ( [ a - f A - F 0 - 9 ] ) ( [ a - f A - F 0 - 9 ] ) / . exec ( color ) )
66
- return [ parseInt ( result [ 1 ] + result [ 1 ] , 16 ) , parseInt ( result [ 2 ] + result [ 2 ] , 16 ) , parseInt ( result [ 3 ] + result [ 3 ] , 16 ) ] ;
72
+ if ( result = / # ( [ a - f A - F 0 - 9 ] ) ( [ a - f A - F 0 - 9 ] ) ( [ a - f A - F 0 - 9 ] ) / . exec ( color ) ) {
73
+ return [ parseInt ( result [ 1 ] + result [ 1 ] , 16 ) , parseInt ( result [ 2 ] + result [ 2 ] , 16 ) , parseInt ( result [ 3 ] + result [ 3 ] , 16 ) ] ;
74
+ }
67
75
68
76
// Look for rgba(0, 0, 0, 0) == transparent in Safari 3
69
- if ( result = / r g b a \( 0 , 0 , 0 , 0 \) / . exec ( color ) )
70
- return colors [ "transparent" ] ;
77
+ if ( result = / r g b a \( 0 , 0 , 0 , 0 \) / . exec ( color ) ) {
78
+ return colors . transparent ;
79
+ }
71
80
72
81
// Otherwise, we're most likely dealing with a named color
73
82
return colors [ $ . trim ( color ) . toLowerCase ( ) ] ;
@@ -80,14 +89,15 @@ function getColor(elem, attr) {
80
89
color = $ . css ( elem , attr ) ;
81
90
82
91
// Keep going until we find an element that has color, or we hit the body
83
- if ( color != "" && color !== "transparent" || $ . nodeName ( elem , "body" ) )
84
- break ;
92
+ if ( color && color !== "transparent" || $ . nodeName ( elem , "body" ) ) {
93
+ break ;
94
+ }
85
95
86
96
attr = "backgroundColor" ;
87
97
} while ( elem = elem . parentNode ) ;
88
98
89
99
return getRGB ( color ) ;
90
- } ;
100
+ }
91
101
92
102
// Some named colors to work with
93
103
// From Interface by Stefan Petre
@@ -140,11 +150,12 @@ var colors = {
140
150
transparent : [ 255 , 255 , 255 ]
141
151
} ;
142
152
143
-
153
+ } ) ( ) ;
144
154
145
155
/******************************************************************************/
146
156
/****************************** CLASS ANIMATIONS ******************************/
147
157
/******************************************************************************/
158
+ ( function ( ) {
148
159
149
160
var classAnimationActions = [ "add" , "remove" , "toggle" ] ,
150
161
shorthandStyles = {
@@ -157,9 +168,7 @@ var classAnimationActions = [ "add", "remove", "toggle" ],
157
168
borderWidth : 1 ,
158
169
margin : 1 ,
159
170
padding : 1
160
- } ,
161
- // prefix used for storing data on .data()
162
- dataSpace = "ui-effects-" ;
171
+ } ;
163
172
164
173
$ . each ( [ "borderLeftStyle" , "borderRightStyle" , "borderBottomStyle" , "borderTopStyle" ] , function ( _ , prop ) {
165
174
$ . fx . step [ prop ] = function ( fx ) {
@@ -206,7 +215,7 @@ function styleDifference( oldStyle, newStyle ) {
206
215
207
216
for ( name in newStyle ) {
208
217
value = newStyle [ name ] ;
209
- if ( oldStyle [ name ] != value ) {
218
+ if ( oldStyle [ name ] !== value ) {
210
219
if ( ! shorthandStyles [ name ] ) {
211
220
if ( $ . fx . step [ name ] || ! isNaN ( parseFloat ( value ) ) ) {
212
221
diff [ name ] = value ;
@@ -332,12 +341,14 @@ $.fn.extend({
332
341
}
333
342
} ) ;
334
343
335
-
344
+ } ) ( ) ;
336
345
337
346
/******************************************************************************/
338
347
/*********************************** EFFECTS **********************************/
339
348
/******************************************************************************/
340
349
350
+ ( function ( ) {
351
+
341
352
$ . extend ( $ . effects , {
342
353
version : "@VERSION" ,
343
354
@@ -473,9 +484,11 @@ $.extend( $.effects, {
473
484
474
485
setTransition : function ( element , list , factor , value ) {
475
486
value = value || { } ;
476
- $ . each ( list , function ( i , x ) {
487
+ $ . each ( list , function ( i , x ) {
477
488
var unit = element . cssUnit ( x ) ;
478
- if ( unit [ 0 ] > 0 ) value [ x ] = unit [ 0 ] * factor + unit [ 1 ] ;
489
+ if ( unit [ 0 ] > 0 ) {
490
+ value [ x ] = unit [ 0 ] * factor + unit [ 1 ] ;
491
+ }
479
492
} ) ;
480
493
return value ;
481
494
}
@@ -651,19 +664,22 @@ $.fn.extend({
651
664
val = [ ] ;
652
665
653
666
$ . each ( [ "em" , "px" , "%" , "pt" ] , function ( i , unit ) {
654
- if ( style . indexOf ( unit ) > 0 )
667
+ if ( style . indexOf ( unit ) > 0 ) {
655
668
val = [ parseFloat ( style ) , unit ] ;
669
+ }
656
670
} ) ;
657
671
return val ;
658
672
}
659
673
} ) ;
660
674
661
-
675
+ } ) ( ) ;
662
676
663
677
/******************************************************************************/
664
678
/*********************************** EASING ***********************************/
665
679
/******************************************************************************/
666
680
681
+ ( function ( ) {
682
+
667
683
// based on easing equations from Robert Penner (http://www.robertpenner.com/easing)
668
684
669
685
var baseEasings = { } ;
@@ -709,4 +725,6 @@ $.each( baseEasings, function( name, easeIn ) {
709
725
} ;
710
726
} ) ;
711
727
712
- } ) ( jQuery ) ;
728
+ } ) ( ) ;
729
+
730
+ } ) ( jQuery ) ) ;
0 commit comments