1 /*! |
1 /*! |
2 * jQuery UI Effects 1.13.1 |
2 * jQuery UI Effects 1.13.3 |
3 * http://jqueryui.com |
3 * https://jqueryui.com |
4 * |
4 * |
5 * Copyright jQuery Foundation and other contributors |
5 * Copyright OpenJS Foundation and other contributors |
6 * Released under the MIT license. |
6 * Released under the MIT license. |
7 * http://jquery.org/license |
7 * https://jquery.org/license |
8 */ |
8 */ |
9 |
9 |
10 //>>label: Effects Core |
10 //>>label: Effects Core |
11 //>>group: Effects |
11 //>>group: Effects |
12 /* eslint-disable max-len */ |
12 /* eslint-disable max-len */ |
13 //>>description: Extends the internal jQuery effects. Includes morphing and easing. Required by all other effects. |
13 //>>description: Extends the internal jQuery effects. Includes morphing and easing. Required by all other effects. |
14 /* eslint-enable max-len */ |
14 /* eslint-enable max-len */ |
15 //>>docs: http://api.jqueryui.com/category/effects-core/ |
15 //>>docs: https://api.jqueryui.com/category/effects-core/ |
16 //>>demos: http://jqueryui.com/effect/ |
16 //>>demos: https://jqueryui.com/effect/ |
17 |
17 |
18 ( function( factory ) { |
18 ( function( factory ) { |
19 "use strict"; |
19 "use strict"; |
20 |
20 |
21 if ( typeof define === "function" && define.amd ) { |
21 if ( typeof define === "function" && define.amd ) { |
22 |
22 |
23 // AMD. Register as an anonymous module. |
23 // AMD. Register as an anonymous module. |
24 define( [ "jquery" ], factory ); |
24 define( [ |
|
25 "jquery", |
|
26 "./jquery-var-for-color", |
|
27 "./vendor/jquery-color/jquery.color", |
|
28 "./version" |
|
29 ], factory ); |
25 } else { |
30 } else { |
26 |
31 |
27 // Browser globals |
32 // Browser globals |
28 factory( jQuery ); |
33 factory( jQuery ); |
29 } |
34 } |
30 } )( function( $ ) { |
35 } )( function( $ ) { |
31 "use strict"; |
36 "use strict"; |
32 |
|
33 // Include version.js |
|
34 $.ui = $.ui || {}; |
|
35 $.ui.version = "1.13.1"; |
|
36 |
|
37 // Source: jquery-var-for-color.js |
|
38 // Create a local jQuery because jQuery Color relies on it and the |
|
39 // global may not exist with AMD and a custom build (#10199). |
|
40 // This module is a noop if used as a regular AMD module. |
|
41 // eslint-disable-next-line no-unused-vars |
|
42 var jQuery = $; |
|
43 |
|
44 |
|
45 /*! |
|
46 * jQuery Color Animations v2.2.0 |
|
47 * https://github.com/jquery/jquery-color |
|
48 * |
|
49 * Copyright OpenJS Foundation and other contributors |
|
50 * Released under the MIT license. |
|
51 * http://jquery.org/license |
|
52 * |
|
53 * Date: Sun May 10 09:02:36 2020 +0200 |
|
54 */ |
|
55 |
|
56 var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor " + |
|
57 "borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor", |
|
58 |
|
59 class2type = {}, |
|
60 toString = class2type.toString, |
|
61 |
|
62 // plusequals test for += 100 -= 100 |
|
63 rplusequals = /^([\-+])=\s*(\d+\.?\d*)/, |
|
64 |
|
65 // a set of RE's that can match strings and generate color tuples. |
|
66 stringParsers = [ { |
|
67 re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, |
|
68 parse: function( execResult ) { |
|
69 return [ |
|
70 execResult[ 1 ], |
|
71 execResult[ 2 ], |
|
72 execResult[ 3 ], |
|
73 execResult[ 4 ] |
|
74 ]; |
|
75 } |
|
76 }, { |
|
77 re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, |
|
78 parse: function( execResult ) { |
|
79 return [ |
|
80 execResult[ 1 ] * 2.55, |
|
81 execResult[ 2 ] * 2.55, |
|
82 execResult[ 3 ] * 2.55, |
|
83 execResult[ 4 ] |
|
84 ]; |
|
85 } |
|
86 }, { |
|
87 |
|
88 // this regex ignores A-F because it's compared against an already lowercased string |
|
89 re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})?/, |
|
90 parse: function( execResult ) { |
|
91 return [ |
|
92 parseInt( execResult[ 1 ], 16 ), |
|
93 parseInt( execResult[ 2 ], 16 ), |
|
94 parseInt( execResult[ 3 ], 16 ), |
|
95 execResult[ 4 ] ? |
|
96 ( parseInt( execResult[ 4 ], 16 ) / 255 ).toFixed( 2 ) : |
|
97 1 |
|
98 ]; |
|
99 } |
|
100 }, { |
|
101 |
|
102 // this regex ignores A-F because it's compared against an already lowercased string |
|
103 re: /#([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])?/, |
|
104 parse: function( execResult ) { |
|
105 return [ |
|
106 parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ), |
|
107 parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ), |
|
108 parseInt( execResult[ 3 ] + execResult[ 3 ], 16 ), |
|
109 execResult[ 4 ] ? |
|
110 ( parseInt( execResult[ 4 ] + execResult[ 4 ], 16 ) / 255 ) |
|
111 .toFixed( 2 ) : |
|
112 1 |
|
113 ]; |
|
114 } |
|
115 }, { |
|
116 re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, |
|
117 space: "hsla", |
|
118 parse: function( execResult ) { |
|
119 return [ |
|
120 execResult[ 1 ], |
|
121 execResult[ 2 ] / 100, |
|
122 execResult[ 3 ] / 100, |
|
123 execResult[ 4 ] |
|
124 ]; |
|
125 } |
|
126 } ], |
|
127 |
|
128 // jQuery.Color( ) |
|
129 color = jQuery.Color = function( color, green, blue, alpha ) { |
|
130 return new jQuery.Color.fn.parse( color, green, blue, alpha ); |
|
131 }, |
|
132 spaces = { |
|
133 rgba: { |
|
134 props: { |
|
135 red: { |
|
136 idx: 0, |
|
137 type: "byte" |
|
138 }, |
|
139 green: { |
|
140 idx: 1, |
|
141 type: "byte" |
|
142 }, |
|
143 blue: { |
|
144 idx: 2, |
|
145 type: "byte" |
|
146 } |
|
147 } |
|
148 }, |
|
149 |
|
150 hsla: { |
|
151 props: { |
|
152 hue: { |
|
153 idx: 0, |
|
154 type: "degrees" |
|
155 }, |
|
156 saturation: { |
|
157 idx: 1, |
|
158 type: "percent" |
|
159 }, |
|
160 lightness: { |
|
161 idx: 2, |
|
162 type: "percent" |
|
163 } |
|
164 } |
|
165 } |
|
166 }, |
|
167 propTypes = { |
|
168 "byte": { |
|
169 floor: true, |
|
170 max: 255 |
|
171 }, |
|
172 "percent": { |
|
173 max: 1 |
|
174 }, |
|
175 "degrees": { |
|
176 mod: 360, |
|
177 floor: true |
|
178 } |
|
179 }, |
|
180 support = color.support = {}, |
|
181 |
|
182 // element for support tests |
|
183 supportElem = jQuery( "<p>" )[ 0 ], |
|
184 |
|
185 // colors = jQuery.Color.names |
|
186 colors, |
|
187 |
|
188 // local aliases of functions called often |
|
189 each = jQuery.each; |
|
190 |
|
191 // determine rgba support immediately |
|
192 supportElem.style.cssText = "background-color:rgba(1,1,1,.5)"; |
|
193 support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1; |
|
194 |
|
195 // define cache name and alpha properties |
|
196 // for rgba and hsla spaces |
|
197 each( spaces, function( spaceName, space ) { |
|
198 space.cache = "_" + spaceName; |
|
199 space.props.alpha = { |
|
200 idx: 3, |
|
201 type: "percent", |
|
202 def: 1 |
|
203 }; |
|
204 } ); |
|
205 |
|
206 // Populate the class2type map |
|
207 jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), |
|
208 function( _i, name ) { |
|
209 class2type[ "[object " + name + "]" ] = name.toLowerCase(); |
|
210 } ); |
|
211 |
|
212 function getType( obj ) { |
|
213 if ( obj == null ) { |
|
214 return obj + ""; |
|
215 } |
|
216 |
|
217 return typeof obj === "object" ? |
|
218 class2type[ toString.call( obj ) ] || "object" : |
|
219 typeof obj; |
|
220 } |
|
221 |
|
222 function clamp( value, prop, allowEmpty ) { |
|
223 var type = propTypes[ prop.type ] || {}; |
|
224 |
|
225 if ( value == null ) { |
|
226 return ( allowEmpty || !prop.def ) ? null : prop.def; |
|
227 } |
|
228 |
|
229 // ~~ is an short way of doing floor for positive numbers |
|
230 value = type.floor ? ~~value : parseFloat( value ); |
|
231 |
|
232 // IE will pass in empty strings as value for alpha, |
|
233 // which will hit this case |
|
234 if ( isNaN( value ) ) { |
|
235 return prop.def; |
|
236 } |
|
237 |
|
238 if ( type.mod ) { |
|
239 |
|
240 // we add mod before modding to make sure that negatives values |
|
241 // get converted properly: -10 -> 350 |
|
242 return ( value + type.mod ) % type.mod; |
|
243 } |
|
244 |
|
245 // for now all property types without mod have min and max |
|
246 return Math.min( type.max, Math.max( 0, value ) ); |
|
247 } |
|
248 |
|
249 function stringParse( string ) { |
|
250 var inst = color(), |
|
251 rgba = inst._rgba = []; |
|
252 |
|
253 string = string.toLowerCase(); |
|
254 |
|
255 each( stringParsers, function( _i, parser ) { |
|
256 var parsed, |
|
257 match = parser.re.exec( string ), |
|
258 values = match && parser.parse( match ), |
|
259 spaceName = parser.space || "rgba"; |
|
260 |
|
261 if ( values ) { |
|
262 parsed = inst[ spaceName ]( values ); |
|
263 |
|
264 // if this was an rgba parse the assignment might happen twice |
|
265 // oh well.... |
|
266 inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ]; |
|
267 rgba = inst._rgba = parsed._rgba; |
|
268 |
|
269 // exit each( stringParsers ) here because we matched |
|
270 return false; |
|
271 } |
|
272 } ); |
|
273 |
|
274 // Found a stringParser that handled it |
|
275 if ( rgba.length ) { |
|
276 |
|
277 // if this came from a parsed string, force "transparent" when alpha is 0 |
|
278 // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0) |
|
279 if ( rgba.join() === "0,0,0,0" ) { |
|
280 jQuery.extend( rgba, colors.transparent ); |
|
281 } |
|
282 return inst; |
|
283 } |
|
284 |
|
285 // named colors |
|
286 return colors[ string ]; |
|
287 } |
|
288 |
|
289 color.fn = jQuery.extend( color.prototype, { |
|
290 parse: function( red, green, blue, alpha ) { |
|
291 if ( red === undefined ) { |
|
292 this._rgba = [ null, null, null, null ]; |
|
293 return this; |
|
294 } |
|
295 if ( red.jquery || red.nodeType ) { |
|
296 red = jQuery( red ).css( green ); |
|
297 green = undefined; |
|
298 } |
|
299 |
|
300 var inst = this, |
|
301 type = getType( red ), |
|
302 rgba = this._rgba = []; |
|
303 |
|
304 // more than 1 argument specified - assume ( red, green, blue, alpha ) |
|
305 if ( green !== undefined ) { |
|
306 red = [ red, green, blue, alpha ]; |
|
307 type = "array"; |
|
308 } |
|
309 |
|
310 if ( type === "string" ) { |
|
311 return this.parse( stringParse( red ) || colors._default ); |
|
312 } |
|
313 |
|
314 if ( type === "array" ) { |
|
315 each( spaces.rgba.props, function( _key, prop ) { |
|
316 rgba[ prop.idx ] = clamp( red[ prop.idx ], prop ); |
|
317 } ); |
|
318 return this; |
|
319 } |
|
320 |
|
321 if ( type === "object" ) { |
|
322 if ( red instanceof color ) { |
|
323 each( spaces, function( _spaceName, space ) { |
|
324 if ( red[ space.cache ] ) { |
|
325 inst[ space.cache ] = red[ space.cache ].slice(); |
|
326 } |
|
327 } ); |
|
328 } else { |
|
329 each( spaces, function( _spaceName, space ) { |
|
330 var cache = space.cache; |
|
331 each( space.props, function( key, prop ) { |
|
332 |
|
333 // if the cache doesn't exist, and we know how to convert |
|
334 if ( !inst[ cache ] && space.to ) { |
|
335 |
|
336 // if the value was null, we don't need to copy it |
|
337 // if the key was alpha, we don't need to copy it either |
|
338 if ( key === "alpha" || red[ key ] == null ) { |
|
339 return; |
|
340 } |
|
341 inst[ cache ] = space.to( inst._rgba ); |
|
342 } |
|
343 |
|
344 // this is the only case where we allow nulls for ALL properties. |
|
345 // call clamp with alwaysAllowEmpty |
|
346 inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true ); |
|
347 } ); |
|
348 |
|
349 // everything defined but alpha? |
|
350 if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) { |
|
351 |
|
352 // use the default of 1 |
|
353 if ( inst[ cache ][ 3 ] == null ) { |
|
354 inst[ cache ][ 3 ] = 1; |
|
355 } |
|
356 |
|
357 if ( space.from ) { |
|
358 inst._rgba = space.from( inst[ cache ] ); |
|
359 } |
|
360 } |
|
361 } ); |
|
362 } |
|
363 return this; |
|
364 } |
|
365 }, |
|
366 is: function( compare ) { |
|
367 var is = color( compare ), |
|
368 same = true, |
|
369 inst = this; |
|
370 |
|
371 each( spaces, function( _, space ) { |
|
372 var localCache, |
|
373 isCache = is[ space.cache ]; |
|
374 if ( isCache ) { |
|
375 localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || []; |
|
376 each( space.props, function( _, prop ) { |
|
377 if ( isCache[ prop.idx ] != null ) { |
|
378 same = ( isCache[ prop.idx ] === localCache[ prop.idx ] ); |
|
379 return same; |
|
380 } |
|
381 } ); |
|
382 } |
|
383 return same; |
|
384 } ); |
|
385 return same; |
|
386 }, |
|
387 _space: function() { |
|
388 var used = [], |
|
389 inst = this; |
|
390 each( spaces, function( spaceName, space ) { |
|
391 if ( inst[ space.cache ] ) { |
|
392 used.push( spaceName ); |
|
393 } |
|
394 } ); |
|
395 return used.pop(); |
|
396 }, |
|
397 transition: function( other, distance ) { |
|
398 var end = color( other ), |
|
399 spaceName = end._space(), |
|
400 space = spaces[ spaceName ], |
|
401 startColor = this.alpha() === 0 ? color( "transparent" ) : this, |
|
402 start = startColor[ space.cache ] || space.to( startColor._rgba ), |
|
403 result = start.slice(); |
|
404 |
|
405 end = end[ space.cache ]; |
|
406 each( space.props, function( _key, prop ) { |
|
407 var index = prop.idx, |
|
408 startValue = start[ index ], |
|
409 endValue = end[ index ], |
|
410 type = propTypes[ prop.type ] || {}; |
|
411 |
|
412 // if null, don't override start value |
|
413 if ( endValue === null ) { |
|
414 return; |
|
415 } |
|
416 |
|
417 // if null - use end |
|
418 if ( startValue === null ) { |
|
419 result[ index ] = endValue; |
|
420 } else { |
|
421 if ( type.mod ) { |
|
422 if ( endValue - startValue > type.mod / 2 ) { |
|
423 startValue += type.mod; |
|
424 } else if ( startValue - endValue > type.mod / 2 ) { |
|
425 startValue -= type.mod; |
|
426 } |
|
427 } |
|
428 result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop ); |
|
429 } |
|
430 } ); |
|
431 return this[ spaceName ]( result ); |
|
432 }, |
|
433 blend: function( opaque ) { |
|
434 |
|
435 // if we are already opaque - return ourself |
|
436 if ( this._rgba[ 3 ] === 1 ) { |
|
437 return this; |
|
438 } |
|
439 |
|
440 var rgb = this._rgba.slice(), |
|
441 a = rgb.pop(), |
|
442 blend = color( opaque )._rgba; |
|
443 |
|
444 return color( jQuery.map( rgb, function( v, i ) { |
|
445 return ( 1 - a ) * blend[ i ] + a * v; |
|
446 } ) ); |
|
447 }, |
|
448 toRgbaString: function() { |
|
449 var prefix = "rgba(", |
|
450 rgba = jQuery.map( this._rgba, function( v, i ) { |
|
451 if ( v != null ) { |
|
452 return v; |
|
453 } |
|
454 return i > 2 ? 1 : 0; |
|
455 } ); |
|
456 |
|
457 if ( rgba[ 3 ] === 1 ) { |
|
458 rgba.pop(); |
|
459 prefix = "rgb("; |
|
460 } |
|
461 |
|
462 return prefix + rgba.join() + ")"; |
|
463 }, |
|
464 toHslaString: function() { |
|
465 var prefix = "hsla(", |
|
466 hsla = jQuery.map( this.hsla(), function( v, i ) { |
|
467 if ( v == null ) { |
|
468 v = i > 2 ? 1 : 0; |
|
469 } |
|
470 |
|
471 // catch 1 and 2 |
|
472 if ( i && i < 3 ) { |
|
473 v = Math.round( v * 100 ) + "%"; |
|
474 } |
|
475 return v; |
|
476 } ); |
|
477 |
|
478 if ( hsla[ 3 ] === 1 ) { |
|
479 hsla.pop(); |
|
480 prefix = "hsl("; |
|
481 } |
|
482 return prefix + hsla.join() + ")"; |
|
483 }, |
|
484 toHexString: function( includeAlpha ) { |
|
485 var rgba = this._rgba.slice(), |
|
486 alpha = rgba.pop(); |
|
487 |
|
488 if ( includeAlpha ) { |
|
489 rgba.push( ~~( alpha * 255 ) ); |
|
490 } |
|
491 |
|
492 return "#" + jQuery.map( rgba, function( v ) { |
|
493 |
|
494 // default to 0 when nulls exist |
|
495 v = ( v || 0 ).toString( 16 ); |
|
496 return v.length === 1 ? "0" + v : v; |
|
497 } ).join( "" ); |
|
498 }, |
|
499 toString: function() { |
|
500 return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString(); |
|
501 } |
|
502 } ); |
|
503 color.fn.parse.prototype = color.fn; |
|
504 |
|
505 // hsla conversions adapted from: |
|
506 // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021 |
|
507 |
|
508 function hue2rgb( p, q, h ) { |
|
509 h = ( h + 1 ) % 1; |
|
510 if ( h * 6 < 1 ) { |
|
511 return p + ( q - p ) * h * 6; |
|
512 } |
|
513 if ( h * 2 < 1 ) { |
|
514 return q; |
|
515 } |
|
516 if ( h * 3 < 2 ) { |
|
517 return p + ( q - p ) * ( ( 2 / 3 ) - h ) * 6; |
|
518 } |
|
519 return p; |
|
520 } |
|
521 |
|
522 spaces.hsla.to = function( rgba ) { |
|
523 if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) { |
|
524 return [ null, null, null, rgba[ 3 ] ]; |
|
525 } |
|
526 var r = rgba[ 0 ] / 255, |
|
527 g = rgba[ 1 ] / 255, |
|
528 b = rgba[ 2 ] / 255, |
|
529 a = rgba[ 3 ], |
|
530 max = Math.max( r, g, b ), |
|
531 min = Math.min( r, g, b ), |
|
532 diff = max - min, |
|
533 add = max + min, |
|
534 l = add * 0.5, |
|
535 h, s; |
|
536 |
|
537 if ( min === max ) { |
|
538 h = 0; |
|
539 } else if ( r === max ) { |
|
540 h = ( 60 * ( g - b ) / diff ) + 360; |
|
541 } else if ( g === max ) { |
|
542 h = ( 60 * ( b - r ) / diff ) + 120; |
|
543 } else { |
|
544 h = ( 60 * ( r - g ) / diff ) + 240; |
|
545 } |
|
546 |
|
547 // chroma (diff) == 0 means greyscale which, by definition, saturation = 0% |
|
548 // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add) |
|
549 if ( diff === 0 ) { |
|
550 s = 0; |
|
551 } else if ( l <= 0.5 ) { |
|
552 s = diff / add; |
|
553 } else { |
|
554 s = diff / ( 2 - add ); |
|
555 } |
|
556 return [ Math.round( h ) % 360, s, l, a == null ? 1 : a ]; |
|
557 }; |
|
558 |
|
559 spaces.hsla.from = function( hsla ) { |
|
560 if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) { |
|
561 return [ null, null, null, hsla[ 3 ] ]; |
|
562 } |
|
563 var h = hsla[ 0 ] / 360, |
|
564 s = hsla[ 1 ], |
|
565 l = hsla[ 2 ], |
|
566 a = hsla[ 3 ], |
|
567 q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s, |
|
568 p = 2 * l - q; |
|
569 |
|
570 return [ |
|
571 Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ), |
|
572 Math.round( hue2rgb( p, q, h ) * 255 ), |
|
573 Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ), |
|
574 a |
|
575 ]; |
|
576 }; |
|
577 |
|
578 |
|
579 each( spaces, function( spaceName, space ) { |
|
580 var props = space.props, |
|
581 cache = space.cache, |
|
582 to = space.to, |
|
583 from = space.from; |
|
584 |
|
585 // makes rgba() and hsla() |
|
586 color.fn[ spaceName ] = function( value ) { |
|
587 |
|
588 // generate a cache for this space if it doesn't exist |
|
589 if ( to && !this[ cache ] ) { |
|
590 this[ cache ] = to( this._rgba ); |
|
591 } |
|
592 if ( value === undefined ) { |
|
593 return this[ cache ].slice(); |
|
594 } |
|
595 |
|
596 var ret, |
|
597 type = getType( value ), |
|
598 arr = ( type === "array" || type === "object" ) ? value : arguments, |
|
599 local = this[ cache ].slice(); |
|
600 |
|
601 each( props, function( key, prop ) { |
|
602 var val = arr[ type === "object" ? key : prop.idx ]; |
|
603 if ( val == null ) { |
|
604 val = local[ prop.idx ]; |
|
605 } |
|
606 local[ prop.idx ] = clamp( val, prop ); |
|
607 } ); |
|
608 |
|
609 if ( from ) { |
|
610 ret = color( from( local ) ); |
|
611 ret[ cache ] = local; |
|
612 return ret; |
|
613 } else { |
|
614 return color( local ); |
|
615 } |
|
616 }; |
|
617 |
|
618 // makes red() green() blue() alpha() hue() saturation() lightness() |
|
619 each( props, function( key, prop ) { |
|
620 |
|
621 // alpha is included in more than one space |
|
622 if ( color.fn[ key ] ) { |
|
623 return; |
|
624 } |
|
625 color.fn[ key ] = function( value ) { |
|
626 var local, cur, match, fn, |
|
627 vtype = getType( value ); |
|
628 |
|
629 if ( key === "alpha" ) { |
|
630 fn = this._hsla ? "hsla" : "rgba"; |
|
631 } else { |
|
632 fn = spaceName; |
|
633 } |
|
634 local = this[ fn ](); |
|
635 cur = local[ prop.idx ]; |
|
636 |
|
637 if ( vtype === "undefined" ) { |
|
638 return cur; |
|
639 } |
|
640 |
|
641 if ( vtype === "function" ) { |
|
642 value = value.call( this, cur ); |
|
643 vtype = getType( value ); |
|
644 } |
|
645 if ( value == null && prop.empty ) { |
|
646 return this; |
|
647 } |
|
648 if ( vtype === "string" ) { |
|
649 match = rplusequals.exec( value ); |
|
650 if ( match ) { |
|
651 value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 ); |
|
652 } |
|
653 } |
|
654 local[ prop.idx ] = value; |
|
655 return this[ fn ]( local ); |
|
656 }; |
|
657 } ); |
|
658 } ); |
|
659 |
|
660 // add cssHook and .fx.step function for each named hook. |
|
661 // accept a space separated string of properties |
|
662 color.hook = function( hook ) { |
|
663 var hooks = hook.split( " " ); |
|
664 each( hooks, function( _i, hook ) { |
|
665 jQuery.cssHooks[ hook ] = { |
|
666 set: function( elem, value ) { |
|
667 var parsed, curElem, |
|
668 backgroundColor = ""; |
|
669 |
|
670 if ( value !== "transparent" && ( getType( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) { |
|
671 value = color( parsed || value ); |
|
672 if ( !support.rgba && value._rgba[ 3 ] !== 1 ) { |
|
673 curElem = hook === "backgroundColor" ? elem.parentNode : elem; |
|
674 while ( |
|
675 ( backgroundColor === "" || backgroundColor === "transparent" ) && |
|
676 curElem && curElem.style |
|
677 ) { |
|
678 try { |
|
679 backgroundColor = jQuery.css( curElem, "backgroundColor" ); |
|
680 curElem = curElem.parentNode; |
|
681 } catch ( e ) { |
|
682 } |
|
683 } |
|
684 |
|
685 value = value.blend( backgroundColor && backgroundColor !== "transparent" ? |
|
686 backgroundColor : |
|
687 "_default" ); |
|
688 } |
|
689 |
|
690 value = value.toRgbaString(); |
|
691 } |
|
692 try { |
|
693 elem.style[ hook ] = value; |
|
694 } catch ( e ) { |
|
695 |
|
696 // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit' |
|
697 } |
|
698 } |
|
699 }; |
|
700 jQuery.fx.step[ hook ] = function( fx ) { |
|
701 if ( !fx.colorInit ) { |
|
702 fx.start = color( fx.elem, hook ); |
|
703 fx.end = color( fx.end ); |
|
704 fx.colorInit = true; |
|
705 } |
|
706 jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) ); |
|
707 }; |
|
708 } ); |
|
709 |
|
710 }; |
|
711 |
|
712 color.hook( stepHooks ); |
|
713 |
|
714 jQuery.cssHooks.borderColor = { |
|
715 expand: function( value ) { |
|
716 var expanded = {}; |
|
717 |
|
718 each( [ "Top", "Right", "Bottom", "Left" ], function( _i, part ) { |
|
719 expanded[ "border" + part + "Color" ] = value; |
|
720 } ); |
|
721 return expanded; |
|
722 } |
|
723 }; |
|
724 |
|
725 // Basic color names only. |
|
726 // Usage of any of the other color names requires adding yourself or including |
|
727 // jquery.color.svg-names.js. |
|
728 colors = jQuery.Color.names = { |
|
729 |
|
730 // 4.1. Basic color keywords |
|
731 aqua: "#00ffff", |
|
732 black: "#000000", |
|
733 blue: "#0000ff", |
|
734 fuchsia: "#ff00ff", |
|
735 gray: "#808080", |
|
736 green: "#008000", |
|
737 lime: "#00ff00", |
|
738 maroon: "#800000", |
|
739 navy: "#000080", |
|
740 olive: "#808000", |
|
741 purple: "#800080", |
|
742 red: "#ff0000", |
|
743 silver: "#c0c0c0", |
|
744 teal: "#008080", |
|
745 white: "#ffffff", |
|
746 yellow: "#ffff00", |
|
747 |
|
748 // 4.2.3. "transparent" color keyword |
|
749 transparent: [ null, null, null, 0 ], |
|
750 |
|
751 _default: "#ffffff" |
|
752 }; |
|
753 |
|
754 |
37 |
755 var dataSpace = "ui-effects-", |
38 var dataSpace = "ui-effects-", |
756 dataSpaceStyle = "ui-effects-style", |
39 dataSpaceStyle = "ui-effects-style", |
757 dataSpaceAnimated = "ui-effects-animated"; |
40 dataSpaceAnimated = "ui-effects-animated"; |
758 |
41 |