Skip to content

Commit 639afa5

Browse files
committed
Lint fixes.
1 parent 3e6877a commit 639afa5

18 files changed

+207
-164
lines changed

ui/jquery.effects.core.js

Lines changed: 46 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
*
88
* http://docs.jquery.com/UI/Effects/
99
*/
10-
;jQuery.effects || (function($, undefined) {
10+
;(jQuery.effects || (function($, undefined) {
1111

12-
var backCompat = $.uiBackCompat !== false;
12+
var backCompat = $.uiBackCompat !== false,
13+
// prefix used for storing data on .data()
14+
dataSpace = "ui-effects-";
1315

1416
$.effects = {
1517
effect: {}
@@ -18,6 +20,7 @@ $.effects = {
1820
/******************************************************************************/
1921
/****************************** COLOR ANIMATIONS ******************************/
2022
/******************************************************************************/
23+
(function() {
2124

2225
// override the animation for color styles
2326
$.each(["backgroundColor", "borderBottomColor", "borderLeftColor",
@@ -46,28 +49,34 @@ function getRGB(color) {
4649
var result;
4750

4851
// 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+
}
5155

5256
// Look for rgb(num,num,num)
53-
if (result = /rgb\(\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 = /rgb\(\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+
}
5560

5661
// Look for rgb(num%,num%,num%)
57-
if (result = /rgb\(\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 = /rgb\(\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+
}
5965

6066
// Look for #a0b1c2
61-
if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
62-
return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
67+
if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) {
68+
return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
69+
}
6370

6471
// Look for #fff
65-
if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-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-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) {
73+
return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
74+
}
6775

6876
// Look for rgba(0, 0, 0, 0) == transparent in Safari 3
69-
if (result = /rgba\(0, 0, 0, 0\)/.exec(color))
70-
return colors["transparent"];
77+
if (result = /rgba\(0, 0, 0, 0\)/.exec(color)) {
78+
return colors.transparent;
79+
}
7180

7281
// Otherwise, we're most likely dealing with a named color
7382
return colors[$.trim(color).toLowerCase()];
@@ -80,14 +89,15 @@ function getColor(elem, attr) {
8089
color = $.css(elem, attr);
8190

8291
// 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+
}
8595

8696
attr = "backgroundColor";
8797
} while ( elem = elem.parentNode );
8898

8999
return getRGB(color);
90-
};
100+
}
91101

92102
// Some named colors to work with
93103
// From Interface by Stefan Petre
@@ -140,11 +150,12 @@ var colors = {
140150
transparent: [255,255,255]
141151
};
142152

143-
153+
})();
144154

145155
/******************************************************************************/
146156
/****************************** CLASS ANIMATIONS ******************************/
147157
/******************************************************************************/
158+
(function() {
148159

149160
var classAnimationActions = [ "add", "remove", "toggle" ],
150161
shorthandStyles = {
@@ -157,9 +168,7 @@ var classAnimationActions = [ "add", "remove", "toggle" ],
157168
borderWidth: 1,
158169
margin: 1,
159170
padding: 1
160-
},
161-
// prefix used for storing data on .data()
162-
dataSpace = "ui-effects-";
171+
};
163172

164173
$.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function( _, prop ) {
165174
$.fx.step[ prop ] = function( fx ) {
@@ -206,7 +215,7 @@ function styleDifference( oldStyle, newStyle ) {
206215

207216
for ( name in newStyle ) {
208217
value = newStyle[ name ];
209-
if ( oldStyle[ name ] != value ) {
218+
if ( oldStyle[ name ] !== value ) {
210219
if ( !shorthandStyles[ name ] ) {
211220
if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) {
212221
diff[ name ] = value;
@@ -332,12 +341,14 @@ $.fn.extend({
332341
}
333342
});
334343

335-
344+
})();
336345

337346
/******************************************************************************/
338347
/*********************************** EFFECTS **********************************/
339348
/******************************************************************************/
340349

350+
(function() {
351+
341352
$.extend( $.effects, {
342353
version: "@VERSION",
343354

@@ -473,9 +484,11 @@ $.extend( $.effects, {
473484

474485
setTransition: function( element, list, factor, value ) {
475486
value = value || {};
476-
$.each( list, function(i, x){
487+
$.each( list, function( i, x ) {
477488
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+
}
479492
});
480493
return value;
481494
}
@@ -651,19 +664,22 @@ $.fn.extend({
651664
val = [];
652665

653666
$.each( [ "em", "px", "%", "pt" ], function( i, unit ) {
654-
if ( style.indexOf( unit ) > 0 )
667+
if ( style.indexOf( unit ) > 0 ) {
655668
val = [ parseFloat( style ), unit ];
669+
}
656670
});
657671
return val;
658672
}
659673
});
660674

661-
675+
})();
662676

663677
/******************************************************************************/
664678
/*********************************** EASING ***********************************/
665679
/******************************************************************************/
666680

681+
(function() {
682+
667683
// based on easing equations from Robert Penner (http://www.robertpenner.com/easing)
668684

669685
var baseEasings = {};
@@ -709,4 +725,6 @@ $.each( baseEasings, function( name, easeIn ) {
709725
};
710726
});
711727

712-
})(jQuery);
728+
})();
729+
730+
})(jQuery));

ui/jquery.effects.explode.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ $.effects.effect.explode = function( o, done ) {
3131
// loop
3232
i, j, left, top, mx, my;
3333

34+
// children animate complete:
35+
function childComplete() {
36+
pieces.push( this );
37+
if ( pieces.length === rows * cells ) {
38+
animComplete();
39+
}
40+
}
41+
3442
// clone the element for each row and cell.
3543
for( i = 0; i < rows ; i++ ) { // ===>
3644
top = offset.top + i * height;
@@ -73,14 +81,6 @@ $.effects.effect.explode = function( o, done ) {
7381
}
7482
}
7583

76-
// children animate complete:
77-
function childComplete() {
78-
pieces.push( this );
79-
if ( pieces.length == rows * cells ) {
80-
animComplete();
81-
}
82-
}
83-
8484
function animComplete() {
8585
el.css({
8686
visibility: "visible"

ui/jquery.effects.fold.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@ $.effects.effect.fold = function( o, done ) {
2323
size = o.size || 15,
2424
percent = /([0-9]+)%/.exec( size ),
2525
horizFirst = !!o.horizFirst,
26-
widthFirst = show != horizFirst,
26+
widthFirst = show !== horizFirst,
2727
ref = widthFirst ? [ "width", "height" ] : [ "height", "width" ],
2828
duration = o.duration / 2,
2929
wrapper, distance,
30-
animation1 = {}, animation2 = {};
30+
animation1 = {},
31+
animation2 = {};
3132

3233
$.effects.save( el, props );
3334
el.show();

ui/jquery.effects.scale.js

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ $.effects.effect.scale = function( o, done ) {
4747
var el = $( this ),
4848
options = $.extend( true, {}, o ),
4949
mode = $.effects.setMode( el, o.mode || "effect" ),
50-
percent = parseInt( o.percent, 10 ) || ( parseInt( o.percent, 10 ) === 0 ? 0 : ( mode == "hide" ? 0 : 100 ) ),
50+
percent = parseInt( o.percent, 10 ) ||
51+
( parseInt( o.percent, 10 ) === 0 ? 0 : ( mode === "hide" ? 0 : 100 ) ),
5152
direction = o.direction || "both",
5253
origin = o.origin,
5354
original = {
@@ -57,8 +58,8 @@ $.effects.effect.scale = function( o, done ) {
5758
outerWidth: el.outerWidth()
5859
},
5960
factor = {
60-
y: direction != "horizontal" ? (percent / 100) : 1,
61-
x: direction != "vertical" ? (percent / 100) : 1
61+
y: direction !== "horizontal" ? (percent / 100) : 1,
62+
x: direction !== "vertical" ? (percent / 100) : 1
6263
};
6364

6465
// We are going to pass this effect to the size effect:
@@ -67,12 +68,12 @@ $.effects.effect.scale = function( o, done ) {
6768
options.complete = done;
6869

6970
// Set default origin and restore for show/hide
70-
if ( mode != "effect" ) {
71+
if ( mode !== "effect" ) {
7172
options.origin = origin || ["middle","center"];
7273
options.restore = true;
7374
}
7475

75-
options.from = o.from || ( mode == "show" ? { height: 0, width: 0 } : original );
76+
options.from = o.from || ( mode === "show" ? { height: 0, width: 0 } : original );
7677
options.to = {
7778
height: original.height * factor.y,
7879
width: original.width * factor.x,
@@ -82,11 +83,11 @@ $.effects.effect.scale = function( o, done ) {
8283

8384
// Fade option to support puff
8485
if ( options.fade ) {
85-
if ( mode == "show" ) {
86+
if ( mode === "show" ) {
8687
options.from.opacity = 0;
8788
options.to.opacity = 1;
8889
}
89-
if ( mode == "hide" ) {
90+
if ( mode === "hide" ) {
9091
options.from.opacity = 1;
9192
options.to.opacity = 0;
9293
}
@@ -146,7 +147,7 @@ $.effects.effect.size = function( o, done ) {
146147
};
147148

148149
// Scale the css box
149-
if ( scale == "box" || scale == "both" ) {
150+
if ( scale === "box" || scale === "both" ) {
150151

151152
// Vertical props scaling
152153
if ( factor.from.y !== factor.to.y ) {
@@ -164,7 +165,7 @@ $.effects.effect.size = function( o, done ) {
164165
}
165166

166167
// Scale the content
167-
if ( scale == "content" || scale == "both" ) {
168+
if ( scale === "content" || scale === "both" ) {
168169

169170
// Vertical props scaling
170171
if ( factor.from.y !== factor.to.y ) {
@@ -190,7 +191,7 @@ $.effects.effect.size = function( o, done ) {
190191
el.css( el.from ); // set top & left
191192

192193
// Animate
193-
if ( scale == "content" || scale == "both" ) { // Scale the children
194+
if ( scale === "content" || scale === "both" ) { // Scale the children
194195

195196
// Add margins/font-size
196197
vProps = vProps.concat([ "marginTop", "marginBottom" ]).concat(cProps);
@@ -203,8 +204,10 @@ $.effects.effect.size = function( o, done ) {
203204
height: child.height(),
204205
width: child.width()
205206
};
206-
if (restore) $.effects.save(child, props2);
207-
207+
if (restore) {
208+
$.effects.save(child, props2);
209+
}
210+
208211
child.from = {
209212
height: c_original.height * factor.from.y,
210213
width: c_original.width * factor.from.x
@@ -215,13 +218,13 @@ $.effects.effect.size = function( o, done ) {
215218
};
216219

217220
// Vertical props scaling
218-
if ( factor.from.y != factor.to.y ) {
221+
if ( factor.from.y !== factor.to.y ) {
219222
child.from = $.effects.setTransition( child, vProps, factor.from.y, child.from );
220223
child.to = $.effects.setTransition( child, vProps, factor.to.y, child.to );
221224
}
222225

223226
// Horizontal props scaling
224-
if ( factor.from.x != factor.to.x ) {
227+
if ( factor.from.x !== factor.to.x ) {
225228
child.from = $.effects.setTransition( child, hProps, factor.from.x, child.from );
226229
child.to = $.effects.setTransition( child, hProps, factor.to.x, child.to );
227230
}
@@ -231,7 +234,9 @@ $.effects.effect.size = function( o, done ) {
231234
child.animate( child.to, o.duration, o.easing, function() {
232235

233236
// Restore children
234-
if (restore) $.effects.restore( child, props2 );
237+
if ( restore ) {
238+
$.effects.restore( child, props2 );
239+
}
235240
});
236241
});
237242
}
@@ -245,7 +250,7 @@ $.effects.effect.size = function( o, done ) {
245250
if ( el.to.opacity === 0 ) {
246251
el.css( "opacity", el.from.opacity );
247252
}
248-
if( mode == "hide" ) {
253+
if( mode === "hide" ) {
249254
el.hide();
250255
}
251256
$.effects.restore( el, restore ? props : props1 );

ui/jquery.effects.shake.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ $.effects.effect.shake = function( o, done ) {
2222
times = o.times || 3,
2323
anims = times * 2 + 1,
2424
speed = o.duration,
25-
ref = (direction == "up" || direction == "down") ? "top" : "left",
26-
positiveMotion = (direction == "up" || direction == "left"),
25+
ref = (direction === "up" || direction === "down") ? "top" : "left",
26+
positiveMotion = (direction === "up" || direction === "left"),
2727
animation = {},
2828
animation1 = {},
2929
animation2 = {},
@@ -32,7 +32,6 @@ $.effects.effect.shake = function( o, done ) {
3232
// we will need to re-assemble the queue to stack our animations in place
3333
queue = el.queue(),
3434
queuelen = queue.length;
35-
3635

3736
$.effects.save( el, props );
3837
el.show();

ui/jquery.effects.slide.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ $.effects.effect.slide = function( o, done ) {
2020
mode = $.effects.setMode( el, o.mode || "show" ),
2121
show = mode === "show",
2222
direction = o.direction || "left",
23-
ref = (direction == "up" || direction == "down") ? "top" : "left",
24-
positiveMotion = (direction == "up" || direction == "left"),
23+
ref = (direction === "up" || direction === "down") ? "top" : "left",
24+
positiveMotion = (direction === "up" || direction === "left"),
2525
distance,
2626
animation = {},
2727
size;

0 commit comments

Comments
 (0)