mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Effects Core: Upgrading jQuery Color to 2.1.1
This commit is contained in:
parent
2ca5fbf82c
commit
d7adc2bae9
38
ui/jquery.ui.effect.js
vendored
38
ui/jquery.ui.effect.js
vendored
@ -17,24 +17,24 @@ $.effects = {
|
||||
};
|
||||
|
||||
/*!
|
||||
* jQuery Color Animations v2.0.0
|
||||
* http://jquery.com/
|
||||
* jQuery Color Animations v2.1.1
|
||||
* https://github.com/jquery/jquery-color
|
||||
*
|
||||
* Copyright 2012 jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* Date: Mon Aug 13 13:41:02 2012 -0500
|
||||
* Date: Sun Oct 28 15:08:06 2012 -0400
|
||||
*/
|
||||
(function( jQuery, undefined ) {
|
||||
|
||||
var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor".split(" "),
|
||||
var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",
|
||||
|
||||
// plusequals test for += 100 -= 100
|
||||
rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,
|
||||
// a set of RE's that can match strings and generate color tuples.
|
||||
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 ) {
|
||||
return [
|
||||
execResult[ 1 ],
|
||||
@ -44,7 +44,7 @@ $.effects = {
|
||||
];
|
||||
}
|
||||
}, {
|
||||
re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,
|
||||
re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
|
||||
parse: function( execResult ) {
|
||||
return [
|
||||
execResult[ 1 ] * 2.55,
|
||||
@ -74,7 +74,7 @@ $.effects = {
|
||||
];
|
||||
}
|
||||
}, {
|
||||
re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,
|
||||
re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
|
||||
space: "hsla",
|
||||
parse: function( execResult ) {
|
||||
return [
|
||||
@ -291,7 +291,7 @@ color.fn = jQuery.extend( color.prototype, {
|
||||
});
|
||||
|
||||
// everything defined but alpha?
|
||||
if ( inst[ cache ] && $.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
|
||||
if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
|
||||
// use the default of 1
|
||||
inst[ cache ][ 3 ] = 1;
|
||||
if ( space.from ) {
|
||||
@ -479,8 +479,10 @@ spaces.hsla.to = function ( rgba ) {
|
||||
h = ( 60 * ( r - g ) / diff ) + 240;
|
||||
}
|
||||
|
||||
if ( l === 0 || l === 1 ) {
|
||||
s = l;
|
||||
// chroma (diff) == 0 means greyscale which, by definition, saturation = 0%
|
||||
// otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)
|
||||
if ( diff === 0 ) {
|
||||
s = 0;
|
||||
} else if ( l <= 0.5 ) {
|
||||
s = diff / add;
|
||||
} else {
|
||||
@ -584,8 +586,11 @@ each( spaces, function( spaceName, space ) {
|
||||
});
|
||||
});
|
||||
|
||||
// add .fx.step functions
|
||||
each( stepHooks, function( i, hook ) {
|
||||
// add cssHook and .fx.step function for each named hook.
|
||||
// accept a space separated string of properties
|
||||
color.hook = function( hook ) {
|
||||
var hooks = hook.split( " " );
|
||||
each( hooks, function( i, hook ) {
|
||||
jQuery.cssHooks[ hook ] = {
|
||||
set: function( elem, value ) {
|
||||
var parsed, curElem,
|
||||
@ -615,7 +620,7 @@ each( stepHooks, function( i, hook ) {
|
||||
}
|
||||
try {
|
||||
elem.style[ hook ] = value;
|
||||
} catch( error ) {
|
||||
} catch( e ) {
|
||||
// wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
|
||||
}
|
||||
}
|
||||
@ -628,7 +633,11 @@ each( stepHooks, function( i, hook ) {
|
||||
}
|
||||
jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
color.hook( stepHooks );
|
||||
|
||||
jQuery.cssHooks.borderColor = {
|
||||
expand: function( value ) {
|
||||
@ -672,7 +681,6 @@ colors = jQuery.Color.names = {
|
||||
})( jQuery );
|
||||
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/****************************** CLASS ANIMATIONS ******************************/
|
||||
/******************************************************************************/
|
||||
|
Loading…
Reference in New Issue
Block a user