Update jQuery Color Animations plugin to 2.1.0. Props gnarf. fixes #21692.
git-svn-id: http://core.svn.wordpress.org/trunk@21632 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
b2e4e665be
commit
1af0737e0f
|
@ -1,128 +1,810 @@
|
|||
/*
|
||||
* jQuery Color Animations
|
||||
* Copyright 2007 John Resig
|
||||
* Released under the MIT and GPL licenses.
|
||||
/*!
|
||||
* jQuery Color Animations v2.1.0
|
||||
* http://jquery.com/
|
||||
*
|
||||
* Copyright 2012 jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* Date: Fri Aug 24 12:02:24 2012 -0500
|
||||
*/
|
||||
(function( jQuery, undefined ) {
|
||||
|
||||
(function(jQuery){
|
||||
var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",
|
||||
|
||||
// We override the animation for all of these color styles
|
||||
jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){
|
||||
jQuery.fx.step[attr] = function(fx){
|
||||
if ( fx.state == 0 ) {
|
||||
fx.start = getColor( fx.elem, attr );
|
||||
fx.end = getRGB( fx.end );
|
||||
// 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*)?\)/,
|
||||
parse: function( execResult ) {
|
||||
return [
|
||||
execResult[ 1 ],
|
||||
execResult[ 2 ],
|
||||
execResult[ 3 ],
|
||||
execResult[ 4 ]
|
||||
];
|
||||
}
|
||||
}, {
|
||||
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,
|
||||
execResult[ 2 ] * 2.55,
|
||||
execResult[ 3 ] * 2.55,
|
||||
execResult[ 4 ]
|
||||
];
|
||||
}
|
||||
}, {
|
||||
// this regex ignores A-F because it's compared against an already lowercased string
|
||||
re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,
|
||||
parse: function( execResult ) {
|
||||
return [
|
||||
parseInt( execResult[ 1 ], 16 ),
|
||||
parseInt( execResult[ 2 ], 16 ),
|
||||
parseInt( execResult[ 3 ], 16 )
|
||||
];
|
||||
}
|
||||
}, {
|
||||
// this regex ignores A-F because it's compared against an already lowercased string
|
||||
re: /#([a-f0-9])([a-f0-9])([a-f0-9])/,
|
||||
parse: function( execResult ) {
|
||||
return [
|
||||
parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ),
|
||||
parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ),
|
||||
parseInt( execResult[ 3 ] + execResult[ 3 ], 16 )
|
||||
];
|
||||
}
|
||||
}, {
|
||||
re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,
|
||||
space: "hsla",
|
||||
parse: function( execResult ) {
|
||||
return [
|
||||
execResult[ 1 ],
|
||||
execResult[ 2 ] / 100,
|
||||
execResult[ 3 ] / 100,
|
||||
execResult[ 4 ]
|
||||
];
|
||||
}
|
||||
}],
|
||||
|
||||
// jQuery.Color( )
|
||||
color = jQuery.Color = function( color, green, blue, alpha ) {
|
||||
return new jQuery.Color.fn.parse( color, green, blue, alpha );
|
||||
},
|
||||
spaces = {
|
||||
rgba: {
|
||||
props: {
|
||||
red: {
|
||||
idx: 0,
|
||||
type: "byte"
|
||||
},
|
||||
green: {
|
||||
idx: 1,
|
||||
type: "byte"
|
||||
},
|
||||
blue: {
|
||||
idx: 2,
|
||||
type: "byte"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
hsla: {
|
||||
props: {
|
||||
hue: {
|
||||
idx: 0,
|
||||
type: "degrees"
|
||||
},
|
||||
saturation: {
|
||||
idx: 1,
|
||||
type: "percent"
|
||||
},
|
||||
lightness: {
|
||||
idx: 2,
|
||||
type: "percent"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
propTypes = {
|
||||
"byte": {
|
||||
floor: true,
|
||||
max: 255
|
||||
},
|
||||
"percent": {
|
||||
max: 1
|
||||
},
|
||||
"degrees": {
|
||||
mod: 360,
|
||||
floor: true
|
||||
}
|
||||
},
|
||||
support = color.support = {},
|
||||
|
||||
// element for support tests
|
||||
supportElem = jQuery( "<p>" )[ 0 ],
|
||||
|
||||
// colors = jQuery.Color.names
|
||||
colors,
|
||||
|
||||
// local aliases of functions called often
|
||||
each = jQuery.each;
|
||||
|
||||
// determine rgba support immediately
|
||||
supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
|
||||
support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;
|
||||
|
||||
// define cache name and alpha properties
|
||||
// for rgba and hsla spaces
|
||||
each( spaces, function( spaceName, space ) {
|
||||
space.cache = "_" + spaceName;
|
||||
space.props.alpha = {
|
||||
idx: 3,
|
||||
type: "percent",
|
||||
def: 1
|
||||
};
|
||||
});
|
||||
|
||||
function clamp( value, prop, allowEmpty ) {
|
||||
var type = propTypes[ prop.type ] || {};
|
||||
|
||||
if ( value == null ) {
|
||||
return (allowEmpty || !prop.def) ? null : prop.def;
|
||||
}
|
||||
|
||||
fx.elem.style[attr] = "rgb(" + [
|
||||
Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0),
|
||||
Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0),
|
||||
Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0)
|
||||
].join(",") + ")";
|
||||
// ~~ is an short way of doing floor for positive numbers
|
||||
value = type.floor ? ~~value : parseFloat( value );
|
||||
|
||||
// IE will pass in empty strings as value for alpha,
|
||||
// which will hit this case
|
||||
if ( isNaN( value ) ) {
|
||||
return prop.def;
|
||||
}
|
||||
|
||||
if ( type.mod ) {
|
||||
// we add mod before modding to make sure that negatives values
|
||||
// get converted properly: -10 -> 350
|
||||
return (value + type.mod) % type.mod;
|
||||
}
|
||||
|
||||
// for now all property types without mod have min and max
|
||||
return 0 > value ? 0 : type.max < value ? type.max : value;
|
||||
}
|
||||
|
||||
function stringParse( string ) {
|
||||
var inst = color(),
|
||||
rgba = inst._rgba = [];
|
||||
|
||||
string = string.toLowerCase();
|
||||
|
||||
each( stringParsers, function( i, parser ) {
|
||||
var parsed,
|
||||
match = parser.re.exec( string ),
|
||||
values = match && parser.parse( match ),
|
||||
spaceName = parser.space || "rgba";
|
||||
|
||||
if ( values ) {
|
||||
parsed = inst[ spaceName ]( values );
|
||||
|
||||
// if this was an rgba parse the assignment might happen twice
|
||||
// oh well....
|
||||
inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ];
|
||||
rgba = inst._rgba = parsed._rgba;
|
||||
|
||||
// exit each( stringParsers ) here because we matched
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// Color Conversion functions from highlightFade
|
||||
// By Blair Mitchelmore
|
||||
// http://jquery.offput.ca/highlightFade/
|
||||
// Found a stringParser that handled it
|
||||
if ( rgba.length ) {
|
||||
|
||||
// Parse strings looking for color tuples [255,255,255]
|
||||
function getRGB(color) {
|
||||
var result;
|
||||
|
||||
// Check if we're already dealing with an array of colors
|
||||
if ( color && color.constructor == Array && color.length == 3 )
|
||||
return color;
|
||||
|
||||
// Look for rgb(num,num,num)
|
||||
if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
|
||||
return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])];
|
||||
|
||||
// Look for rgb(num%,num%,num%)
|
||||
if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
|
||||
return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
|
||||
|
||||
// Look for #a0b1c2
|
||||
if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
|
||||
return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
|
||||
|
||||
// Look for #fff
|
||||
if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
|
||||
return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
|
||||
|
||||
// Look for rgba(0, 0, 0, 0) == transparent in Safari 3
|
||||
if (result = /rgba\(0, 0, 0, 0\)/.exec(color))
|
||||
return colors['transparent']
|
||||
|
||||
// Otherwise, we're most likely dealing with a named color
|
||||
return colors[jQuery.trim(color).toLowerCase()];
|
||||
// if this came from a parsed string, force "transparent" when alpha is 0
|
||||
// chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
|
||||
if ( rgba.join() === "0,0,0,0" ) {
|
||||
jQuery.extend( rgba, colors.transparent );
|
||||
}
|
||||
return inst;
|
||||
}
|
||||
|
||||
function getColor(elem, attr) {
|
||||
var color;
|
||||
// named colors
|
||||
return colors[ string ];
|
||||
}
|
||||
|
||||
do {
|
||||
color = jQuery.curCSS(elem, attr);
|
||||
color.fn = jQuery.extend( color.prototype, {
|
||||
parse: function( red, green, blue, alpha ) {
|
||||
if ( red === undefined ) {
|
||||
this._rgba = [ null, null, null, null ];
|
||||
return this;
|
||||
}
|
||||
if ( red.jquery || red.nodeType ) {
|
||||
red = jQuery( red ).css( green );
|
||||
green = undefined;
|
||||
}
|
||||
|
||||
// Keep going until we find an element that has color, or we hit the body
|
||||
if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") )
|
||||
break;
|
||||
var inst = this,
|
||||
type = jQuery.type( red ),
|
||||
rgba = this._rgba = [],
|
||||
source;
|
||||
|
||||
attr = "backgroundColor";
|
||||
} while ( elem = elem.parentNode );
|
||||
// more than 1 argument specified - assume ( red, green, blue, alpha )
|
||||
if ( green !== undefined ) {
|
||||
red = [ red, green, blue, alpha ];
|
||||
type = "array";
|
||||
}
|
||||
|
||||
return getRGB(color);
|
||||
if ( type === "string" ) {
|
||||
return this.parse( stringParse( red ) || colors._default );
|
||||
}
|
||||
|
||||
if ( type === "array" ) {
|
||||
each( spaces.rgba.props, function( key, prop ) {
|
||||
rgba[ prop.idx ] = clamp( red[ prop.idx ], prop );
|
||||
});
|
||||
return this;
|
||||
}
|
||||
|
||||
if ( type === "object" ) {
|
||||
if ( red instanceof color ) {
|
||||
each( spaces, function( spaceName, space ) {
|
||||
if ( red[ space.cache ] ) {
|
||||
inst[ space.cache ] = red[ space.cache ].slice();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
each( spaces, function( spaceName, space ) {
|
||||
var cache = space.cache;
|
||||
each( space.props, function( key, prop ) {
|
||||
|
||||
// if the cache doesn't exist, and we know how to convert
|
||||
if ( !inst[ cache ] && space.to ) {
|
||||
|
||||
// if the value was null, we don't need to copy it
|
||||
// if the key was alpha, we don't need to copy it either
|
||||
if ( key === "alpha" || red[ key ] == null ) {
|
||||
return;
|
||||
}
|
||||
inst[ cache ] = space.to( inst._rgba );
|
||||
}
|
||||
|
||||
// this is the only case where we allow nulls for ALL properties.
|
||||
// call clamp with alwaysAllowEmpty
|
||||
inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true );
|
||||
});
|
||||
|
||||
// everything defined but alpha?
|
||||
if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
|
||||
// use the default of 1
|
||||
inst[ cache ][ 3 ] = 1;
|
||||
if ( space.from ) {
|
||||
inst._rgba = space.from( inst[ cache ] );
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return this;
|
||||
}
|
||||
},
|
||||
is: function( compare ) {
|
||||
var is = color( compare ),
|
||||
same = true,
|
||||
inst = this;
|
||||
|
||||
each( spaces, function( _, space ) {
|
||||
var localCache,
|
||||
isCache = is[ space.cache ];
|
||||
if (isCache) {
|
||||
localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || [];
|
||||
each( space.props, function( _, prop ) {
|
||||
if ( isCache[ prop.idx ] != null ) {
|
||||
same = ( isCache[ prop.idx ] === localCache[ prop.idx ] );
|
||||
return same;
|
||||
}
|
||||
});
|
||||
}
|
||||
return same;
|
||||
});
|
||||
return same;
|
||||
},
|
||||
_space: function() {
|
||||
var used = [],
|
||||
inst = this;
|
||||
each( spaces, function( spaceName, space ) {
|
||||
if ( inst[ space.cache ] ) {
|
||||
used.push( spaceName );
|
||||
}
|
||||
});
|
||||
return used.pop();
|
||||
},
|
||||
transition: function( other, distance ) {
|
||||
var end = color( other ),
|
||||
spaceName = end._space(),
|
||||
space = spaces[ spaceName ],
|
||||
startColor = this.alpha() === 0 ? color( "transparent" ) : this,
|
||||
start = startColor[ space.cache ] || space.to( startColor._rgba ),
|
||||
result = start.slice();
|
||||
|
||||
end = end[ space.cache ];
|
||||
each( space.props, function( key, prop ) {
|
||||
var index = prop.idx,
|
||||
startValue = start[ index ],
|
||||
endValue = end[ index ],
|
||||
type = propTypes[ prop.type ] || {};
|
||||
|
||||
// if null, don't override start value
|
||||
if ( endValue === null ) {
|
||||
return;
|
||||
}
|
||||
// if null - use end
|
||||
if ( startValue === null ) {
|
||||
result[ index ] = endValue;
|
||||
} else {
|
||||
if ( type.mod ) {
|
||||
if ( endValue - startValue > type.mod / 2 ) {
|
||||
startValue += type.mod;
|
||||
} else if ( startValue - endValue > type.mod / 2 ) {
|
||||
startValue -= type.mod;
|
||||
}
|
||||
}
|
||||
result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop );
|
||||
}
|
||||
});
|
||||
return this[ spaceName ]( result );
|
||||
},
|
||||
blend: function( opaque ) {
|
||||
// if we are already opaque - return ourself
|
||||
if ( this._rgba[ 3 ] === 1 ) {
|
||||
return this;
|
||||
}
|
||||
|
||||
var rgb = this._rgba.slice(),
|
||||
a = rgb.pop(),
|
||||
blend = color( opaque )._rgba;
|
||||
|
||||
return color( jQuery.map( rgb, function( v, i ) {
|
||||
return ( 1 - a ) * blend[ i ] + a * v;
|
||||
}));
|
||||
},
|
||||
toRgbaString: function() {
|
||||
var prefix = "rgba(",
|
||||
rgba = jQuery.map( this._rgba, function( v, i ) {
|
||||
return v == null ? ( i > 2 ? 1 : 0 ) : v;
|
||||
});
|
||||
|
||||
if ( rgba[ 3 ] === 1 ) {
|
||||
rgba.pop();
|
||||
prefix = "rgb(";
|
||||
}
|
||||
|
||||
return prefix + rgba.join() + ")";
|
||||
},
|
||||
toHslaString: function() {
|
||||
var prefix = "hsla(",
|
||||
hsla = jQuery.map( this.hsla(), function( v, i ) {
|
||||
if ( v == null ) {
|
||||
v = i > 2 ? 1 : 0;
|
||||
}
|
||||
|
||||
// catch 1 and 2
|
||||
if ( i && i < 3 ) {
|
||||
v = Math.round( v * 100 ) + "%";
|
||||
}
|
||||
return v;
|
||||
});
|
||||
|
||||
if ( hsla[ 3 ] === 1 ) {
|
||||
hsla.pop();
|
||||
prefix = "hsl(";
|
||||
}
|
||||
return prefix + hsla.join() + ")";
|
||||
},
|
||||
toHexString: function( includeAlpha ) {
|
||||
var rgba = this._rgba.slice(),
|
||||
alpha = rgba.pop();
|
||||
|
||||
if ( includeAlpha ) {
|
||||
rgba.push( ~~( alpha * 255 ) );
|
||||
}
|
||||
|
||||
return "#" + jQuery.map( rgba, function( v, i ) {
|
||||
|
||||
// default to 0 when nulls exist
|
||||
v = ( v || 0 ).toString( 16 );
|
||||
return v.length === 1 ? "0" + v : v;
|
||||
}).join("");
|
||||
},
|
||||
toString: function() {
|
||||
return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();
|
||||
}
|
||||
});
|
||||
color.fn.parse.prototype = color.fn;
|
||||
|
||||
// hsla conversions adapted from:
|
||||
// https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021
|
||||
|
||||
function hue2rgb( p, q, h ) {
|
||||
h = ( h + 1 ) % 1;
|
||||
if ( h * 6 < 1 ) {
|
||||
return p + (q - p) * h * 6;
|
||||
}
|
||||
if ( h * 2 < 1) {
|
||||
return q;
|
||||
}
|
||||
if ( h * 3 < 2 ) {
|
||||
return p + (q - p) * ((2/3) - h) * 6;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
spaces.hsla.to = function ( rgba ) {
|
||||
if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {
|
||||
return [ null, null, null, rgba[ 3 ] ];
|
||||
}
|
||||
var r = rgba[ 0 ] / 255,
|
||||
g = rgba[ 1 ] / 255,
|
||||
b = rgba[ 2 ] / 255,
|
||||
a = rgba[ 3 ],
|
||||
max = Math.max( r, g, b ),
|
||||
min = Math.min( r, g, b ),
|
||||
diff = max - min,
|
||||
add = max + min,
|
||||
l = add * 0.5,
|
||||
h, s;
|
||||
|
||||
if ( min === max ) {
|
||||
h = 0;
|
||||
} else if ( r === max ) {
|
||||
h = ( 60 * ( g - b ) / diff ) + 360;
|
||||
} else if ( g === max ) {
|
||||
h = ( 60 * ( b - r ) / diff ) + 120;
|
||||
} else {
|
||||
h = ( 60 * ( r - g ) / diff ) + 240;
|
||||
}
|
||||
|
||||
if ( l === 0 || l === 1 ) {
|
||||
s = l;
|
||||
} else if ( l <= 0.5 ) {
|
||||
s = diff / add;
|
||||
} else {
|
||||
s = diff / ( 2 - add );
|
||||
}
|
||||
return [ Math.round(h) % 360, s, l, a == null ? 1 : a ];
|
||||
};
|
||||
|
||||
// Some named colors to work with
|
||||
// From Interface by Stefan Petre
|
||||
// http://interface.eyecon.ro/
|
||||
spaces.hsla.from = function ( hsla ) {
|
||||
if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) {
|
||||
return [ null, null, null, hsla[ 3 ] ];
|
||||
}
|
||||
var h = hsla[ 0 ] / 360,
|
||||
s = hsla[ 1 ],
|
||||
l = hsla[ 2 ],
|
||||
a = hsla[ 3 ],
|
||||
q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
|
||||
p = 2 * l - q,
|
||||
r, g, b;
|
||||
|
||||
var colors = {
|
||||
aqua:[0,255,255],
|
||||
azure:[240,255,255],
|
||||
beige:[245,245,220],
|
||||
black:[0,0,0],
|
||||
blue:[0,0,255],
|
||||
brown:[165,42,42],
|
||||
cyan:[0,255,255],
|
||||
darkblue:[0,0,139],
|
||||
darkcyan:[0,139,139],
|
||||
darkgrey:[169,169,169],
|
||||
darkgreen:[0,100,0],
|
||||
darkkhaki:[189,183,107],
|
||||
darkmagenta:[139,0,139],
|
||||
darkolivegreen:[85,107,47],
|
||||
darkorange:[255,140,0],
|
||||
darkorchid:[153,50,204],
|
||||
darkred:[139,0,0],
|
||||
darksalmon:[233,150,122],
|
||||
darkviolet:[148,0,211],
|
||||
fuchsia:[255,0,255],
|
||||
gold:[255,215,0],
|
||||
green:[0,128,0],
|
||||
indigo:[75,0,130],
|
||||
khaki:[240,230,140],
|
||||
lightblue:[173,216,230],
|
||||
lightcyan:[224,255,255],
|
||||
lightgreen:[144,238,144],
|
||||
lightgrey:[211,211,211],
|
||||
lightpink:[255,182,193],
|
||||
lightyellow:[255,255,224],
|
||||
lime:[0,255,0],
|
||||
magenta:[255,0,255],
|
||||
maroon:[128,0,0],
|
||||
navy:[0,0,128],
|
||||
olive:[128,128,0],
|
||||
orange:[255,165,0],
|
||||
pink:[255,192,203],
|
||||
purple:[128,0,128],
|
||||
violet:[128,0,128],
|
||||
red:[255,0,0],
|
||||
silver:[192,192,192],
|
||||
white:[255,255,255],
|
||||
yellow:[255,255,0],
|
||||
transparent: [255,255,255]
|
||||
return [
|
||||
Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
|
||||
Math.round( hue2rgb( p, q, h ) * 255 ),
|
||||
Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ),
|
||||
a
|
||||
];
|
||||
};
|
||||
|
||||
|
||||
each( spaces, function( spaceName, space ) {
|
||||
var props = space.props,
|
||||
cache = space.cache,
|
||||
to = space.to,
|
||||
from = space.from;
|
||||
|
||||
// makes rgba() and hsla()
|
||||
color.fn[ spaceName ] = function( value ) {
|
||||
|
||||
// generate a cache for this space if it doesn't exist
|
||||
if ( to && !this[ cache ] ) {
|
||||
this[ cache ] = to( this._rgba );
|
||||
}
|
||||
if ( value === undefined ) {
|
||||
return this[ cache ].slice();
|
||||
}
|
||||
|
||||
var ret,
|
||||
type = jQuery.type( value ),
|
||||
arr = ( type === "array" || type === "object" ) ? value : arguments,
|
||||
local = this[ cache ].slice();
|
||||
|
||||
each( props, function( key, prop ) {
|
||||
var val = arr[ type === "object" ? key : prop.idx ];
|
||||
if ( val == null ) {
|
||||
val = local[ prop.idx ];
|
||||
}
|
||||
local[ prop.idx ] = clamp( val, prop );
|
||||
});
|
||||
|
||||
if ( from ) {
|
||||
ret = color( from( local ) );
|
||||
ret[ cache ] = local;
|
||||
return ret;
|
||||
} else {
|
||||
return color( local );
|
||||
}
|
||||
};
|
||||
|
||||
// makes red() green() blue() alpha() hue() saturation() lightness()
|
||||
each( props, function( key, prop ) {
|
||||
// alpha is included in more than one space
|
||||
if ( color.fn[ key ] ) {
|
||||
return;
|
||||
}
|
||||
color.fn[ key ] = function( value ) {
|
||||
var vtype = jQuery.type( value ),
|
||||
fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ),
|
||||
local = this[ fn ](),
|
||||
cur = local[ prop.idx ],
|
||||
match;
|
||||
|
||||
if ( vtype === "undefined" ) {
|
||||
return cur;
|
||||
}
|
||||
|
||||
if ( vtype === "function" ) {
|
||||
value = value.call( this, cur );
|
||||
vtype = jQuery.type( value );
|
||||
}
|
||||
if ( value == null && prop.empty ) {
|
||||
return this;
|
||||
}
|
||||
if ( vtype === "string" ) {
|
||||
match = rplusequals.exec( value );
|
||||
if ( match ) {
|
||||
value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 );
|
||||
}
|
||||
}
|
||||
local[ prop.idx ] = value;
|
||||
return this[ fn ]( local );
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
// 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,
|
||||
backgroundColor = "";
|
||||
|
||||
if ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) {
|
||||
value = color( parsed || value );
|
||||
if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
|
||||
curElem = hook === "backgroundColor" ? elem.parentNode : elem;
|
||||
while (
|
||||
(backgroundColor === "" || backgroundColor === "transparent") &&
|
||||
curElem && curElem.style
|
||||
) {
|
||||
try {
|
||||
backgroundColor = jQuery.css( curElem, "backgroundColor" );
|
||||
curElem = curElem.parentNode;
|
||||
} catch ( e ) {
|
||||
}
|
||||
}
|
||||
|
||||
value = value.blend( backgroundColor && backgroundColor !== "transparent" ?
|
||||
backgroundColor :
|
||||
"_default" );
|
||||
}
|
||||
|
||||
value = value.toRgbaString();
|
||||
}
|
||||
try {
|
||||
elem.style[ hook ] = value;
|
||||
} catch( value ) {
|
||||
// wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
|
||||
}
|
||||
}
|
||||
};
|
||||
jQuery.fx.step[ hook ] = function( fx ) {
|
||||
if ( !fx.colorInit ) {
|
||||
fx.start = color( fx.elem, hook );
|
||||
fx.end = color( fx.end );
|
||||
fx.colorInit = true;
|
||||
}
|
||||
jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );
|
||||
};
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
color.hook( stepHooks );
|
||||
|
||||
jQuery.cssHooks.borderColor = {
|
||||
expand: function( value ) {
|
||||
var expanded = {};
|
||||
|
||||
each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) {
|
||||
expanded[ "border" + part + "Color" ] = value;
|
||||
});
|
||||
return expanded;
|
||||
}
|
||||
};
|
||||
|
||||
// Basic color names only.
|
||||
// Usage of any of the other color names requires adding yourself or including
|
||||
// jquery.color.svg-names.js.
|
||||
colors = jQuery.Color.names = {
|
||||
// 4.1. Basic color keywords
|
||||
aqua: "#00ffff",
|
||||
black: "#000000",
|
||||
blue: "#0000ff",
|
||||
fuchsia: "#ff00ff",
|
||||
gray: "#808080",
|
||||
green: "#008000",
|
||||
lime: "#00ff00",
|
||||
maroon: "#800000",
|
||||
navy: "#000080",
|
||||
olive: "#808000",
|
||||
purple: "#800080",
|
||||
red: "#ff0000",
|
||||
silver: "#c0c0c0",
|
||||
teal: "#008080",
|
||||
white: "#ffffff",
|
||||
yellow: "#ffff00",
|
||||
|
||||
// 4.2.3. ‘transparent’ color keyword
|
||||
transparent: [ null, null, null, 0 ],
|
||||
|
||||
_default: "#ffffff"
|
||||
};
|
||||
|
||||
})( jQuery );
|
||||
|
||||
/*!
|
||||
* jQuery Color Animations v2.1.0 - SVG Color Names
|
||||
* http://jquery.org/
|
||||
*
|
||||
* Remaining HTML/CSS color names per W3C's CSS Color Module Level 3.
|
||||
* http://www.w3.org/TR/css3-color/#svg-color
|
||||
*
|
||||
* Copyright 2012 jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* Date: Fri Aug 24 12:02:24 2012 -0500
|
||||
*/
|
||||
jQuery.extend( jQuery.Color.names, {
|
||||
// 4.3. Extended color keywords (minus the basic ones in core color plugin)
|
||||
aliceblue: "#f0f8ff",
|
||||
antiquewhite: "#faebd7",
|
||||
aquamarine: "#7fffd4",
|
||||
azure: "#f0ffff",
|
||||
beige: "#f5f5dc",
|
||||
bisque: "#ffe4c4",
|
||||
blanchedalmond: "#ffebcd",
|
||||
blueviolet: "#8a2be2",
|
||||
brown: "#a52a2a",
|
||||
burlywood: "#deb887",
|
||||
cadetblue: "#5f9ea0",
|
||||
chartreuse: "#7fff00",
|
||||
chocolate: "#d2691e",
|
||||
coral: "#ff7f50",
|
||||
cornflowerblue: "#6495ed",
|
||||
cornsilk: "#fff8dc",
|
||||
crimson: "#dc143c",
|
||||
cyan: "#00ffff",
|
||||
darkblue: "#00008b",
|
||||
darkcyan: "#008b8b",
|
||||
darkgoldenrod: "#b8860b",
|
||||
darkgray: "#a9a9a9",
|
||||
darkgreen: "#006400",
|
||||
darkgrey: "#a9a9a9",
|
||||
darkkhaki: "#bdb76b",
|
||||
darkmagenta: "#8b008b",
|
||||
darkolivegreen: "#556b2f",
|
||||
darkorange: "#ff8c00",
|
||||
darkorchid: "#9932cc",
|
||||
darkred: "#8b0000",
|
||||
darksalmon: "#e9967a",
|
||||
darkseagreen: "#8fbc8f",
|
||||
darkslateblue: "#483d8b",
|
||||
darkslategray: "#2f4f4f",
|
||||
darkslategrey: "#2f4f4f",
|
||||
darkturquoise: "#00ced1",
|
||||
darkviolet: "#9400d3",
|
||||
deeppink: "#ff1493",
|
||||
deepskyblue: "#00bfff",
|
||||
dimgray: "#696969",
|
||||
dimgrey: "#696969",
|
||||
dodgerblue: "#1e90ff",
|
||||
firebrick: "#b22222",
|
||||
floralwhite: "#fffaf0",
|
||||
forestgreen: "#228b22",
|
||||
gainsboro: "#dcdcdc",
|
||||
ghostwhite: "#f8f8ff",
|
||||
gold: "#ffd700",
|
||||
goldenrod: "#daa520",
|
||||
greenyellow: "#adff2f",
|
||||
grey: "#808080",
|
||||
honeydew: "#f0fff0",
|
||||
hotpink: "#ff69b4",
|
||||
indianred: "#cd5c5c",
|
||||
indigo: "#4b0082",
|
||||
ivory: "#fffff0",
|
||||
khaki: "#f0e68c",
|
||||
lavender: "#e6e6fa",
|
||||
lavenderblush: "#fff0f5",
|
||||
lawngreen: "#7cfc00",
|
||||
lemonchiffon: "#fffacd",
|
||||
lightblue: "#add8e6",
|
||||
lightcoral: "#f08080",
|
||||
lightcyan: "#e0ffff",
|
||||
lightgoldenrodyellow: "#fafad2",
|
||||
lightgray: "#d3d3d3",
|
||||
lightgreen: "#90ee90",
|
||||
lightgrey: "#d3d3d3",
|
||||
lightpink: "#ffb6c1",
|
||||
lightsalmon: "#ffa07a",
|
||||
lightseagreen: "#20b2aa",
|
||||
lightskyblue: "#87cefa",
|
||||
lightslategray: "#778899",
|
||||
lightslategrey: "#778899",
|
||||
lightsteelblue: "#b0c4de",
|
||||
lightyellow: "#ffffe0",
|
||||
limegreen: "#32cd32",
|
||||
linen: "#faf0e6",
|
||||
mediumaquamarine: "#66cdaa",
|
||||
mediumblue: "#0000cd",
|
||||
mediumorchid: "#ba55d3",
|
||||
mediumpurple: "#9370db",
|
||||
mediumseagreen: "#3cb371",
|
||||
mediumslateblue: "#7b68ee",
|
||||
mediumspringgreen: "#00fa9a",
|
||||
mediumturquoise: "#48d1cc",
|
||||
mediumvioletred: "#c71585",
|
||||
midnightblue: "#191970",
|
||||
mintcream: "#f5fffa",
|
||||
mistyrose: "#ffe4e1",
|
||||
moccasin: "#ffe4b5",
|
||||
navajowhite: "#ffdead",
|
||||
oldlace: "#fdf5e6",
|
||||
olivedrab: "#6b8e23",
|
||||
orange: "#ffa500",
|
||||
orangered: "#ff4500",
|
||||
orchid: "#da70d6",
|
||||
palegoldenrod: "#eee8aa",
|
||||
palegreen: "#98fb98",
|
||||
paleturquoise: "#afeeee",
|
||||
palevioletred: "#db7093",
|
||||
papayawhip: "#ffefd5",
|
||||
peachpuff: "#ffdab9",
|
||||
peru: "#cd853f",
|
||||
pink: "#ffc0cb",
|
||||
plum: "#dda0dd",
|
||||
powderblue: "#b0e0e6",
|
||||
rosybrown: "#bc8f8f",
|
||||
royalblue: "#4169e1",
|
||||
saddlebrown: "#8b4513",
|
||||
salmon: "#fa8072",
|
||||
sandybrown: "#f4a460",
|
||||
seagreen: "#2e8b57",
|
||||
seashell: "#fff5ee",
|
||||
sienna: "#a0522d",
|
||||
skyblue: "#87ceeb",
|
||||
slateblue: "#6a5acd",
|
||||
slategray: "#708090",
|
||||
slategrey: "#708090",
|
||||
snow: "#fffafa",
|
||||
springgreen: "#00ff7f",
|
||||
steelblue: "#4682b4",
|
||||
tan: "#d2b48c",
|
||||
thistle: "#d8bfd8",
|
||||
tomato: "#ff6347",
|
||||
turquoise: "#40e0d0",
|
||||
violet: "#ee82ee",
|
||||
wheat: "#f5deb3",
|
||||
whitesmoke: "#f5f5f5",
|
||||
yellowgreen: "#9acd32",
|
||||
});
|
File diff suppressed because one or more lines are too long
|
@ -160,7 +160,7 @@ function wp_default_scripts( &$scripts ) {
|
|||
$scripts->add( 'jquery-form', "/wp-includes/js/jquery/jquery.form$suffix.js", array('jquery'), '2.73', 1 );
|
||||
|
||||
// jQuery plugins
|
||||
$scripts->add( 'jquery-color', "/wp-includes/js/jquery/jquery.color$suffix.js", array('jquery'), '2.0-4561m', 1 );
|
||||
$scripts->add( 'jquery-color', "/wp-includes/js/jquery/jquery.color$suffix.js", array('jquery'), '2.1.0', 1 );
|
||||
$scripts->add( 'suggest', "/wp-includes/js/jquery/suggest$suffix.js", array('jquery'), '1.1-20110113', 1 );
|
||||
$scripts->add( 'schedule', '/wp-includes/js/jquery/jquery.schedule.js', array('jquery'), '20m', 1 );
|
||||
$scripts->add( 'jquery-query', "/wp-includes/js/jquery/jquery.query.js", array('jquery'), '2.1.7', 1 );
|
||||
|
|
Loading…
Reference in New Issue