diff options
author | Scott González <scott.gonzalez@gmail.com> | 2012-04-02 19:12:21 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2012-04-02 19:12:21 -0400 |
commit | 639afa595465f6a1f61e080f2b671af4aac69b4a (patch) | |
tree | cab8f18e790d7646677ca0207d21025c9c708428 /ui/jquery.effects.core.js | |
parent | 3e6877a892b8fb70f1130f639dfde09ce5af6236 (diff) | |
download | jquery-ui-639afa595465f6a1f61e080f2b671af4aac69b4a.tar.gz jquery-ui-639afa595465f6a1f61e080f2b671af4aac69b4a.zip |
Lint fixes.
Diffstat (limited to 'ui/jquery.effects.core.js')
-rw-r--r-- | ui/jquery.effects.core.js | 74 |
1 files changed, 46 insertions, 28 deletions
diff --git a/ui/jquery.effects.core.js b/ui/jquery.effects.core.js index 62d6b2c38..1d56ae62f 100644 --- a/ui/jquery.effects.core.js +++ b/ui/jquery.effects.core.js @@ -7,9 +7,11 @@ * * http://docs.jquery.com/UI/Effects/ */ -;jQuery.effects || (function($, undefined) { +;(jQuery.effects || (function($, undefined) { -var backCompat = $.uiBackCompat !== false; +var backCompat = $.uiBackCompat !== false, + // prefix used for storing data on .data() + dataSpace = "ui-effects-"; $.effects = { effect: {} @@ -18,6 +20,7 @@ $.effects = { /******************************************************************************/ /****************************** COLOR ANIMATIONS ******************************/ /******************************************************************************/ +(function() { // override the animation for color styles $.each(["backgroundColor", "borderBottomColor", "borderLeftColor", @@ -46,28 +49,34 @@ function getRGB(color) { var result; // Check if we're already dealing with an array of colors - if ( color && color.constructor === Array && color.length === 3 ) - return color; + if ( color && color.constructor === Array && color.length === 3 ) { + return color; + } // Look for rgb(num,num,num) - if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) - return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)]; + if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) { + return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)]; + } // Look for rgb(num%,num%,num%) - if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color)) - return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55]; + if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color)) { + return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55]; + } // Look for #a0b1c2 - if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) - return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)]; + if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) { + return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)]; + } // Look for #fff - if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) - return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)]; + if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) { + return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)]; + } // Look for rgba(0, 0, 0, 0) == transparent in Safari 3 - if (result = /rgba\(0, 0, 0, 0\)/.exec(color)) - return colors["transparent"]; + if (result = /rgba\(0, 0, 0, 0\)/.exec(color)) { + return colors.transparent; + } // Otherwise, we're most likely dealing with a named color return colors[$.trim(color).toLowerCase()]; @@ -80,14 +89,15 @@ function getColor(elem, attr) { color = $.css(elem, attr); // Keep going until we find an element that has color, or we hit the body - if ( color != "" && color !== "transparent" || $.nodeName(elem, "body") ) - break; + if ( color && color !== "transparent" || $.nodeName(elem, "body") ) { + break; + } attr = "backgroundColor"; } while ( elem = elem.parentNode ); return getRGB(color); -}; +} // Some named colors to work with // From Interface by Stefan Petre @@ -140,11 +150,12 @@ var colors = { transparent: [255,255,255] }; - +})(); /******************************************************************************/ /****************************** CLASS ANIMATIONS ******************************/ /******************************************************************************/ +(function() { var classAnimationActions = [ "add", "remove", "toggle" ], shorthandStyles = { @@ -157,9 +168,7 @@ var classAnimationActions = [ "add", "remove", "toggle" ], borderWidth: 1, margin: 1, padding: 1 - }, - // prefix used for storing data on .data() - dataSpace = "ui-effects-"; + }; $.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function( _, prop ) { $.fx.step[ prop ] = function( fx ) { @@ -206,7 +215,7 @@ function styleDifference( oldStyle, newStyle ) { for ( name in newStyle ) { value = newStyle[ name ]; - if ( oldStyle[ name ] != value ) { + if ( oldStyle[ name ] !== value ) { if ( !shorthandStyles[ name ] ) { if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) { diff[ name ] = value; @@ -332,12 +341,14 @@ $.fn.extend({ } }); - +})(); /******************************************************************************/ /*********************************** EFFECTS **********************************/ /******************************************************************************/ +(function() { + $.extend( $.effects, { version: "@VERSION", @@ -473,9 +484,11 @@ $.extend( $.effects, { setTransition: function( element, list, factor, value ) { value = value || {}; - $.each( list, function(i, x){ + $.each( list, function( i, x ) { var unit = element.cssUnit( x ); - if ( unit[ 0 ] > 0 ) value[ x ] = unit[ 0 ] * factor + unit[ 1 ]; + if ( unit[ 0 ] > 0 ) { + value[ x ] = unit[ 0 ] * factor + unit[ 1 ]; + } }); return value; } @@ -651,19 +664,22 @@ $.fn.extend({ val = []; $.each( [ "em", "px", "%", "pt" ], function( i, unit ) { - if ( style.indexOf( unit ) > 0 ) + if ( style.indexOf( unit ) > 0 ) { val = [ parseFloat( style ), unit ]; + } }); return val; } }); - +})(); /******************************************************************************/ /*********************************** EASING ***********************************/ /******************************************************************************/ +(function() { + // based on easing equations from Robert Penner (http://www.robertpenner.com/easing) var baseEasings = {}; @@ -709,4 +725,6 @@ $.each( baseEasings, function( name, easeIn ) { }; }); -})(jQuery); +})(); + +})(jQuery)); |