1 /*! |
1 /*! |
2 * jQuery UI Effects 1.12.1 |
2 * jQuery UI Effects 1.13.1 |
3 * http://jqueryui.com |
3 * http://jqueryui.com |
4 * |
4 * |
5 * Copyright jQuery Foundation and other contributors |
5 * Copyright jQuery Foundation and other contributors |
6 * Released under the MIT license. |
6 * Released under the MIT license. |
7 * http://jquery.org/license |
7 * http://jquery.org/license |
8 */ |
8 */ |
9 |
9 |
10 //>>label: Effects Core |
10 //>>label: Effects Core |
11 //>>group: Effects |
11 //>>group: Effects |
12 // jscs:disable maximumLineLength |
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 // jscs:enable maximumLineLength |
14 /* eslint-enable max-len */ |
15 //>>docs: http://api.jqueryui.com/category/effects-core/ |
15 //>>docs: http://api.jqueryui.com/category/effects-core/ |
16 //>>demos: http://jqueryui.com/effect/ |
16 //>>demos: http://jqueryui.com/effect/ |
17 |
17 |
18 ( function( factory ) { |
18 ( function( factory ) { |
|
19 "use strict"; |
|
20 |
19 if ( typeof define === "function" && define.amd ) { |
21 if ( typeof define === "function" && define.amd ) { |
20 |
22 |
21 // AMD. Register as an anonymous module. |
23 // AMD. Register as an anonymous module. |
22 define( [ "jquery" ], factory ); |
24 define( [ "jquery" ], factory ); |
23 } else { |
25 } else { |
24 |
26 |
25 // Browser globals |
27 // Browser globals |
26 factory( jQuery ); |
28 factory( jQuery ); |
27 } |
29 } |
28 }( function( $ ) { |
30 } )( function( $ ) { |
|
31 "use strict"; |
29 |
32 |
30 // Include version.js |
33 // Include version.js |
31 $.ui = $.ui || {}; |
34 $.ui = $.ui || {}; |
32 $.ui.version = "1.12.1"; |
35 $.ui.version = "1.13.1"; |
33 |
36 |
34 var dataSpace = "ui-effects-", |
37 // Source: jquery-var-for-color.js |
35 dataSpaceStyle = "ui-effects-style", |
38 // Create a local jQuery because jQuery Color relies on it and the |
36 dataSpaceAnimated = "ui-effects-animated", |
39 // global may not exist with AMD and a custom build (#10199). |
37 |
40 // This module is a noop if used as a regular AMD module. |
38 // Create a local jQuery because jQuery Color relies on it and the |
41 // eslint-disable-next-line no-unused-vars |
39 // global may not exist with AMD and a custom build (#10199) |
42 var jQuery = $; |
40 jQuery = $; |
43 |
41 |
|
42 $.effects = { |
|
43 effect: {} |
|
44 }; |
|
45 |
44 |
46 /*! |
45 /*! |
47 * jQuery Color Animations v2.1.2 |
46 * jQuery Color Animations v2.2.0 |
48 * https://github.com/jquery/jquery-color |
47 * https://github.com/jquery/jquery-color |
49 * |
48 * |
50 * Copyright 2014 jQuery Foundation and other contributors |
49 * Copyright OpenJS Foundation and other contributors |
51 * Released under the MIT license. |
50 * Released under the MIT license. |
52 * http://jquery.org/license |
51 * http://jquery.org/license |
53 * |
52 * |
54 * Date: Wed Jan 16 08:47:09 2013 -0600 |
53 * Date: Sun May 10 09:02:36 2020 +0200 |
55 */ |
54 */ |
56 ( function( jQuery, undefined ) { |
|
57 |
55 |
58 var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor " + |
56 var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor " + |
59 "borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor", |
57 "borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor", |
60 |
58 |
61 // Plusequals test for += 100 -= 100 |
59 class2type = {}, |
|
60 toString = class2type.toString, |
|
61 |
|
62 // plusequals test for += 100 -= 100 |
62 rplusequals = /^([\-+])=\s*(\d+\.?\d*)/, |
63 rplusequals = /^([\-+])=\s*(\d+\.?\d*)/, |
63 |
64 |
64 // A set of RE's that can match strings and generate color tuples. |
65 // a set of RE's that can match strings and generate color tuples. |
65 stringParsers = [ { |
66 stringParsers = [ { |
66 re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, |
67 re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, |
67 parse: function( execResult ) { |
68 parse: function( execResult ) { |
68 return [ |
69 return [ |
69 execResult[ 1 ], |
70 execResult[ 1 ], |
82 execResult[ 4 ] |
83 execResult[ 4 ] |
83 ]; |
84 ]; |
84 } |
85 } |
85 }, { |
86 }, { |
86 |
87 |
87 // This regex ignores A-F because it's compared against an already lowercased string |
88 // this regex ignores A-F because it's compared against an already lowercased string |
88 re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/, |
89 re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})?/, |
89 parse: function( execResult ) { |
90 parse: function( execResult ) { |
90 return [ |
91 return [ |
91 parseInt( execResult[ 1 ], 16 ), |
92 parseInt( execResult[ 1 ], 16 ), |
92 parseInt( execResult[ 2 ], 16 ), |
93 parseInt( execResult[ 2 ], 16 ), |
93 parseInt( execResult[ 3 ], 16 ) |
94 parseInt( execResult[ 3 ], 16 ), |
|
95 execResult[ 4 ] ? |
|
96 ( parseInt( execResult[ 4 ], 16 ) / 255 ).toFixed( 2 ) : |
|
97 1 |
94 ]; |
98 ]; |
95 } |
99 } |
96 }, { |
100 }, { |
97 |
101 |
98 // This regex ignores A-F because it's compared against an already lowercased string |
102 // this regex ignores A-F because it's compared against an already lowercased string |
99 re: /#([a-f0-9])([a-f0-9])([a-f0-9])/, |
103 re: /#([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])?/, |
100 parse: function( execResult ) { |
104 parse: function( execResult ) { |
101 return [ |
105 return [ |
102 parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ), |
106 parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ), |
103 parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ), |
107 parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ), |
104 parseInt( execResult[ 3 ] + execResult[ 3 ], 16 ) |
108 parseInt( execResult[ 3 ] + execResult[ 3 ], 16 ), |
|
109 execResult[ 4 ] ? |
|
110 ( parseInt( execResult[ 4 ] + execResult[ 4 ], 16 ) / 255 ) |
|
111 .toFixed( 2 ) : |
|
112 1 |
105 ]; |
113 ]; |
106 } |
114 } |
107 }, { |
115 }, { |
108 re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, |
116 re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, |
109 space: "hsla", |
117 space: "hsla", |
169 floor: true |
177 floor: true |
170 } |
178 } |
171 }, |
179 }, |
172 support = color.support = {}, |
180 support = color.support = {}, |
173 |
181 |
174 // Element for support tests |
182 // element for support tests |
175 supportElem = jQuery( "<p>" )[ 0 ], |
183 supportElem = jQuery( "<p>" )[ 0 ], |
176 |
184 |
177 // Colors = jQuery.Color.names |
185 // colors = jQuery.Color.names |
178 colors, |
186 colors, |
179 |
187 |
180 // Local aliases of functions called often |
188 // local aliases of functions called often |
181 each = jQuery.each; |
189 each = jQuery.each; |
182 |
190 |
183 // Determine rgba support immediately |
191 // determine rgba support immediately |
184 supportElem.style.cssText = "background-color:rgba(1,1,1,.5)"; |
192 supportElem.style.cssText = "background-color:rgba(1,1,1,.5)"; |
185 support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1; |
193 support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1; |
186 |
194 |
187 // Define cache name and alpha properties |
195 // define cache name and alpha properties |
188 // for rgba and hsla spaces |
196 // for rgba and hsla spaces |
189 each( spaces, function( spaceName, space ) { |
197 each( spaces, function( spaceName, space ) { |
190 space.cache = "_" + spaceName; |
198 space.cache = "_" + spaceName; |
191 space.props.alpha = { |
199 space.props.alpha = { |
192 idx: 3, |
200 idx: 3, |
193 type: "percent", |
201 type: "percent", |
194 def: 1 |
202 def: 1 |
195 }; |
203 }; |
196 } ); |
204 } ); |
197 |
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 |
198 function clamp( value, prop, allowEmpty ) { |
222 function clamp( value, prop, allowEmpty ) { |
199 var type = propTypes[ prop.type ] || {}; |
223 var type = propTypes[ prop.type ] || {}; |
200 |
224 |
201 if ( value == null ) { |
225 if ( value == null ) { |
202 return ( allowEmpty || !prop.def ) ? null : prop.def; |
226 return ( allowEmpty || !prop.def ) ? null : prop.def; |
211 return prop.def; |
235 return prop.def; |
212 } |
236 } |
213 |
237 |
214 if ( type.mod ) { |
238 if ( type.mod ) { |
215 |
239 |
216 // We add mod before modding to make sure that negatives values |
240 // we add mod before modding to make sure that negatives values |
217 // get converted properly: -10 -> 350 |
241 // get converted properly: -10 -> 350 |
218 return ( value + type.mod ) % type.mod; |
242 return ( value + type.mod ) % type.mod; |
219 } |
243 } |
220 |
244 |
221 // For now all property types without mod have min and max |
245 // for now all property types without mod have min and max |
222 return 0 > value ? 0 : type.max < value ? type.max : value; |
246 return Math.min( type.max, Math.max( 0, value ) ); |
223 } |
247 } |
224 |
248 |
225 function stringParse( string ) { |
249 function stringParse( string ) { |
226 var inst = color(), |
250 var inst = color(), |
227 rgba = inst._rgba = []; |
251 rgba = inst._rgba = []; |
228 |
252 |
229 string = string.toLowerCase(); |
253 string = string.toLowerCase(); |
230 |
254 |
231 each( stringParsers, function( i, parser ) { |
255 each( stringParsers, function( _i, parser ) { |
232 var parsed, |
256 var parsed, |
233 match = parser.re.exec( string ), |
257 match = parser.re.exec( string ), |
234 values = match && parser.parse( match ), |
258 values = match && parser.parse( match ), |
235 spaceName = parser.space || "rgba"; |
259 spaceName = parser.space || "rgba"; |
236 |
260 |
237 if ( values ) { |
261 if ( values ) { |
238 parsed = inst[ spaceName ]( values ); |
262 parsed = inst[ spaceName ]( values ); |
239 |
263 |
240 // If this was an rgba parse the assignment might happen twice |
264 // if this was an rgba parse the assignment might happen twice |
241 // oh well.... |
265 // oh well.... |
242 inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ]; |
266 inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ]; |
243 rgba = inst._rgba = parsed._rgba; |
267 rgba = inst._rgba = parsed._rgba; |
244 |
268 |
245 // Exit each( stringParsers ) here because we matched |
269 // exit each( stringParsers ) here because we matched |
246 return false; |
270 return false; |
247 } |
271 } |
248 } ); |
272 } ); |
249 |
273 |
250 // Found a stringParser that handled it |
274 // Found a stringParser that handled it |
251 if ( rgba.length ) { |
275 if ( rgba.length ) { |
252 |
276 |
253 // If this came from a parsed string, force "transparent" when alpha is 0 |
277 // if this came from a parsed string, force "transparent" when alpha is 0 |
254 // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0) |
278 // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0) |
255 if ( rgba.join() === "0,0,0,0" ) { |
279 if ( rgba.join() === "0,0,0,0" ) { |
256 jQuery.extend( rgba, colors.transparent ); |
280 jQuery.extend( rgba, colors.transparent ); |
257 } |
281 } |
258 return inst; |
282 return inst; |
259 } |
283 } |
260 |
284 |
261 // Named colors |
285 // named colors |
262 return colors[ string ]; |
286 return colors[ string ]; |
263 } |
287 } |
264 |
288 |
265 color.fn = jQuery.extend( color.prototype, { |
289 color.fn = jQuery.extend( color.prototype, { |
266 parse: function( red, green, blue, alpha ) { |
290 parse: function( red, green, blue, alpha ) { |
272 red = jQuery( red ).css( green ); |
296 red = jQuery( red ).css( green ); |
273 green = undefined; |
297 green = undefined; |
274 } |
298 } |
275 |
299 |
276 var inst = this, |
300 var inst = this, |
277 type = jQuery.type( red ), |
301 type = getType( red ), |
278 rgba = this._rgba = []; |
302 rgba = this._rgba = []; |
279 |
303 |
280 // More than 1 argument specified - assume ( red, green, blue, alpha ) |
304 // more than 1 argument specified - assume ( red, green, blue, alpha ) |
281 if ( green !== undefined ) { |
305 if ( green !== undefined ) { |
282 red = [ red, green, blue, alpha ]; |
306 red = [ red, green, blue, alpha ]; |
283 type = "array"; |
307 type = "array"; |
284 } |
308 } |
285 |
309 |
286 if ( type === "string" ) { |
310 if ( type === "string" ) { |
287 return this.parse( stringParse( red ) || colors._default ); |
311 return this.parse( stringParse( red ) || colors._default ); |
288 } |
312 } |
289 |
313 |
290 if ( type === "array" ) { |
314 if ( type === "array" ) { |
291 each( spaces.rgba.props, function( key, prop ) { |
315 each( spaces.rgba.props, function( _key, prop ) { |
292 rgba[ prop.idx ] = clamp( red[ prop.idx ], prop ); |
316 rgba[ prop.idx ] = clamp( red[ prop.idx ], prop ); |
293 } ); |
317 } ); |
294 return this; |
318 return this; |
295 } |
319 } |
296 |
320 |
297 if ( type === "object" ) { |
321 if ( type === "object" ) { |
298 if ( red instanceof color ) { |
322 if ( red instanceof color ) { |
299 each( spaces, function( spaceName, space ) { |
323 each( spaces, function( _spaceName, space ) { |
300 if ( red[ space.cache ] ) { |
324 if ( red[ space.cache ] ) { |
301 inst[ space.cache ] = red[ space.cache ].slice(); |
325 inst[ space.cache ] = red[ space.cache ].slice(); |
302 } |
326 } |
303 } ); |
327 } ); |
304 } else { |
328 } else { |
305 each( spaces, function( spaceName, space ) { |
329 each( spaces, function( _spaceName, space ) { |
306 var cache = space.cache; |
330 var cache = space.cache; |
307 each( space.props, function( key, prop ) { |
331 each( space.props, function( key, prop ) { |
308 |
332 |
309 // If the cache doesn't exist, and we know how to convert |
333 // if the cache doesn't exist, and we know how to convert |
310 if ( !inst[ cache ] && space.to ) { |
334 if ( !inst[ cache ] && space.to ) { |
311 |
335 |
312 // If the value was null, we don't need to copy it |
336 // if the value was null, we don't need to copy it |
313 // if the key was alpha, we don't need to copy it either |
337 // if the key was alpha, we don't need to copy it either |
314 if ( key === "alpha" || red[ key ] == null ) { |
338 if ( key === "alpha" || red[ key ] == null ) { |
315 return; |
339 return; |
316 } |
340 } |
317 inst[ cache ] = space.to( inst._rgba ); |
341 inst[ cache ] = space.to( inst._rgba ); |
318 } |
342 } |
319 |
343 |
320 // This is the only case where we allow nulls for ALL properties. |
344 // this is the only case where we allow nulls for ALL properties. |
321 // call clamp with alwaysAllowEmpty |
345 // call clamp with alwaysAllowEmpty |
322 inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true ); |
346 inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true ); |
323 } ); |
347 } ); |
324 |
348 |
325 // Everything defined but alpha? |
349 // everything defined but alpha? |
326 if ( inst[ cache ] && |
350 if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) { |
327 jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) { |
351 |
328 |
352 // use the default of 1 |
329 // Use the default of 1 |
353 if ( inst[ cache ][ 3 ] == null ) { |
330 inst[ cache ][ 3 ] = 1; |
354 inst[ cache ][ 3 ] = 1; |
|
355 } |
|
356 |
331 if ( space.from ) { |
357 if ( space.from ) { |
332 inst._rgba = space.from( inst[ cache ] ); |
358 inst._rgba = space.from( inst[ cache ] ); |
333 } |
359 } |
334 } |
360 } |
335 } ); |
361 } ); |
375 startColor = this.alpha() === 0 ? color( "transparent" ) : this, |
401 startColor = this.alpha() === 0 ? color( "transparent" ) : this, |
376 start = startColor[ space.cache ] || space.to( startColor._rgba ), |
402 start = startColor[ space.cache ] || space.to( startColor._rgba ), |
377 result = start.slice(); |
403 result = start.slice(); |
378 |
404 |
379 end = end[ space.cache ]; |
405 end = end[ space.cache ]; |
380 each( space.props, function( key, prop ) { |
406 each( space.props, function( _key, prop ) { |
381 var index = prop.idx, |
407 var index = prop.idx, |
382 startValue = start[ index ], |
408 startValue = start[ index ], |
383 endValue = end[ index ], |
409 endValue = end[ index ], |
384 type = propTypes[ prop.type ] || {}; |
410 type = propTypes[ prop.type ] || {}; |
385 |
411 |
386 // If null, don't override start value |
412 // if null, don't override start value |
387 if ( endValue === null ) { |
413 if ( endValue === null ) { |
388 return; |
414 return; |
389 } |
415 } |
390 |
416 |
391 // If null - use end |
417 // if null - use end |
392 if ( startValue === null ) { |
418 if ( startValue === null ) { |
393 result[ index ] = endValue; |
419 result[ index ] = endValue; |
394 } else { |
420 } else { |
395 if ( type.mod ) { |
421 if ( type.mod ) { |
396 if ( endValue - startValue > type.mod / 2 ) { |
422 if ( endValue - startValue > type.mod / 2 ) { |
460 rgba.push( ~~( alpha * 255 ) ); |
489 rgba.push( ~~( alpha * 255 ) ); |
461 } |
490 } |
462 |
491 |
463 return "#" + jQuery.map( rgba, function( v ) { |
492 return "#" + jQuery.map( rgba, function( v ) { |
464 |
493 |
465 // Default to 0 when nulls exist |
494 // default to 0 when nulls exist |
466 v = ( v || 0 ).toString( 16 ); |
495 v = ( v || 0 ).toString( 16 ); |
467 return v.length === 1 ? "0" + v : v; |
496 return v.length === 1 ? "0" + v : v; |
468 } ).join( "" ); |
497 } ).join( "" ); |
469 }, |
498 }, |
470 toString: function() { |
499 toString: function() { |
471 return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString(); |
500 return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString(); |
472 } |
501 } |
473 } ); |
502 } ); |
474 color.fn.parse.prototype = color.fn; |
503 color.fn.parse.prototype = color.fn; |
475 |
504 |
476 // Hsla conversions adapted from: |
505 // hsla conversions adapted from: |
477 // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021 |
506 // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021 |
478 |
507 |
479 function hue2rgb( p, q, h ) { |
508 function hue2rgb( p, q, h ) { |
480 h = ( h + 1 ) % 1; |
509 h = ( h + 1 ) % 1; |
481 if ( h * 6 < 1 ) { |
510 if ( h * 6 < 1 ) { |
544 Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ), |
573 Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ), |
545 a |
574 a |
546 ]; |
575 ]; |
547 }; |
576 }; |
548 |
577 |
|
578 |
549 each( spaces, function( spaceName, space ) { |
579 each( spaces, function( spaceName, space ) { |
550 var props = space.props, |
580 var props = space.props, |
551 cache = space.cache, |
581 cache = space.cache, |
552 to = space.to, |
582 to = space.to, |
553 from = space.from; |
583 from = space.from; |
554 |
584 |
555 // Makes rgba() and hsla() |
585 // makes rgba() and hsla() |
556 color.fn[ spaceName ] = function( value ) { |
586 color.fn[ spaceName ] = function( value ) { |
557 |
587 |
558 // Generate a cache for this space if it doesn't exist |
588 // generate a cache for this space if it doesn't exist |
559 if ( to && !this[ cache ] ) { |
589 if ( to && !this[ cache ] ) { |
560 this[ cache ] = to( this._rgba ); |
590 this[ cache ] = to( this._rgba ); |
561 } |
591 } |
562 if ( value === undefined ) { |
592 if ( value === undefined ) { |
563 return this[ cache ].slice(); |
593 return this[ cache ].slice(); |
564 } |
594 } |
565 |
595 |
566 var ret, |
596 var ret, |
567 type = jQuery.type( value ), |
597 type = getType( value ), |
568 arr = ( type === "array" || type === "object" ) ? value : arguments, |
598 arr = ( type === "array" || type === "object" ) ? value : arguments, |
569 local = this[ cache ].slice(); |
599 local = this[ cache ].slice(); |
570 |
600 |
571 each( props, function( key, prop ) { |
601 each( props, function( key, prop ) { |
572 var val = arr[ type === "object" ? key : prop.idx ]; |
602 var val = arr[ type === "object" ? key : prop.idx ]; |
583 } else { |
613 } else { |
584 return color( local ); |
614 return color( local ); |
585 } |
615 } |
586 }; |
616 }; |
587 |
617 |
588 // Makes red() green() blue() alpha() hue() saturation() lightness() |
618 // makes red() green() blue() alpha() hue() saturation() lightness() |
589 each( props, function( key, prop ) { |
619 each( props, function( key, prop ) { |
590 |
620 |
591 // Alpha is included in more than one space |
621 // alpha is included in more than one space |
592 if ( color.fn[ key ] ) { |
622 if ( color.fn[ key ] ) { |
593 return; |
623 return; |
594 } |
624 } |
595 color.fn[ key ] = function( value ) { |
625 color.fn[ key ] = function( value ) { |
596 var vtype = jQuery.type( value ), |
626 var local, cur, match, fn, |
597 fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ), |
627 vtype = getType( value ); |
598 local = this[ fn ](), |
628 |
599 cur = local[ prop.idx ], |
629 if ( key === "alpha" ) { |
600 match; |
630 fn = this._hsla ? "hsla" : "rgba"; |
|
631 } else { |
|
632 fn = spaceName; |
|
633 } |
|
634 local = this[ fn ](); |
|
635 cur = local[ prop.idx ]; |
601 |
636 |
602 if ( vtype === "undefined" ) { |
637 if ( vtype === "undefined" ) { |
603 return cur; |
638 return cur; |
604 } |
639 } |
605 |
640 |
606 if ( vtype === "function" ) { |
641 if ( vtype === "function" ) { |
607 value = value.call( this, cur ); |
642 value = value.call( this, cur ); |
608 vtype = jQuery.type( value ); |
643 vtype = getType( value ); |
609 } |
644 } |
610 if ( value == null && prop.empty ) { |
645 if ( value == null && prop.empty ) { |
611 return this; |
646 return this; |
612 } |
647 } |
613 if ( vtype === "string" ) { |
648 if ( vtype === "string" ) { |
620 return this[ fn ]( local ); |
655 return this[ fn ]( local ); |
621 }; |
656 }; |
622 } ); |
657 } ); |
623 } ); |
658 } ); |
624 |
659 |
625 // Add cssHook and .fx.step function for each named hook. |
660 // add cssHook and .fx.step function for each named hook. |
626 // accept a space separated string of properties |
661 // accept a space separated string of properties |
627 color.hook = function( hook ) { |
662 color.hook = function( hook ) { |
628 var hooks = hook.split( " " ); |
663 var hooks = hook.split( " " ); |
629 each( hooks, function( i, hook ) { |
664 each( hooks, function( _i, hook ) { |
630 jQuery.cssHooks[ hook ] = { |
665 jQuery.cssHooks[ hook ] = { |
631 set: function( elem, value ) { |
666 set: function( elem, value ) { |
632 var parsed, curElem, |
667 var parsed, curElem, |
633 backgroundColor = ""; |
668 backgroundColor = ""; |
634 |
669 |
635 if ( value !== "transparent" && ( jQuery.type( value ) !== "string" || |
670 if ( value !== "transparent" && ( getType( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) { |
636 ( parsed = stringParse( value ) ) ) ) { |
|
637 value = color( parsed || value ); |
671 value = color( parsed || value ); |
638 if ( !support.rgba && value._rgba[ 3 ] !== 1 ) { |
672 if ( !support.rgba && value._rgba[ 3 ] !== 1 ) { |
639 curElem = hook === "backgroundColor" ? elem.parentNode : elem; |
673 curElem = hook === "backgroundColor" ? elem.parentNode : elem; |
640 while ( |
674 while ( |
641 ( backgroundColor === "" || backgroundColor === "transparent" ) && |
675 ( backgroundColor === "" || backgroundColor === "transparent" ) && |
934 /*********************************** EFFECTS **********************************/ |
980 /*********************************** EFFECTS **********************************/ |
935 /******************************************************************************/ |
981 /******************************************************************************/ |
936 |
982 |
937 ( function() { |
983 ( function() { |
938 |
984 |
939 if ( $.expr && $.expr.filters && $.expr.filters.animated ) { |
985 if ( $.expr && $.expr.pseudos && $.expr.pseudos.animated ) { |
940 $.expr.filters.animated = ( function( orig ) { |
986 $.expr.pseudos.animated = ( function( orig ) { |
941 return function( elem ) { |
987 return function( elem ) { |
942 return !!$( elem ).data( dataSpaceAnimated ) || orig( elem ); |
988 return !!$( elem ).data( dataSpaceAnimated ) || orig( elem ); |
943 }; |
989 }; |
944 } )( $.expr.filters.animated ); |
990 } )( $.expr.pseudos.animated ); |
945 } |
991 } |
946 |
992 |
947 if ( $.uiBackCompat !== false ) { |
993 if ( $.uiBackCompat !== false ) { |
948 $.extend( $.effects, { |
994 $.extend( $.effects, { |
949 |
995 |
1201 marginTop: element.css( "marginTop" ), |
1248 marginTop: element.css( "marginTop" ), |
1202 marginBottom: element.css( "marginBottom" ), |
1249 marginBottom: element.css( "marginBottom" ), |
1203 marginLeft: element.css( "marginLeft" ), |
1250 marginLeft: element.css( "marginLeft" ), |
1204 marginRight: element.css( "marginRight" ) |
1251 marginRight: element.css( "marginRight" ) |
1205 } ) |
1252 } ) |
1206 .outerWidth( element.outerWidth() ) |
1253 .outerWidth( element.outerWidth() ) |
1207 .outerHeight( element.outerHeight() ); |
1254 .outerHeight( element.outerHeight() ); |
1208 |
1255 |
1209 if ( /^(static|relative)/.test( cssPosition ) ) { |
1256 if ( /^(static|relative)/.test( cssPosition ) ) { |
1210 cssPosition = "absolute"; |
1257 cssPosition = "absolute"; |
1211 |
1258 |
1212 placeholder = $( "<" + element[ 0 ].nodeName + ">" ).insertAfter( element ).css( { |
1259 placeholder = $( "<" + element[ 0 ].nodeName + ">" ).insertAfter( element ).css( { |
1223 marginBottom: element.css( "marginBottom" ), |
1270 marginBottom: element.css( "marginBottom" ), |
1224 marginLeft: element.css( "marginLeft" ), |
1271 marginLeft: element.css( "marginLeft" ), |
1225 marginRight: element.css( "marginRight" ), |
1272 marginRight: element.css( "marginRight" ), |
1226 "float": element.css( "float" ) |
1273 "float": element.css( "float" ) |
1227 } ) |
1274 } ) |
1228 .outerWidth( element.outerWidth() ) |
1275 .outerWidth( element.outerWidth() ) |
1229 .outerHeight( element.outerHeight() ) |
1276 .outerHeight( element.outerHeight() ) |
1230 .addClass( "ui-effects-placeholder" ); |
1277 .addClass( "ui-effects-placeholder" ); |
1231 |
1278 |
1232 element.data( dataSpace + "placeholder", placeholder ); |
1279 element.data( dataSpace + "placeholder", placeholder ); |
1233 } |
1280 } |
1234 |
1281 |
1235 element.css( { |
1282 element.css( { |
1361 modes = [], |
1408 modes = [], |
1362 prefilter = function( next ) { |
1409 prefilter = function( next ) { |
1363 var el = $( this ), |
1410 var el = $( this ), |
1364 normalizedMode = $.effects.mode( el, mode ) || defaultMode; |
1411 normalizedMode = $.effects.mode( el, mode ) || defaultMode; |
1365 |
1412 |
1366 // Sentinel for duck-punching the :animated psuedo-selector |
1413 // Sentinel for duck-punching the :animated pseudo-selector |
1367 el.data( dataSpaceAnimated, true ); |
1414 el.data( dataSpaceAnimated, true ); |
1368 |
1415 |
1369 // Save effect mode for later use, |
1416 // Save effect mode for later use, |
1370 // we can't just call $.effects.mode again later, |
1417 // we can't just call $.effects.mode again later, |
1371 // as the .show() below destroys the initial state |
1418 // as the .show() below destroys the initial state |
1372 modes.push( normalizedMode ); |
1419 modes.push( normalizedMode ); |
1373 |
1420 |
1374 // See $.uiBackCompat inside of run() for removal of defaultMode in 1.13 |
1421 // See $.uiBackCompat inside of run() for removal of defaultMode in 1.14 |
1375 if ( defaultMode && ( normalizedMode === "show" || |
1422 if ( defaultMode && ( normalizedMode === "show" || |
1376 ( normalizedMode === defaultMode && normalizedMode === "hide" ) ) ) { |
1423 ( normalizedMode === defaultMode && normalizedMode === "hide" ) ) ) { |
1377 el.show(); |
1424 el.show(); |
1378 } |
1425 } |
1379 |
1426 |
1380 if ( !defaultMode || normalizedMode !== "none" ) { |
1427 if ( !defaultMode || normalizedMode !== "none" ) { |
1381 $.effects.saveStyle( el ); |
1428 $.effects.saveStyle( el ); |
1382 } |
1429 } |
1383 |
1430 |
1384 if ( $.isFunction( next ) ) { |
1431 if ( typeof next === "function" ) { |
1385 next(); |
1432 next(); |
1386 } |
1433 } |
1387 }; |
1434 }; |
1388 |
1435 |
1389 if ( $.fx.off || !effectMethod ) { |
1436 if ( $.fx.off || !effectMethod ) { |
1527 left: endPosition.left - fixLeft, |
1574 left: endPosition.left - fixLeft, |
1528 height: target.innerHeight(), |
1575 height: target.innerHeight(), |
1529 width: target.innerWidth() |
1576 width: target.innerWidth() |
1530 }, |
1577 }, |
1531 startPosition = element.offset(), |
1578 startPosition = element.offset(), |
1532 transfer = $( "<div class='ui-effects-transfer'></div>" ) |
1579 transfer = $( "<div class='ui-effects-transfer'></div>" ); |
1533 .appendTo( "body" ) |
1580 |
1534 .addClass( options.className ) |
1581 transfer |
1535 .css( { |
1582 .appendTo( "body" ) |
1536 top: startPosition.top - fixTop, |
1583 .addClass( options.className ) |
1537 left: startPosition.left - fixLeft, |
1584 .css( { |
1538 height: element.innerHeight(), |
1585 top: startPosition.top - fixTop, |
1539 width: element.innerWidth(), |
1586 left: startPosition.left - fixLeft, |
1540 position: targetFixed ? "fixed" : "absolute" |
1587 height: element.innerHeight(), |
1541 } ) |
1588 width: element.innerWidth(), |
1542 .animate( animation, options.duration, options.easing, function() { |
1589 position: targetFixed ? "fixed" : "absolute" |
1543 transfer.remove(); |
1590 } ) |
1544 if ( $.isFunction( done ) ) { |
1591 .animate( animation, options.duration, options.easing, function() { |
1545 done(); |
1592 transfer.remove(); |
1546 } |
1593 if ( typeof done === "function" ) { |
1547 } ); |
1594 done(); |
|
1595 } |
|
1596 } ); |
1548 } |
1597 } |
1549 } ); |
1598 } ); |
1550 |
1599 |
1551 function parseClip( str, element ) { |
1600 function parseClip( str, element ) { |
1552 var outerWidth = element.outerWidth(), |
1601 var outerWidth = element.outerWidth(), |
1553 outerHeight = element.outerHeight(), |
1602 outerHeight = element.outerHeight(), |
1554 clipRegex = /^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/, |
1603 clipRegex = /^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/, |
1555 values = clipRegex.exec( str ) || [ "", 0, outerWidth, outerHeight, 0 ]; |
1604 values = clipRegex.exec( str ) || [ "", 0, outerWidth, outerHeight, 0 ]; |
1556 |
1605 |
1557 return { |
1606 return { |
1558 top: parseFloat( values[ 1 ] ) || 0, |
1607 top: parseFloat( values[ 1 ] ) || 0, |
1559 right: values[ 2 ] === "auto" ? outerWidth : parseFloat( values[ 2 ] ), |
1608 right: values[ 2 ] === "auto" ? outerWidth : parseFloat( values[ 2 ] ), |
1560 bottom: values[ 3 ] === "auto" ? outerHeight : parseFloat( values[ 3 ] ), |
1609 bottom: values[ 3 ] === "auto" ? outerHeight : parseFloat( values[ 3 ] ), |
1561 left: parseFloat( values[ 4 ] ) || 0 |
1610 left: parseFloat( values[ 4 ] ) || 0 |
1562 }; |
1611 }; |
1563 } |
1612 } |
1564 |
1613 |
1565 $.fx.step.clip = function( fx ) { |
1614 $.fx.step.clip = function( fx ) { |
1566 if ( !fx.clipInit ) { |
1615 if ( !fx.clipInit ) { |
1567 fx.start = $( fx.elem ).cssClip(); |
1616 fx.start = $( fx.elem ).cssClip(); |