Skip to content

Commit

Permalink
Effects.core: Style Commit - double-quotes and threeqals and whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
gnarf committed May 12, 2011
1 parent c89bbc1 commit c241275
Showing 1 changed file with 65 additions and 65 deletions.
130 changes: 65 additions & 65 deletions ui/jquery.effects.core.js
Expand Up @@ -20,8 +20,8 @@ $.effects = {
/******************************************************************************/

// override the animation for color styles
$.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor',
'borderRightColor', 'borderTopColor', 'borderColor', 'color', 'outlineColor'],
$.each(["backgroundColor", "borderBottomColor", "borderLeftColor",
"borderRightColor", "borderTopColor", "borderColor", "color", "outlineColor"],
function(i, attr) {
$.fx.step[attr] = function(fx) {
if (!fx.colorInit) {
Expand All @@ -30,10 +30,10 @@ function(i, attr) {
fx.colorInit = true;
}

fx.elem.style[attr] = 'rgb(' +
Math.max(Math.min(parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0], 10), 255), 0) + ',' +
Math.max(Math.min(parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1], 10), 255), 0) + ',' +
Math.max(Math.min(parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2], 10), 255), 0) + ')';
fx.elem.style[attr] = "rgb(" +
Math.max(Math.min(parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0], 10), 255), 0) + "," +
Math.max(Math.min(parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1], 10), 255), 0) + "," +
Math.max(Math.min(parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2], 10), 255), 0) + ")";
};
});

Expand All @@ -46,7 +46,7 @@ function getRGB(color) {
var result;

// Check if we're already dealing with an array of colors
if ( color && color.constructor == Array && color.length == 3 )
if ( color && color.constructor === Array && color.length === 3 )
return color;

// Look for rgb(num,num,num)
Expand All @@ -67,7 +67,7 @@ function getRGB(color) {

// Look for rgba(0, 0, 0, 0) == transparent in Safari 3
if (result = /rgba\(0, 0, 0, 0\)/.exec(color))
return colors['transparent'];
return colors["transparent"];

// Otherwise, we're most likely dealing with a named color
return colors[$.trim(color).toLowerCase()];
Expand All @@ -80,7 +80,7 @@ function getColor(elem, attr) {
color = $.curCSS(elem, attr);

// Keep going until we find an element that has color, or we hit the body
if ( color != '' && color != 'transparent' || $.nodeName(elem, "body") )
if ( color != "" && color !== "transparent" || $.nodeName(elem, "body") )
break;

attr = "backgroundColor";
Expand Down Expand Up @@ -160,15 +160,15 @@ var classAnimationActions = [ "add", "remove", "toggle" ],
},
// prefix used for storing data on .data()
dataSpace = "ec.storage.";

$.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function(_, prop) {
$.fx.step[ prop ] = function( fx ) {
if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) {
jQuery.style( fx.elem, prop, fx.end );
fx.setAttr = true;
}
};
})
});

function getElementStyles() {
var style = document.defaultView
Expand Down Expand Up @@ -225,7 +225,7 @@ $.effects.animateClass = function( value, duration, easing, callback ) {
var animated = $( this ),
baseClass = animated.attr( "class" ),
finalClass,
originalStyleAttr = animated.attr( "style" ) || ' ',
originalStyleAttr = animated.attr( "style" ) || " ",
originalStyle = getElementStyles.call( this ),
newStyle,
diff,
Expand All @@ -249,11 +249,11 @@ $.effects.animateClass = function( value, duration, easing, callback ) {
complete: function() {
animated.attr( "class", finalClass );

if ( typeof animated.attr( 'style' ) == 'object' ) {
animated.attr( 'style' ).cssText = '';
animated.attr( 'style' ).cssText = originalStyleAttr;
if ( typeof animated.attr( "style" ) === "object" ) {
animated.attr( "style" ).cssText = "";
animated.attr( "style" ).cssText = originalStyleAttr;
} else {
animated.attr( 'style', originalStyleAttr );
animated.attr( "style", originalStyleAttr );
}

// this is guarnteed to be there if you use jQuery.speed()
Expand All @@ -267,21 +267,21 @@ $.effects.animateClass = function( value, duration, easing, callback ) {
$.fn.extend({
_addClass: $.fn.addClass,
addClass: function( classNames, speed, easing, callback ) {
return speed ?
return speed ?
$.effects.animateClass.apply( this, [{ add: classNames }, speed, easing, callback ]) :
this._addClass(classNames);
},

_removeClass: $.fn.removeClass,
removeClass: function( classNames, speed, easing, callback ) {
return speed ?
return speed ?
$.effects.animateClass.apply( this, [{ remove: classNames }, speed, easing, callback ]) :
this._removeClass(classNames);
},

_toggleClass: $.fn.toggleClass,
toggleClass: function( classNames, force, speed, easing, callback ) {
if ( typeof force == "boolean" || force === undefined ) {
if ( typeof force === "boolean" || force === undefined ) {
if ( !speed ) {
// without speed parameter;
return this._toggleClass( classNames, force );
Expand All @@ -295,9 +295,9 @@ $.fn.extend({
},

switchClass: function( remove, add, speed, easing, callback) {
return $.effects.animateClass.apply( this, [{
add: add,
remove: remove
return $.effects.animateClass.apply( this, [{
add: add,
remove: remove
}, speed, easing, callback ]);
}
});
Expand Down Expand Up @@ -330,26 +330,26 @@ $.extend( $.effects, {
},

setMode: function( el, mode ) {
if (mode == 'toggle') {
mode = el.is( ':hidden' ) ? 'show' : 'hide';
if (mode === "toggle") {
mode = el.is( ":hidden" ) ? "show" : "hide";
}
return mode;
},

// Translates a [top,left] array into a baseline value
// this should be a little more flexible in the future to handle a string & hash
getBaseline: function( origin, original ) {
getBaseline: function( origin, original ) {
var y, x;
switch ( origin[ 0 ] ) {
case 'top': y = 0; break;
case 'middle': y = 0.5; break;
case 'bottom': y = 1; break;
case "top": y = 0; break;
case "middle": y = 0.5; break;
case "bottom": y = 1; break;
default: y = origin[ 0 ] / original.height;
};
switch ( origin[ 1 ] ) {
case 'left': x = 0; break;
case 'center': x = 0.5; break;
case 'right': x = 1; break;
case "left": x = 0; break;
case "center": x = 0.5; break;
case "right": x = 1; break;
default: x = origin[ 1 ] / original.width;
};
return {
Expand All @@ -362,22 +362,22 @@ $.extend( $.effects, {
createWrapper: function( element ) {

// if the element is already wrapped, return it
if ( element.parent().is( '.ui-effects-wrapper' )) {
if ( element.parent().is( ".ui-effects-wrapper" )) {
return element.parent();
}

// wrap the element
var props = {
width: element.outerWidth(true),
height: element.outerHeight(true),
'float': element.css( 'float' )
"float": element.css( "float" )
},
wrapper = $( '<div></div>' )
.addClass( 'ui-effects-wrapper' )
wrapper = $( "<div></div>" )
.addClass( "ui-effects-wrapper" )
.css({
fontSize: '100%',
background: 'transparent',
border: 'none',
fontSize: "100%",
background: "transparent",
border: "none",
margin: 0,
padding: 0
});
Expand All @@ -386,34 +386,34 @@ $.extend( $.effects, {
wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually loose the reference to the wrapped element

// transfer positioning properties to the wrapper
if ( element.css( 'position' ) == 'static' ) {
wrapper.css({ position: 'relative' });
element.css({ position: 'relative' });
if ( element.css( "position" ) === "static" ) {
wrapper.css({ position: "relative" });
element.css({ position: "relative" });
} else {
$.extend( props, {
position: element.css( 'position' ),
zIndex: element.css( 'z-index' )
position: element.css( "position" ),
zIndex: element.css( "z-index" )
});
$.each([ 'top', 'left', 'bottom', 'right' ], function(i, pos) {
$.each([ "top", "left", "bottom", "right" ], function(i, pos) {
props[ pos ] = element.css( pos );
if ( isNaN( parseInt( props[ pos ], 10 ) ) ) {
props[ pos ] = 'auto';
props[ pos ] = "auto";
}
});
element.css({
position: 'relative',
position: "relative",
top: 0,
left: 0,
right: 'auto',
bottom: 'auto'
right: "auto",
bottom: "auto"
});
}

return wrapper.css( props ).show();
},

removeWrapper: function( element ) {
if ( element.parent().is( '.ui-effects-wrapper' ) )
if ( element.parent().is( ".ui-effects-wrapper" ) )
return element.parent().replaceWith( element );
return element;
},
Expand Down Expand Up @@ -452,7 +452,7 @@ function _normalizeArguments( effect, options, speed, callback ) {
}

// catch (effect, speed, ?)
if ( $.type( options ) == 'number' || $.fx.speeds[ options ]) {
if ( $.type( options ) === "number" || $.fx.speeds[ options ]) {
callback = speed;
speed = options;
options = {};
Expand All @@ -468,9 +468,9 @@ function _normalizeArguments( effect, options, speed, callback ) {
if ( options ) {
$.extend( effect, options );
}

speed = speed || options.duration;
effect.duration = $.fx.off ? 0 : typeof speed == 'number'
effect.duration = $.fx.off ? 0 : typeof speed === "number"
? speed : speed in $.fx.speeds ? $.fx.speeds[ speed ] : $.fx.speeds._default;

effect.complete = callback || options.complete;
Expand All @@ -483,7 +483,7 @@ function standardSpeed( speed ) {
if ( !speed || typeof speed === "number" || $.fx.speeds[ speed ] ) {
return true;
}

// invalid strings - treat as "normal" speed
if ( typeof speed === "string" && !$.effects.effect[ speed ] ) {
// TODO: remove in 2.0 (#7115)
Expand All @@ -492,7 +492,7 @@ function standardSpeed( speed ) {
}
return true;
}

return false;
}

Expand Down Expand Up @@ -538,7 +538,7 @@ $.fn.extend({
return this._show.apply( this, arguments );
} else {
var args = _normalizeArguments.apply( this, arguments );
args.mode = 'show';
args.mode = "show";
return this.effect.call( this, args );
}
},
Expand All @@ -549,7 +549,7 @@ $.fn.extend({
return this._hide.apply( this, arguments );
} else {
var args = _normalizeArguments.apply( this, arguments );
args.mode = 'hide';
args.mode = "hide";
return this.effect.call( this, args );
}
},
Expand All @@ -561,7 +561,7 @@ $.fn.extend({
return this.__toggle.apply( this, arguments );
} else {
var args = _normalizeArguments.apply( this, arguments );
args.mode = 'toggle';
args.mode = "toggle";
return this.effect.call( this, args );
}
},
Expand All @@ -571,7 +571,7 @@ $.fn.extend({
var style = this.css( key ),
val = [];

$.each( [ 'em', 'px', '%', 'pt' ], function( i, unit ) {
$.each( [ "em", "px", "%", "pt" ], function( i, unit ) {
if ( style.indexOf( unit ) > 0 )
val = [ parseFloat( style ), unit ];
});
Expand Down Expand Up @@ -626,7 +626,7 @@ $.fn.extend({
$.easing.jswing = $.easing.swing;

$.extend( $.easing, {
def: 'easeOutQuad',
def: "easeOutQuad",
swing: function ( x, t, b, c, d ) {
return $.easing[ $.easing.def ]( x, t, b, c, d );
},
Expand Down Expand Up @@ -707,9 +707,9 @@ $.extend( $.easing, {
a = c;
if ( t == 0 ) return b;
if ( ( t /= d ) == 1 ) return b+c;
if ( a < Math.abs( c ) ) {
a = c;
s = p / 4;
if ( a < Math.abs( c ) ) {
a = c;
s = p / 4;
} else {
s = p / ( 2 * Math.PI ) * Math.asin( c / a );
}
Expand All @@ -722,8 +722,8 @@ $.extend( $.easing, {
if ( t == 0 ) return b;
if ( ( t /= d ) == 1 ) return b+c;
if ( a < Math.abs( c ) ) {
a = c;
s = p / 4;
a = c;
s = p / 4;
} else {
s = p / ( 2 * Math.PI ) * Math.asin( c / a );
}
Expand All @@ -735,7 +735,7 @@ $.extend( $.easing, {
a = c;
if ( t == 0 ) return b;
if ( ( t /= d / 2 ) == 2 ) return b+c;
if ( a < Math.abs( c ) ) {
if ( a < Math.abs( c ) ) {
a = c;
s = p / 4;
} else {
Expand Down

0 comments on commit c241275

Please sign in to comment.