mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Effects Core: Upgrading jQuery Color to 2.1.1
This commit is contained in:
parent
67b5bc7b3d
commit
f1a44a3fac
36
ui/jquery.ui.effect.js
vendored
36
ui/jquery.ui.effect.js
vendored
@ -19,24 +19,24 @@ $.effects = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* jQuery Color Animations v2.0.0
|
* jQuery Color Animations v2.1.1
|
||||||
* http://jquery.com/
|
* https://github.com/jquery/jquery-color
|
||||||
*
|
*
|
||||||
* Copyright 2012 jQuery Foundation and other contributors
|
* Copyright 2012 jQuery Foundation and other contributors
|
||||||
* Released under the MIT license.
|
* Released under the MIT license.
|
||||||
* http://jquery.org/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 ) {
|
(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
|
// 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 [
|
||||||
execResult[ 1 ],
|
execResult[ 1 ],
|
||||||
@ -46,7 +46,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 ) {
|
parse: function( execResult ) {
|
||||||
return [
|
return [
|
||||||
execResult[ 1 ] * 2.55,
|
execResult[ 1 ] * 2.55,
|
||||||
@ -76,7 +76,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",
|
space: "hsla",
|
||||||
parse: function( execResult ) {
|
parse: function( execResult ) {
|
||||||
return [
|
return [
|
||||||
@ -293,7 +293,7 @@ color.fn = jQuery.extend( color.prototype, {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// everything defined but alpha?
|
// 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
|
// use the default of 1
|
||||||
inst[ cache ][ 3 ] = 1;
|
inst[ cache ][ 3 ] = 1;
|
||||||
if ( space.from ) {
|
if ( space.from ) {
|
||||||
@ -481,8 +481,10 @@ spaces.hsla.to = function ( rgba ) {
|
|||||||
h = ( 60 * ( r - g ) / diff ) + 240;
|
h = ( 60 * ( r - g ) / diff ) + 240;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( l === 0 || l === 1 ) {
|
// chroma (diff) == 0 means greyscale which, by definition, saturation = 0%
|
||||||
s = l;
|
// otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)
|
||||||
|
if ( diff === 0 ) {
|
||||||
|
s = 0;
|
||||||
} else if ( l <= 0.5 ) {
|
} else if ( l <= 0.5 ) {
|
||||||
s = diff / add;
|
s = diff / add;
|
||||||
} else {
|
} else {
|
||||||
@ -586,8 +588,11 @@ each( spaces, function( spaceName, space ) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// add .fx.step functions
|
// add cssHook and .fx.step function for each named hook.
|
||||||
each( stepHooks, function( i, hook ) {
|
// accept a space separated string of properties
|
||||||
|
color.hook = function( hook ) {
|
||||||
|
var hooks = hook.split( " " );
|
||||||
|
each( hooks, function( i, hook ) {
|
||||||
jQuery.cssHooks[ hook ] = {
|
jQuery.cssHooks[ hook ] = {
|
||||||
set: function( elem, value ) {
|
set: function( elem, value ) {
|
||||||
var parsed, curElem,
|
var parsed, curElem,
|
||||||
@ -617,7 +622,7 @@ each( stepHooks, function( i, hook ) {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
elem.style[ hook ] = value;
|
elem.style[ hook ] = value;
|
||||||
} catch( error ) {
|
} catch( e ) {
|
||||||
// wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
|
// wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -632,6 +637,10 @@ each( stepHooks, function( i, hook ) {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
color.hook( stepHooks );
|
||||||
|
|
||||||
jQuery.cssHooks.borderColor = {
|
jQuery.cssHooks.borderColor = {
|
||||||
expand: function( value ) {
|
expand: function( value ) {
|
||||||
var expanded = {};
|
var expanded = {};
|
||||||
@ -674,7 +683,6 @@ colors = jQuery.Color.names = {
|
|||||||
})( jQuery );
|
})( jQuery );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/****************************** CLASS ANIMATIONS ******************************/
|
/****************************** CLASS ANIMATIONS ******************************/
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
Loading…
Reference in New Issue
Block a user