[ Index ] |
PHP Cross Reference of WordPress |
[Summary view] [Print] [Text view]
1 /*! 2 * jQuery UI Effects 1.13.1 3 * http://jqueryui.com 4 * 5 * Copyright jQuery Foundation and other contributors 6 * Released under the MIT license. 7 * http://jquery.org/license 8 */ 9 10 //>>label: Effects Core 11 //>>group: Effects 12 /* eslint-disable max-len */ 13 //>>description: Extends the internal jQuery effects. Includes morphing and easing. Required by all other effects. 14 /* eslint-enable max-len */ 15 //>>docs: http://api.jqueryui.com/category/effects-core/ 16 //>>demos: http://jqueryui.com/effect/ 17 18 ( function( factory ) { 19 "use strict"; 20 21 if ( typeof define === "function" && define.amd ) { 22 23 // AMD. Register as an anonymous module. 24 define( [ "jquery" ], factory ); 25 } else { 26 27 // Browser globals 28 factory( jQuery ); 29 } 30 } )( function( $ ) { 31 "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 755 var dataSpace = "ui-effects-", 756 dataSpaceStyle = "ui-effects-style", 757 dataSpaceAnimated = "ui-effects-animated"; 758 759 $.effects = { 760 effect: {} 761 }; 762 763 /******************************************************************************/ 764 /****************************** CLASS ANIMATIONS ******************************/ 765 /******************************************************************************/ 766 ( function() { 767 768 var classAnimationActions = [ "add", "remove", "toggle" ], 769 shorthandStyles = { 770 border: 1, 771 borderBottom: 1, 772 borderColor: 1, 773 borderLeft: 1, 774 borderRight: 1, 775 borderTop: 1, 776 borderWidth: 1, 777 margin: 1, 778 padding: 1 779 }; 780 781 $.each( 782 [ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], 783 function( _, prop ) { 784 $.fx.step[ prop ] = function( fx ) { 785 if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) { 786 jQuery.style( fx.elem, prop, fx.end ); 787 fx.setAttr = true; 788 } 789 }; 790 } 791 ); 792 793 function camelCase( string ) { 794 return string.replace( /-([\da-z])/gi, function( all, letter ) { 795 return letter.toUpperCase(); 796 } ); 797 } 798 799 function getElementStyles( elem ) { 800 var key, len, 801 style = elem.ownerDocument.defaultView ? 802 elem.ownerDocument.defaultView.getComputedStyle( elem, null ) : 803 elem.currentStyle, 804 styles = {}; 805 806 if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) { 807 len = style.length; 808 while ( len-- ) { 809 key = style[ len ]; 810 if ( typeof style[ key ] === "string" ) { 811 styles[ camelCase( key ) ] = style[ key ]; 812 } 813 } 814 815 // Support: Opera, IE <9 816 } else { 817 for ( key in style ) { 818 if ( typeof style[ key ] === "string" ) { 819 styles[ key ] = style[ key ]; 820 } 821 } 822 } 823 824 return styles; 825 } 826 827 function styleDifference( oldStyle, newStyle ) { 828 var diff = {}, 829 name, value; 830 831 for ( name in newStyle ) { 832 value = newStyle[ name ]; 833 if ( oldStyle[ name ] !== value ) { 834 if ( !shorthandStyles[ name ] ) { 835 if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) { 836 diff[ name ] = value; 837 } 838 } 839 } 840 } 841 842 return diff; 843 } 844 845 // Support: jQuery <1.8 846 if ( !$.fn.addBack ) { 847 $.fn.addBack = function( selector ) { 848 return this.add( selector == null ? 849 this.prevObject : this.prevObject.filter( selector ) 850 ); 851 }; 852 } 853 854 $.effects.animateClass = function( value, duration, easing, callback ) { 855 var o = $.speed( duration, easing, callback ); 856 857 return this.queue( function() { 858 var animated = $( this ), 859 baseClass = animated.attr( "class" ) || "", 860 applyClassChange, 861 allAnimations = o.children ? animated.find( "*" ).addBack() : animated; 862 863 // Map the animated objects to store the original styles. 864 allAnimations = allAnimations.map( function() { 865 var el = $( this ); 866 return { 867 el: el, 868 start: getElementStyles( this ) 869 }; 870 } ); 871 872 // Apply class change 873 applyClassChange = function() { 874 $.each( classAnimationActions, function( i, action ) { 875 if ( value[ action ] ) { 876 animated[ action + "Class" ]( value[ action ] ); 877 } 878 } ); 879 }; 880 applyClassChange(); 881 882 // Map all animated objects again - calculate new styles and diff 883 allAnimations = allAnimations.map( function() { 884 this.end = getElementStyles( this.el[ 0 ] ); 885 this.diff = styleDifference( this.start, this.end ); 886 return this; 887 } ); 888 889 // Apply original class 890 animated.attr( "class", baseClass ); 891 892 // Map all animated objects again - this time collecting a promise 893 allAnimations = allAnimations.map( function() { 894 var styleInfo = this, 895 dfd = $.Deferred(), 896 opts = $.extend( {}, o, { 897 queue: false, 898 complete: function() { 899 dfd.resolve( styleInfo ); 900 } 901 } ); 902 903 this.el.animate( this.diff, opts ); 904 return dfd.promise(); 905 } ); 906 907 // Once all animations have completed: 908 $.when.apply( $, allAnimations.get() ).done( function() { 909 910 // Set the final class 911 applyClassChange(); 912 913 // For each animated element, 914 // clear all css properties that were animated 915 $.each( arguments, function() { 916 var el = this.el; 917 $.each( this.diff, function( key ) { 918 el.css( key, "" ); 919 } ); 920 } ); 921 922 // This is guarnteed to be there if you use jQuery.speed() 923 // it also handles dequeuing the next anim... 924 o.complete.call( animated[ 0 ] ); 925 } ); 926 } ); 927 }; 928 929 $.fn.extend( { 930 addClass: ( function( orig ) { 931 return function( classNames, speed, easing, callback ) { 932 return speed ? 933 $.effects.animateClass.call( this, 934 { add: classNames }, speed, easing, callback ) : 935 orig.apply( this, arguments ); 936 }; 937 } )( $.fn.addClass ), 938 939 removeClass: ( function( orig ) { 940 return function( classNames, speed, easing, callback ) { 941 return arguments.length > 1 ? 942 $.effects.animateClass.call( this, 943 { remove: classNames }, speed, easing, callback ) : 944 orig.apply( this, arguments ); 945 }; 946 } )( $.fn.removeClass ), 947 948 toggleClass: ( function( orig ) { 949 return function( classNames, force, speed, easing, callback ) { 950 if ( typeof force === "boolean" || force === undefined ) { 951 if ( !speed ) { 952 953 // Without speed parameter 954 return orig.apply( this, arguments ); 955 } else { 956 return $.effects.animateClass.call( this, 957 ( force ? { add: classNames } : { remove: classNames } ), 958 speed, easing, callback ); 959 } 960 } else { 961 962 // Without force parameter 963 return $.effects.animateClass.call( this, 964 { toggle: classNames }, force, speed, easing ); 965 } 966 }; 967 } )( $.fn.toggleClass ), 968 969 switchClass: function( remove, add, speed, easing, callback ) { 970 return $.effects.animateClass.call( this, { 971 add: add, 972 remove: remove 973 }, speed, easing, callback ); 974 } 975 } ); 976 977 } )(); 978 979 /******************************************************************************/ 980 /*********************************** EFFECTS **********************************/ 981 /******************************************************************************/ 982 983 ( function() { 984 985 if ( $.expr && $.expr.pseudos && $.expr.pseudos.animated ) { 986 $.expr.pseudos.animated = ( function( orig ) { 987 return function( elem ) { 988 return !!$( elem ).data( dataSpaceAnimated ) || orig( elem ); 989 }; 990 } )( $.expr.pseudos.animated ); 991 } 992 993 if ( $.uiBackCompat !== false ) { 994 $.extend( $.effects, { 995 996 // Saves a set of properties in a data storage 997 save: function( element, set ) { 998 var i = 0, length = set.length; 999 for ( ; i < length; i++ ) { 1000 if ( set[ i ] !== null ) { 1001 element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] ); 1002 } 1003 } 1004 }, 1005 1006 // Restores a set of previously saved properties from a data storage 1007 restore: function( element, set ) { 1008 var val, i = 0, length = set.length; 1009 for ( ; i < length; i++ ) { 1010 if ( set[ i ] !== null ) { 1011 val = element.data( dataSpace + set[ i ] ); 1012 element.css( set[ i ], val ); 1013 } 1014 } 1015 }, 1016 1017 setMode: function( el, mode ) { 1018 if ( mode === "toggle" ) { 1019 mode = el.is( ":hidden" ) ? "show" : "hide"; 1020 } 1021 return mode; 1022 }, 1023 1024 // Wraps the element around a wrapper that copies position properties 1025 createWrapper: function( element ) { 1026 1027 // If the element is already wrapped, return it 1028 if ( element.parent().is( ".ui-effects-wrapper" ) ) { 1029 return element.parent(); 1030 } 1031 1032 // Wrap the element 1033 var props = { 1034 width: element.outerWidth( true ), 1035 height: element.outerHeight( true ), 1036 "float": element.css( "float" ) 1037 }, 1038 wrapper = $( "<div></div>" ) 1039 .addClass( "ui-effects-wrapper" ) 1040 .css( { 1041 fontSize: "100%", 1042 background: "transparent", 1043 border: "none", 1044 margin: 0, 1045 padding: 0 1046 } ), 1047 1048 // Store the size in case width/height are defined in % - Fixes #5245 1049 size = { 1050 width: element.width(), 1051 height: element.height() 1052 }, 1053 active = document.activeElement; 1054 1055 // Support: Firefox 1056 // Firefox incorrectly exposes anonymous content 1057 // https://bugzilla.mozilla.org/show_bug.cgi?id=561664 1058 try { 1059 // eslint-disable-next-line no-unused-expressions 1060 active.id; 1061 } catch ( e ) { 1062 active = document.body; 1063 } 1064 1065 element.wrap( wrapper ); 1066 1067 // Fixes #7595 - Elements lose focus when wrapped. 1068 if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { 1069 $( active ).trigger( "focus" ); 1070 } 1071 1072 // Hotfix for jQuery 1.4 since some change in wrap() seems to actually 1073 // lose the reference to the wrapped element 1074 wrapper = element.parent(); 1075 1076 // Transfer positioning properties to the wrapper 1077 if ( element.css( "position" ) === "static" ) { 1078 wrapper.css( { position: "relative" } ); 1079 element.css( { position: "relative" } ); 1080 } else { 1081 $.extend( props, { 1082 position: element.css( "position" ), 1083 zIndex: element.css( "z-index" ) 1084 } ); 1085 $.each( [ "top", "left", "bottom", "right" ], function( i, pos ) { 1086 props[ pos ] = element.css( pos ); 1087 if ( isNaN( parseInt( props[ pos ], 10 ) ) ) { 1088 props[ pos ] = "auto"; 1089 } 1090 } ); 1091 element.css( { 1092 position: "relative", 1093 top: 0, 1094 left: 0, 1095 right: "auto", 1096 bottom: "auto" 1097 } ); 1098 } 1099 element.css( size ); 1100 1101 return wrapper.css( props ).show(); 1102 }, 1103 1104 removeWrapper: function( element ) { 1105 var active = document.activeElement; 1106 1107 if ( element.parent().is( ".ui-effects-wrapper" ) ) { 1108 element.parent().replaceWith( element ); 1109 1110 // Fixes #7595 - Elements lose focus when wrapped. 1111 if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { 1112 $( active ).trigger( "focus" ); 1113 } 1114 } 1115 1116 return element; 1117 } 1118 } ); 1119 } 1120 1121 $.extend( $.effects, { 1122 version: "1.13.1", 1123 1124 define: function( name, mode, effect ) { 1125 if ( !effect ) { 1126 effect = mode; 1127 mode = "effect"; 1128 } 1129 1130 $.effects.effect[ name ] = effect; 1131 $.effects.effect[ name ].mode = mode; 1132 1133 return effect; 1134 }, 1135 1136 scaledDimensions: function( element, percent, direction ) { 1137 if ( percent === 0 ) { 1138 return { 1139 height: 0, 1140 width: 0, 1141 outerHeight: 0, 1142 outerWidth: 0 1143 }; 1144 } 1145 1146 var x = direction !== "horizontal" ? ( ( percent || 100 ) / 100 ) : 1, 1147 y = direction !== "vertical" ? ( ( percent || 100 ) / 100 ) : 1; 1148 1149 return { 1150 height: element.height() * y, 1151 width: element.width() * x, 1152 outerHeight: element.outerHeight() * y, 1153 outerWidth: element.outerWidth() * x 1154 }; 1155 1156 }, 1157 1158 clipToBox: function( animation ) { 1159 return { 1160 width: animation.clip.right - animation.clip.left, 1161 height: animation.clip.bottom - animation.clip.top, 1162 left: animation.clip.left, 1163 top: animation.clip.top 1164 }; 1165 }, 1166 1167 // Injects recently queued functions to be first in line (after "inprogress") 1168 unshift: function( element, queueLength, count ) { 1169 var queue = element.queue(); 1170 1171 if ( queueLength > 1 ) { 1172 queue.splice.apply( queue, 1173 [ 1, 0 ].concat( queue.splice( queueLength, count ) ) ); 1174 } 1175 element.dequeue(); 1176 }, 1177 1178 saveStyle: function( element ) { 1179 element.data( dataSpaceStyle, element[ 0 ].style.cssText ); 1180 }, 1181 1182 restoreStyle: function( element ) { 1183 element[ 0 ].style.cssText = element.data( dataSpaceStyle ) || ""; 1184 element.removeData( dataSpaceStyle ); 1185 }, 1186 1187 mode: function( element, mode ) { 1188 var hidden = element.is( ":hidden" ); 1189 1190 if ( mode === "toggle" ) { 1191 mode = hidden ? "show" : "hide"; 1192 } 1193 if ( hidden ? mode === "hide" : mode === "show" ) { 1194 mode = "none"; 1195 } 1196 return mode; 1197 }, 1198 1199 // Translates a [top,left] array into a baseline value 1200 getBaseline: function( origin, original ) { 1201 var y, x; 1202 1203 switch ( origin[ 0 ] ) { 1204 case "top": 1205 y = 0; 1206 break; 1207 case "middle": 1208 y = 0.5; 1209 break; 1210 case "bottom": 1211 y = 1; 1212 break; 1213 default: 1214 y = origin[ 0 ] / original.height; 1215 } 1216 1217 switch ( origin[ 1 ] ) { 1218 case "left": 1219 x = 0; 1220 break; 1221 case "center": 1222 x = 0.5; 1223 break; 1224 case "right": 1225 x = 1; 1226 break; 1227 default: 1228 x = origin[ 1 ] / original.width; 1229 } 1230 1231 return { 1232 x: x, 1233 y: y 1234 }; 1235 }, 1236 1237 // Creates a placeholder element so that the original element can be made absolute 1238 createPlaceholder: function( element ) { 1239 var placeholder, 1240 cssPosition = element.css( "position" ), 1241 position = element.position(); 1242 1243 // Lock in margins first to account for form elements, which 1244 // will change margin if you explicitly set height 1245 // see: http://jsfiddle.net/JZSMt/3/ https://bugs.webkit.org/show_bug.cgi?id=107380 1246 // Support: Safari 1247 element.css( { 1248 marginTop: element.css( "marginTop" ), 1249 marginBottom: element.css( "marginBottom" ), 1250 marginLeft: element.css( "marginLeft" ), 1251 marginRight: element.css( "marginRight" ) 1252 } ) 1253 .outerWidth( element.outerWidth() ) 1254 .outerHeight( element.outerHeight() ); 1255 1256 if ( /^(static|relative)/.test( cssPosition ) ) { 1257 cssPosition = "absolute"; 1258 1259 placeholder = $( "<" + element[ 0 ].nodeName + ">" ).insertAfter( element ).css( { 1260 1261 // Convert inline to inline block to account for inline elements 1262 // that turn to inline block based on content (like img) 1263 display: /^(inline|ruby)/.test( element.css( "display" ) ) ? 1264 "inline-block" : 1265 "block", 1266 visibility: "hidden", 1267 1268 // Margins need to be set to account for margin collapse 1269 marginTop: element.css( "marginTop" ), 1270 marginBottom: element.css( "marginBottom" ), 1271 marginLeft: element.css( "marginLeft" ), 1272 marginRight: element.css( "marginRight" ), 1273 "float": element.css( "float" ) 1274 } ) 1275 .outerWidth( element.outerWidth() ) 1276 .outerHeight( element.outerHeight() ) 1277 .addClass( "ui-effects-placeholder" ); 1278 1279 element.data( dataSpace + "placeholder", placeholder ); 1280 } 1281 1282 element.css( { 1283 position: cssPosition, 1284 left: position.left, 1285 top: position.top 1286 } ); 1287 1288 return placeholder; 1289 }, 1290 1291 removePlaceholder: function( element ) { 1292 var dataKey = dataSpace + "placeholder", 1293 placeholder = element.data( dataKey ); 1294 1295 if ( placeholder ) { 1296 placeholder.remove(); 1297 element.removeData( dataKey ); 1298 } 1299 }, 1300 1301 // Removes a placeholder if it exists and restores 1302 // properties that were modified during placeholder creation 1303 cleanUp: function( element ) { 1304 $.effects.restoreStyle( element ); 1305 $.effects.removePlaceholder( element ); 1306 }, 1307 1308 setTransition: function( element, list, factor, value ) { 1309 value = value || {}; 1310 $.each( list, function( i, x ) { 1311 var unit = element.cssUnit( x ); 1312 if ( unit[ 0 ] > 0 ) { 1313 value[ x ] = unit[ 0 ] * factor + unit[ 1 ]; 1314 } 1315 } ); 1316 return value; 1317 } 1318 } ); 1319 1320 // Return an effect options object for the given parameters: 1321 function _normalizeArguments( effect, options, speed, callback ) { 1322 1323 // Allow passing all options as the first parameter 1324 if ( $.isPlainObject( effect ) ) { 1325 options = effect; 1326 effect = effect.effect; 1327 } 1328 1329 // Convert to an object 1330 effect = { effect: effect }; 1331 1332 // Catch (effect, null, ...) 1333 if ( options == null ) { 1334 options = {}; 1335 } 1336 1337 // Catch (effect, callback) 1338 if ( typeof options === "function" ) { 1339 callback = options; 1340 speed = null; 1341 options = {}; 1342 } 1343 1344 // Catch (effect, speed, ?) 1345 if ( typeof options === "number" || $.fx.speeds[ options ] ) { 1346 callback = speed; 1347 speed = options; 1348 options = {}; 1349 } 1350 1351 // Catch (effect, options, callback) 1352 if ( typeof speed === "function" ) { 1353 callback = speed; 1354 speed = null; 1355 } 1356 1357 // Add options to effect 1358 if ( options ) { 1359 $.extend( effect, options ); 1360 } 1361 1362 speed = speed || options.duration; 1363 effect.duration = $.fx.off ? 0 : 1364 typeof speed === "number" ? speed : 1365 speed in $.fx.speeds ? $.fx.speeds[ speed ] : 1366 $.fx.speeds._default; 1367 1368 effect.complete = callback || options.complete; 1369 1370 return effect; 1371 } 1372 1373 function standardAnimationOption( option ) { 1374 1375 // Valid standard speeds (nothing, number, named speed) 1376 if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) { 1377 return true; 1378 } 1379 1380 // Invalid strings - treat as "normal" speed 1381 if ( typeof option === "string" && !$.effects.effect[ option ] ) { 1382 return true; 1383 } 1384 1385 // Complete callback 1386 if ( typeof option === "function" ) { 1387 return true; 1388 } 1389 1390 // Options hash (but not naming an effect) 1391 if ( typeof option === "object" && !option.effect ) { 1392 return true; 1393 } 1394 1395 // Didn't match any standard API 1396 return false; 1397 } 1398 1399 $.fn.extend( { 1400 effect: function( /* effect, options, speed, callback */ ) { 1401 var args = _normalizeArguments.apply( this, arguments ), 1402 effectMethod = $.effects.effect[ args.effect ], 1403 defaultMode = effectMethod.mode, 1404 queue = args.queue, 1405 queueName = queue || "fx", 1406 complete = args.complete, 1407 mode = args.mode, 1408 modes = [], 1409 prefilter = function( next ) { 1410 var el = $( this ), 1411 normalizedMode = $.effects.mode( el, mode ) || defaultMode; 1412 1413 // Sentinel for duck-punching the :animated pseudo-selector 1414 el.data( dataSpaceAnimated, true ); 1415 1416 // Save effect mode for later use, 1417 // we can't just call $.effects.mode again later, 1418 // as the .show() below destroys the initial state 1419 modes.push( normalizedMode ); 1420 1421 // See $.uiBackCompat inside of run() for removal of defaultMode in 1.14 1422 if ( defaultMode && ( normalizedMode === "show" || 1423 ( normalizedMode === defaultMode && normalizedMode === "hide" ) ) ) { 1424 el.show(); 1425 } 1426 1427 if ( !defaultMode || normalizedMode !== "none" ) { 1428 $.effects.saveStyle( el ); 1429 } 1430 1431 if ( typeof next === "function" ) { 1432 next(); 1433 } 1434 }; 1435 1436 if ( $.fx.off || !effectMethod ) { 1437 1438 // Delegate to the original method (e.g., .show()) if possible 1439 if ( mode ) { 1440 return this[ mode ]( args.duration, complete ); 1441 } else { 1442 return this.each( function() { 1443 if ( complete ) { 1444 complete.call( this ); 1445 } 1446 } ); 1447 } 1448 } 1449 1450 function run( next ) { 1451 var elem = $( this ); 1452 1453 function cleanup() { 1454 elem.removeData( dataSpaceAnimated ); 1455 1456 $.effects.cleanUp( elem ); 1457 1458 if ( args.mode === "hide" ) { 1459 elem.hide(); 1460 } 1461 1462 done(); 1463 } 1464 1465 function done() { 1466 if ( typeof complete === "function" ) { 1467 complete.call( elem[ 0 ] ); 1468 } 1469 1470 if ( typeof next === "function" ) { 1471 next(); 1472 } 1473 } 1474 1475 // Override mode option on a per element basis, 1476 // as toggle can be either show or hide depending on element state 1477 args.mode = modes.shift(); 1478 1479 if ( $.uiBackCompat !== false && !defaultMode ) { 1480 if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) { 1481 1482 // Call the core method to track "olddisplay" properly 1483 elem[ mode ](); 1484 done(); 1485 } else { 1486 effectMethod.call( elem[ 0 ], args, done ); 1487 } 1488 } else { 1489 if ( args.mode === "none" ) { 1490 1491 // Call the core method to track "olddisplay" properly 1492 elem[ mode ](); 1493 done(); 1494 } else { 1495 effectMethod.call( elem[ 0 ], args, cleanup ); 1496 } 1497 } 1498 } 1499 1500 // Run prefilter on all elements first to ensure that 1501 // any showing or hiding happens before placeholder creation, 1502 // which ensures that any layout changes are correctly captured. 1503 return queue === false ? 1504 this.each( prefilter ).each( run ) : 1505 this.queue( queueName, prefilter ).queue( queueName, run ); 1506 }, 1507 1508 show: ( function( orig ) { 1509 return function( option ) { 1510 if ( standardAnimationOption( option ) ) { 1511 return orig.apply( this, arguments ); 1512 } else { 1513 var args = _normalizeArguments.apply( this, arguments ); 1514 args.mode = "show"; 1515 return this.effect.call( this, args ); 1516 } 1517 }; 1518 } )( $.fn.show ), 1519 1520 hide: ( function( orig ) { 1521 return function( option ) { 1522 if ( standardAnimationOption( option ) ) { 1523 return orig.apply( this, arguments ); 1524 } else { 1525 var args = _normalizeArguments.apply( this, arguments ); 1526 args.mode = "hide"; 1527 return this.effect.call( this, args ); 1528 } 1529 }; 1530 } )( $.fn.hide ), 1531 1532 toggle: ( function( orig ) { 1533 return function( option ) { 1534 if ( standardAnimationOption( option ) || typeof option === "boolean" ) { 1535 return orig.apply( this, arguments ); 1536 } else { 1537 var args = _normalizeArguments.apply( this, arguments ); 1538 args.mode = "toggle"; 1539 return this.effect.call( this, args ); 1540 } 1541 }; 1542 } )( $.fn.toggle ), 1543 1544 cssUnit: function( key ) { 1545 var style = this.css( key ), 1546 val = []; 1547 1548 $.each( [ "em", "px", "%", "pt" ], function( i, unit ) { 1549 if ( style.indexOf( unit ) > 0 ) { 1550 val = [ parseFloat( style ), unit ]; 1551 } 1552 } ); 1553 return val; 1554 }, 1555 1556 cssClip: function( clipObj ) { 1557 if ( clipObj ) { 1558 return this.css( "clip", "rect(" + clipObj.top + "px " + clipObj.right + "px " + 1559 clipObj.bottom + "px " + clipObj.left + "px)" ); 1560 } 1561 return parseClip( this.css( "clip" ), this ); 1562 }, 1563 1564 transfer: function( options, done ) { 1565 var element = $( this ), 1566 target = $( options.to ), 1567 targetFixed = target.css( "position" ) === "fixed", 1568 body = $( "body" ), 1569 fixTop = targetFixed ? body.scrollTop() : 0, 1570 fixLeft = targetFixed ? body.scrollLeft() : 0, 1571 endPosition = target.offset(), 1572 animation = { 1573 top: endPosition.top - fixTop, 1574 left: endPosition.left - fixLeft, 1575 height: target.innerHeight(), 1576 width: target.innerWidth() 1577 }, 1578 startPosition = element.offset(), 1579 transfer = $( "<div class='ui-effects-transfer'></div>" ); 1580 1581 transfer 1582 .appendTo( "body" ) 1583 .addClass( options.className ) 1584 .css( { 1585 top: startPosition.top - fixTop, 1586 left: startPosition.left - fixLeft, 1587 height: element.innerHeight(), 1588 width: element.innerWidth(), 1589 position: targetFixed ? "fixed" : "absolute" 1590 } ) 1591 .animate( animation, options.duration, options.easing, function() { 1592 transfer.remove(); 1593 if ( typeof done === "function" ) { 1594 done(); 1595 } 1596 } ); 1597 } 1598 } ); 1599 1600 function parseClip( str, element ) { 1601 var outerWidth = element.outerWidth(), 1602 outerHeight = element.outerHeight(), 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)\)$/, 1604 values = clipRegex.exec( str ) || [ "", 0, outerWidth, outerHeight, 0 ]; 1605 1606 return { 1607 top: parseFloat( values[ 1 ] ) || 0, 1608 right: values[ 2 ] === "auto" ? outerWidth : parseFloat( values[ 2 ] ), 1609 bottom: values[ 3 ] === "auto" ? outerHeight : parseFloat( values[ 3 ] ), 1610 left: parseFloat( values[ 4 ] ) || 0 1611 }; 1612 } 1613 1614 $.fx.step.clip = function( fx ) { 1615 if ( !fx.clipInit ) { 1616 fx.start = $( fx.elem ).cssClip(); 1617 if ( typeof fx.end === "string" ) { 1618 fx.end = parseClip( fx.end, fx.elem ); 1619 } 1620 fx.clipInit = true; 1621 } 1622 1623 $( fx.elem ).cssClip( { 1624 top: fx.pos * ( fx.end.top - fx.start.top ) + fx.start.top, 1625 right: fx.pos * ( fx.end.right - fx.start.right ) + fx.start.right, 1626 bottom: fx.pos * ( fx.end.bottom - fx.start.bottom ) + fx.start.bottom, 1627 left: fx.pos * ( fx.end.left - fx.start.left ) + fx.start.left 1628 } ); 1629 }; 1630 1631 } )(); 1632 1633 /******************************************************************************/ 1634 /*********************************** EASING ***********************************/ 1635 /******************************************************************************/ 1636 1637 ( function() { 1638 1639 // Based on easing equations from Robert Penner (http://www.robertpenner.com/easing) 1640 1641 var baseEasings = {}; 1642 1643 $.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) { 1644 baseEasings[ name ] = function( p ) { 1645 return Math.pow( p, i + 2 ); 1646 }; 1647 } ); 1648 1649 $.extend( baseEasings, { 1650 Sine: function( p ) { 1651 return 1 - Math.cos( p * Math.PI / 2 ); 1652 }, 1653 Circ: function( p ) { 1654 return 1 - Math.sqrt( 1 - p * p ); 1655 }, 1656 Elastic: function( p ) { 1657 return p === 0 || p === 1 ? p : 1658 -Math.pow( 2, 8 * ( p - 1 ) ) * Math.sin( ( ( p - 1 ) * 80 - 7.5 ) * Math.PI / 15 ); 1659 }, 1660 Back: function( p ) { 1661 return p * p * ( 3 * p - 2 ); 1662 }, 1663 Bounce: function( p ) { 1664 var pow2, 1665 bounce = 4; 1666 1667 while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {} 1668 return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 ); 1669 } 1670 } ); 1671 1672 $.each( baseEasings, function( name, easeIn ) { 1673 $.easing[ "easeIn" + name ] = easeIn; 1674 $.easing[ "easeOut" + name ] = function( p ) { 1675 return 1 - easeIn( 1 - p ); 1676 }; 1677 $.easing[ "easeInOut" + name ] = function( p ) { 1678 return p < 0.5 ? 1679 easeIn( p * 2 ) / 2 : 1680 1 - easeIn( p * -2 + 2 ) / 2; 1681 }; 1682 } ); 1683 1684 } )(); 1685 1686 return $.effects; 1687 1688 } );
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 24 01:00:02 2024 | Cross-referenced by PHPXref 0.7.1 |