Skip to content

Commit

Permalink
Effects: Update jquery-color.
Browse files Browse the repository at this point in the history
  • Loading branch information
scottgonzalez committed Jun 28, 2012
1 parent 7ce3069 commit 730446e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
1 change: 0 additions & 1 deletion ui/.jshintrc
@@ -1,5 +1,4 @@
{ {
"boss": true,
"browser": true, "browser": true,
"curly": true, "curly": true,
"eqnull": true, "eqnull": true,
Expand Down
26 changes: 11 additions & 15 deletions ui/jquery.ui.effect.js
Expand Up @@ -21,7 +21,7 @@ $.effects = {
* jQuery Color Animations * jQuery Color Animations
* http://jquery.org/ * http://jquery.org/
* *
* Copyright 2011 John Resig * Copyright 2012 John Resig
* Dual licensed under the MIT or GPL Version 2 licenses. * Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license * http://jquery.org/license
*/ */
Expand Down Expand Up @@ -149,7 +149,6 @@ var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightCo
floor: true floor: true
} }
}, },
rgbaspace = spaces.rgba.props,
support = color.support = {}, support = color.support = {},


// colors = jQuery.Color.names // colors = jQuery.Color.names
Expand All @@ -158,11 +157,11 @@ var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightCo
// local aliases of functions called often // local aliases of functions called often
each = jQuery.each; each = jQuery.each;


spaces.hsla.props.alpha = rgbaspace.alpha; spaces.hsla.props.alpha = spaces.rgba.props.alpha;


function clamp( value, prop, alwaysAllowEmpty ) { function clamp( value, prop, alwaysAllowEmpty ) {
var type = propTypes[ prop.type ] || {}, var type = propTypes[ prop.type ] || {},
allowEmpty = prop.empty || alwaysAllowEmpty; allowEmpty = alwaysAllowEmpty || prop.empty;


if ( allowEmpty && value == null ) { if ( allowEmpty && value == null ) {
return null; return null;
Expand All @@ -179,7 +178,7 @@ function clamp( value, prop, alwaysAllowEmpty ) {
return prop.def; return prop.def;
} }
if ( type.mod ) { if ( type.mod ) {
value = value % type.mod; value %= type.mod;
// -10 -> 350 // -10 -> 350
return value < 0 ? type.mod + value : value; return value < 0 ? type.mod + value : value;
} }
Expand Down Expand Up @@ -226,21 +225,18 @@ function stringParse( string ) {
return inst; return inst;
} }


// named colors / default - filter back through parse function // named colors
if ( string = colors[ string ] ) { return colors[ string ];
return string;
}
} }


color.fn = color.prototype = { color.fn = jQuery.extend( color.prototype, {
constructor: color,
parse: function( red, green, blue, alpha ) { parse: function( red, green, blue, alpha ) {
if ( red === undefined ) { if ( red === undefined ) {
this._rgba = [ null, null, null, null ]; this._rgba = [ null, null, null, null ];
return this; return this;
} }
if ( red instanceof jQuery || red.nodeType ) { if ( red.jquery || red.nodeType ) {
red = red instanceof jQuery ? red.css( green ) : jQuery( red ).css( green ); red = jQuery( red ).css( green );
green = undefined; green = undefined;
} }


Expand All @@ -260,7 +256,7 @@ color.fn = color.prototype = {
} }


if ( type === "array" ) { if ( type === "array" ) {
each( rgbaspace, function( key, prop ) { each( spaces.rgba.props, function( key, prop ) {
rgba[ prop.idx ] = clamp( red[ prop.idx ], prop ); rgba[ prop.idx ] = clamp( red[ prop.idx ], prop );
}); });
return this; return this;
Expand Down Expand Up @@ -428,7 +424,7 @@ color.fn = color.prototype = {
toString: function() { toString: function() {
return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString(); return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();
} }
}; });
color.fn.parse.prototype = color.fn; color.fn.parse.prototype = color.fn;


// hsla conversions adapted from: // hsla conversions adapted from:
Expand Down

0 comments on commit 730446e

Please sign in to comment.