Fix various coding style issues

This commit is contained in:
Jörn Zaefferer 2013-10-16 20:43:09 +02:00
parent 89ae7641b0
commit 0e192979d0
15 changed files with 38 additions and 47 deletions

View File

@ -86,7 +86,7 @@ $.widget( "ui.autocomplete", {
suppressInput = false; suppressInput = false;
suppressKeyPressRepeat = false; suppressKeyPressRepeat = false;
var keyCode = $.ui.keyCode; var keyCode = $.ui.keyCode;
switch( event.keyCode ) { switch ( event.keyCode ) {
case keyCode.PAGE_UP: case keyCode.PAGE_UP:
suppressKeyPress = true; suppressKeyPress = true;
this._move( "previousPage", event ); this._move( "previousPage", event );
@ -149,7 +149,7 @@ $.widget( "ui.autocomplete", {
// replicate some key handlers to allow them to repeat in Firefox and Opera // replicate some key handlers to allow them to repeat in Firefox and Opera
var keyCode = $.ui.keyCode; var keyCode = $.ui.keyCode;
switch( event.keyCode ) { switch ( event.keyCode ) {
case keyCode.PAGE_UP: case keyCode.PAGE_UP:
this._move( "previousPage", event ); this._move( "previousPage", event );
break; break;
@ -570,7 +570,6 @@ $.extend( $.ui.autocomplete, {
} }
}); });
// live region extension, adding a `messages` option // live region extension, adding a `messages` option
// NOTE: This is an experimental API. We are still investigating // NOTE: This is an experimental API. We are still investigating
// a full solution for string manipulation and internationalization. // a full solution for string manipulation and internationalization.

View File

@ -211,10 +211,6 @@ if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) {
})( $.fn.removeData ); })( $.fn.removeData );
} }
// deprecated // deprecated
$.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() ); $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );

View File

@ -284,7 +284,7 @@ $.ui.ddmanager = {
} }
// Filter out elements in the current dragged item // Filter out elements in the current dragged item
for ( j=0; j < list.length; j++ ) { for ( j = 0; j < list.length; j++ ) {
if ( list[ j ] === m[ i ].element[ 0 ] ) { if ( list[ j ] === m[ i ].element[ 0 ] ) {
m[ i ].proportions().height = 0; m[ i ].proportions().height = 0;
continue droppablesLoop; continue droppablesLoop;
@ -362,7 +362,7 @@ $.ui.ddmanager = {
if ( this.options.greedy ) { if ( this.options.greedy ) {
// find droppable parents with same scope // find droppable parents with same scope
scope = this.options.scope; scope = this.options.scope;
parent = this.element.parents( ":data(ui-droppable)" ).filter(function () { parent = this.element.parents( ":data(ui-droppable)" ).filter(function() {
return $( this ).droppable( "instance" ).options.scope === scope; return $( this ).droppable( "instance" ).options.scope === scope;
}); });

View File

@ -56,7 +56,7 @@ $.effects.effect.blind = function( o, done ) {
// start at 0 if we are showing // start at 0 if we are showing
if ( show ) { if ( show ) {
wrapper.css( ref, 0 ); wrapper.css( ref, 0 );
if ( ! motion ) { if ( !motion ) {
wrapper.css( ref2, margin + distance ); wrapper.css( ref2, margin + distance );
} }
} }

View File

@ -41,11 +41,11 @@ $.effects.effect.explode = function( o, done ) {
} }
// clone the element for each row and cell. // clone the element for each row and cell.
for( i = 0; i < rows ; i++ ) { // ===> for ( i = 0; i < rows ; i++ ) { // ===>
top = offset.top + i * height; top = offset.top + i * height;
my = i - ( rows - 1 ) / 2 ; my = i - ( rows - 1 ) / 2 ;
for( j = 0; j < cells ; j++ ) { // ||| for ( j = 0; j < cells ; j++ ) { // |||
left = offset.left + j * width; left = offset.left + j * width;
mx = j - ( cells - 1 ) / 2 ; mx = j - ( cells - 1 ) / 2 ;

View File

@ -42,7 +42,7 @@ $.effects.effect.scale = function( o, done ) {
// Set default origin and restore for show/hide // Set default origin and restore for show/hide
if ( mode !== "effect" ) { if ( mode !== "effect" ) {
options.origin = origin || ["middle","center"]; options.origin = origin || [ "middle", "center" ];
options.restore = true; options.restore = true;
} }

View File

@ -22,7 +22,7 @@ $.effects.effect.shake = function( o, done ) {
distance = o.distance || 20, distance = o.distance || 20,
times = o.times || 3, times = o.times || 3,
anims = times * 2 + 1, anims = times * 2 + 1,
speed = Math.round(o.duration/anims), speed = Math.round( o.duration / anims ),
ref = (direction === "up" || direction === "down") ? "top" : "left", ref = (direction === "up" || direction === "down") ? "top" : "left",
positiveMotion = (direction === "up" || direction === "left"), positiveMotion = (direction === "up" || direction === "left"),
animation = {}, animation = {},

View File

@ -125,7 +125,7 @@ $.effects.effect.size = function( o, done ) {
hProps = hProps.concat([ "marginLeft", "marginRight" ]); hProps = hProps.concat([ "marginLeft", "marginRight" ]);
props2 = props0.concat(vProps).concat(hProps); props2 = props0.concat(vProps).concat(hProps);
el.find( "*[width]" ).each( function(){ el.find( "*[width]" ).each( function() {
var child = $( this ), var child = $( this ),
c_original = { c_original = {
height: child.height(), height: child.height(),
@ -183,7 +183,7 @@ $.effects.effect.size = function( o, done ) {
if ( el.to.opacity === 0 ) { if ( el.to.opacity === 0 ) {
el.css( "opacity", el.from.opacity ); el.css( "opacity", el.from.opacity );
} }
if( mode === "hide" ) { if ( mode === "hide" ) {
el.hide(); el.hide();
} }
$.effects.restore( el, props ); $.effects.restore( el, props );

View File

@ -22,8 +22,8 @@ $.effects.effect.transfer = function( o, done ) {
fixLeft = targetFixed ? body.scrollLeft() : 0, fixLeft = targetFixed ? body.scrollLeft() : 0,
endPosition = target.offset(), endPosition = target.offset(),
animation = { animation = {
top: endPosition.top - fixTop , top: endPosition.top - fixTop,
left: endPosition.left - fixLeft , left: endPosition.left - fixLeft,
height: target.innerHeight(), height: target.innerHeight(),
width: target.innerWidth() width: target.innerWidth()
}, },
@ -32,8 +32,8 @@ $.effects.effect.transfer = function( o, done ) {
.appendTo( document.body ) .appendTo( document.body )
.addClass( o.className ) .addClass( o.className )
.css({ .css({
top: startPosition.top - fixTop , top: startPosition.top - fixTop,
left: startPosition.left - fixLeft , left: startPosition.left - fixLeft,
height: elem.innerHeight(), height: elem.innerHeight(),
width: elem.innerWidth(), width: elem.innerWidth(),
position: targetFixed ? "fixed" : "absolute" position: targetFixed ? "fixed" : "absolute"

View File

@ -33,7 +33,7 @@ $.effects = {
// plusequals test for += 100 -= 100 // plusequals test for += 100 -= 100
rplusequals = /^([\-+])=\s*(\d+\.?\d*)/, rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,
// a set of RE's that can match strings and generate color tuples. // a set of RE's that can match strings and generate color tuples.
stringParsers = [{ stringParsers = [ {
re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
parse: function( execResult ) { parse: function( execResult ) {
return [ return [
@ -84,7 +84,7 @@ $.effects = {
execResult[ 4 ] execResult[ 4 ]
]; ];
} }
}], } ],
// jQuery.Color( ) // jQuery.Color( )
color = jQuery.Color = function( color, green, blue, alpha ) { color = jQuery.Color = function( color, green, blue, alpha ) {
@ -443,18 +443,18 @@ color.fn.parse.prototype = color.fn;
function hue2rgb( p, q, h ) { function hue2rgb( p, q, h ) {
h = ( h + 1 ) % 1; h = ( h + 1 ) % 1;
if ( h * 6 < 1 ) { if ( h * 6 < 1 ) {
return p + (q - p) * h * 6; return p + ( q - p ) * h * 6;
} }
if ( h * 2 < 1) { if ( h * 2 < 1) {
return q; return q;
} }
if ( h * 3 < 2 ) { if ( h * 3 < 2 ) {
return p + (q - p) * ((2/3) - h) * 6; return p + ( q - p ) * ( ( 2 / 3 ) - h ) * 6;
} }
return p; return p;
} }
spaces.hsla.to = function ( rgba ) { spaces.hsla.to = function( rgba ) {
if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) { if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {
return [ null, null, null, rgba[ 3 ] ]; return [ null, null, null, rgba[ 3 ] ];
} }
@ -491,7 +491,7 @@ spaces.hsla.to = function ( rgba ) {
return [ Math.round(h) % 360, s, l, a == null ? 1 : a ]; return [ Math.round(h) % 360, s, l, a == null ? 1 : a ];
}; };
spaces.hsla.from = function ( hsla ) { spaces.hsla.from = function( hsla ) {
if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) { if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) {
return [ null, null, null, hsla[ 3 ] ]; return [ null, null, null, hsla[ 3 ] ];
} }
@ -510,7 +510,6 @@ spaces.hsla.from = function ( hsla ) {
]; ];
}; };
each( spaces, function( spaceName, space ) { each( spaces, function( spaceName, space ) {
var props = space.props, var props = space.props,
cache = space.cache, cache = space.cache,
@ -680,7 +679,6 @@ colors = jQuery.Color.names = {
})( jQuery ); })( jQuery );
/******************************************************************************/ /******************************************************************************/
/****************************** CLASS ANIMATIONS ******************************/ /****************************** CLASS ANIMATIONS ******************************/
/******************************************************************************/ /******************************************************************************/
@ -735,7 +733,6 @@ function getElementStyles( elem ) {
return styles; return styles;
} }
function styleDifference( oldStyle, newStyle ) { function styleDifference( oldStyle, newStyle ) {
var diff = {}, var diff = {},
name, value; name, value;
@ -897,7 +894,7 @@ $.extend( $.effects, {
// Saves a set of properties in a data storage // Saves a set of properties in a data storage
save: function( element, set ) { save: function( element, set ) {
for( var i=0; i < set.length; i++ ) { for ( var i = 0; i < set.length; i++ ) {
if ( set[ i ] !== null ) { if ( set[ i ] !== null ) {
element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] ); element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] );
} }
@ -907,7 +904,7 @@ $.extend( $.effects, {
// Restores a set of previously saved properties from a data storage // Restores a set of previously saved properties from a data storage
restore: function( element, set ) { restore: function( element, set ) {
var val, i; var val, i;
for( i=0; i < set.length; i++ ) { for ( i = 0; i < set.length; i++ ) {
if ( set[ i ] !== null ) { if ( set[ i ] !== null ) {
val = element.data( dataSpace + set[ i ] ); val = element.data( dataSpace + set[ i ] );
// support: jQuery 1.6.2 // support: jQuery 1.6.2
@ -1040,7 +1037,6 @@ $.extend( $.effects, {
} }
} }
return element; return element;
}, },
@ -1250,10 +1246,10 @@ $.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) {
}); });
$.extend( baseEasings, { $.extend( baseEasings, {
Sine: function ( p ) { Sine: function( p ) {
return 1 - Math.cos( p * Math.PI / 2 ); return 1 - Math.cos( p * Math.PI / 2 );
}, },
Circ: function ( p ) { Circ: function( p ) {
return 1 - Math.sqrt( 1 - p * p ); return 1 - Math.sqrt( 1 - p * p );
}, },
Elastic: function( p ) { Elastic: function( p ) {
@ -1263,7 +1259,7 @@ $.extend( baseEasings, {
Back: function( p ) { Back: function( p ) {
return p * p * ( 3 * p - 2 ); return p * p * ( 3 * p - 2 );
}, },
Bounce: function ( p ) { Bounce: function( p ) {
var pow2, var pow2,
bounce = 4; bounce = 4;

View File

@ -56,7 +56,9 @@ $.widget("ui.mouse", {
_mouseDown: function(event) { _mouseDown: function(event) {
// don't let more than one widget handle mouseStart // don't let more than one widget handle mouseStart
if( mouseHandled ) { return; } if ( mouseHandled ) {
return;
}
// we may have missed mouseup (out of window) // we may have missed mouseup (out of window)
(this._mouseStarted && this._mouseUp(event)); (this._mouseStarted && this._mouseUp(event));
@ -114,9 +116,9 @@ $.widget("ui.mouse", {
// IE mouseup check - mouseup happened when mouse was out of window // IE mouseup check - mouseup happened when mouse was out of window
if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) { if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) {
return this._mouseUp(event); return this._mouseUp(event);
}
// Iframe mouseup check - mouseup occurred in another document // Iframe mouseup check - mouseup occurred in another document
else if ( !event.which ) { } else if ( !event.which ) {
return this._mouseUp( event ); return this._mouseUp( event );
} }

View File

@ -400,8 +400,7 @@ $.ui.position = {
if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) { if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
position.left += myOffset + atOffset + offset; position.left += myOffset + atOffset + offset;
} }
} } else if ( overRight > 0 ) {
else if ( overRight > 0 ) {
newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft; newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft;
if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) { if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
position.left += myOffset + atOffset + offset; position.left += myOffset + atOffset + offset;
@ -435,8 +434,7 @@ $.ui.position = {
if ( ( position.top + myOffset + atOffset + offset) > overTop && ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) ) { if ( ( position.top + myOffset + atOffset + offset) > overTop && ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) ) {
position.top += myOffset + atOffset + offset; position.top += myOffset + atOffset + offset;
} }
} } else if ( overBottom > 0 ) {
else if ( overBottom > 0 ) {
newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop; newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop;
if ( ( position.top + myOffset + atOffset + offset) > overBottom && ( newOverTop > 0 || abs( newOverTop ) < overBottom ) ) { if ( ( position.top + myOffset + atOffset + offset) > overBottom && ( newOverTop > 0 || abs( newOverTop ) < overBottom ) ) {
position.top += myOffset + atOffset + offset; position.top += myOffset + atOffset + offset;
@ -457,7 +455,7 @@ $.ui.position = {
}; };
// fraction support test // fraction support test
(function () { (function() {
var testElement, testElementParent, testElementStyle, offsetLeft, i, var testElement, testElementParent, testElementStyle, offsetLeft, i,
body = document.getElementsByTagName( "body" )[ 0 ], body = document.getElementsByTagName( "body" )[ 0 ],
div = document.createElement( "div" ); div = document.createElement( "div" );

View File

@ -83,7 +83,7 @@ $.widget("ui.selectable", $.ui.mouse, {
var that = this, var that = this,
options = this.options; options = this.options;
this.opos = [event.pageX, event.pageY]; this.opos = [ event.pageX, event.pageY ];
if (this.options.disabled) { if (this.options.disabled) {
return; return;
@ -166,7 +166,7 @@ $.widget("ui.selectable", $.ui.mouse, {
if (x1 > x2) { tmp = x2; x2 = x1; x1 = tmp; } if (x1 > x2) { tmp = x2; x2 = x1; x1 = tmp; }
if (y1 > y2) { tmp = y2; y2 = y1; y1 = tmp; } if (y1 > y2) { tmp = y2; y2 = y1; y1 = tmp; }
this.helper.css({left: x1, top: y1, width: x2-x1, height: y2-y1}); this.helper.css({ left: x1, top: y1, width: x2 - x1, height: y2 - y1 });
this.selectees.each(function() { this.selectees.each(function() {
var selectee = $.data(this, "selectable-item"), var selectee = $.data(this, "selectable-item"),

View File

@ -423,7 +423,7 @@ $.widget( "ui.slider", $.ui.mouse, {
this.options.value = this._values( 0 ); this.options.value = this._values( 0 );
this.options.values = null; this.options.values = null;
} else if ( value === "max" ) { } else if ( value === "max" ) {
this.options.value = this._values( this.options.values.length-1 ); this.options.value = this._values( this.options.values.length - 1 );
this.options.values = null; this.options.values = null;
} }
} }

View File

@ -301,7 +301,7 @@ $.widget( "ui.spinner", {
if ( incremental ) { if ( incremental ) {
return $.isFunction( incremental ) ? return $.isFunction( incremental ) ?
incremental( i ) : incremental( i ) :
Math.floor( i*i*i/50000 - i*i/500 + 17*i/200 + 1 ); Math.floor( i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1 );
} }
return 1; return 1;