[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 /*! 2 * jQuery UI Effects 1.13.2 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 57 58 var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor " + 59 "borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor", 60 61 class2type = {}, 62 toString = class2type.toString, 63 64 // plusequals test for += 100 -= 100 65 rplusequals = /^([\-+])=\s*(\d+\.?\d*)/, 66 67 // a set of RE's that can match strings and generate color tuples. 68 stringParsers = [ { 69 re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 70 parse: function( execResult ) { 71 return [ 72 execResult[ 1 ], 73 execResult[ 2 ], 74 execResult[ 3 ], 75 execResult[ 4 ] 76 ]; 77 } 78 }, { 79 re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 80 parse: function( execResult ) { 81 return [ 82 execResult[ 1 ] * 2.55, 83 execResult[ 2 ] * 2.55, 84 execResult[ 3 ] * 2.55, 85 execResult[ 4 ] 86 ]; 87 } 88 }, { 89 90 // this regex ignores A-F because it's compared against an already lowercased string 91 re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})?/, 92 parse: function( execResult ) { 93 return [ 94 parseInt( execResult[ 1 ], 16 ), 95 parseInt( execResult[ 2 ], 16 ), 96 parseInt( execResult[ 3 ], 16 ), 97 execResult[ 4 ] ? 98 ( parseInt( execResult[ 4 ], 16 ) / 255 ).toFixed( 2 ) : 99 1 100 ]; 101 } 102 }, { 103 104 // this regex ignores A-F because it's compared against an already lowercased string 105 re: /#([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])?/, 106 parse: function( execResult ) { 107 return [ 108 parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ), 109 parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ), 110 parseInt( execResult[ 3 ] + execResult[ 3 ], 16 ), 111 execResult[ 4 ] ? 112 ( parseInt( execResult[ 4 ] + execResult[ 4 ], 16 ) / 255 ) 113 .toFixed( 2 ) : 114 1 115 ]; 116 } 117 }, { 118 re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 119 space: "hsla", 120 parse: function( execResult ) { 121 return [ 122 execResult[ 1 ], 123 execResult[ 2 ] / 100, 124 execResult[ 3 ] / 100, 125 execResult[ 4 ] 126 ]; 127 } 128 } ], 129 130 // jQuery.Color( ) 131 color = jQuery.Color = function( color, green, blue, alpha ) { 132 return new jQuery.Color.fn.parse( color, green, blue, alpha ); 133 }, 134 spaces = { 135 rgba: { 136 props: { 137 red: { 138 idx: 0, 139 type: "byte" 140 }, 141 green: { 142 idx: 1, 143 type: "byte" 144 }, 145 blue: { 146 idx: 2, 147 type: "byte" 148 } 149 } 150 }, 151 152 hsla: { 153 props: { 154 hue: { 155 idx: 0, 156 type: "degrees" 157 }, 158 saturation: { 159 idx: 1, 160 type: "percent" 161 }, 162 lightness: { 163 idx: 2, 164 type: "percent" 165 } 166 } 167 } 168 }, 169 propTypes = { 170 "byte": { 171 floor: true, 172 max: 255 173 }, 174 "percent": { 175 max: 1 176 }, 177 "degrees": { 178 mod: 360, 179 floor: true 180 } 181 }, 182 support = color.support = {}, 183 184 // element for support tests 185 supportElem = jQuery( "<p>" )[ 0 ], 186 187 // colors = jQuery.Color.names 188 colors, 189 190 // local aliases of functions called often 191 each = jQuery.each; 192 193 // determine rgba support immediately 194 supportElem.style.cssText = "background-color:rgba(1,1,1,.5)"; 195 support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1; 196 197 // define cache name and alpha properties 198 // for rgba and hsla spaces 199 each( spaces, function( spaceName, space ) { 200 space.cache = "_" + spaceName; 201 space.props.alpha = { 202 idx: 3, 203 type: "percent", 204 def: 1 205 }; 206 } ); 207 208 // Populate the class2type map 209 jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), 210 function( _i, name ) { 211 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 212 } ); 213 214 function getType( obj ) { 215 if ( obj == null ) { 216 return obj + ""; 217 } 218 219 return typeof obj === "object" ? 220 class2type[ toString.call( obj ) ] || "object" : 221 typeof obj; 222 } 223 224 function clamp( value, prop, allowEmpty ) { 225 var type = propTypes[ prop.type ] || {}; 226 227 if ( value == null ) { 228 return ( allowEmpty || !prop.def ) ? null : prop.def; 229 } 230 231 // ~~ is an short way of doing floor for positive numbers 232 value = type.floor ? ~~value : parseFloat( value ); 233 234 // IE will pass in empty strings as value for alpha, 235 // which will hit this case 236 if ( isNaN( value ) ) { 237 return prop.def; 238 } 239 240 if ( type.mod ) { 241 242 // we add mod before modding to make sure that negatives values 243 // get converted properly: -10 -> 350 244 return ( value + type.mod ) % type.mod; 245 } 246 247 // for now all property types without mod have min and max 248 return Math.min( type.max, Math.max( 0, value ) ); 249 } 250 251 function stringParse( string ) { 252 var inst = color(), 253 rgba = inst._rgba = []; 254 255 string = string.toLowerCase(); 256 257 each( stringParsers, function( _i, parser ) { 258 var parsed, 259 match = parser.re.exec( string ), 260 values = match && parser.parse( match ), 261 spaceName = parser.space || "rgba"; 262 263 if ( values ) { 264 parsed = inst[ spaceName ]( values ); 265 266 // if this was an rgba parse the assignment might happen twice 267 // oh well.... 268 inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ]; 269 rgba = inst._rgba = parsed._rgba; 270 271 // exit each( stringParsers ) here because we matched 272 return false; 273 } 274 } ); 275 276 // Found a stringParser that handled it 277 if ( rgba.length ) { 278 279 // if this came from a parsed string, force "transparent" when alpha is 0 280 // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0) 281 if ( rgba.join() === "0,0,0,0" ) { 282 jQuery.extend( rgba, colors.transparent ); 283 } 284 return inst; 285 } 286 287 // named colors 288 return colors[ string ]; 289 } 290 291 color.fn = jQuery.extend( color.prototype, { 292 parse: function( red, green, blue, alpha ) { 293 if ( red === undefined ) { 294 this._rgba = [ null, null, null, null ]; 295 return this; 296 } 297 if ( red.jquery || red.nodeType ) { 298 red = jQuery( red ).css( green ); 299 green = undefined; 300 } 301 302 var inst = this, 303 type = getType( red ), 304 rgba = this._rgba = []; 305 306 // more than 1 argument specified - assume ( red, green, blue, alpha ) 307 if ( green !== undefined ) { 308 red = [ red, green, blue, alpha ]; 309 type = "array"; 310 } 311 312 if ( type === "string" ) { 313 return this.parse( stringParse( red ) || colors._default ); 314 } 315 316 if ( type === "array" ) { 317 each( spaces.rgba.props, function( _key, prop ) { 318 rgba[ prop.idx ] = clamp( red[ prop.idx ], prop ); 319 } ); 320 return this; 321 } 322 323 if ( type === "object" ) { 324 if ( red instanceof color ) { 325 each( spaces, function( _spaceName, space ) { 326 if ( red[ space.cache ] ) { 327 inst[ space.cache ] = red[ space.cache ].slice(); 328 } 329 } ); 330 } else { 331 each( spaces, function( _spaceName, space ) { 332 var cache = space.cache; 333 each( space.props, function( key, prop ) { 334 335 // if the cache doesn't exist, and we know how to convert 336 if ( !inst[ cache ] && space.to ) { 337 338 // if the value was null, we don't need to copy it 339 // if the key was alpha, we don't need to copy it either 340 if ( key === "alpha" || red[ key ] == null ) { 341 return; 342 } 343 inst[ cache ] = space.to( inst._rgba ); 344 } 345 346 // this is the only case where we allow nulls for ALL properties. 347 // call clamp with alwaysAllowEmpty 348 inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true ); 349 } ); 350 351 // everything defined but alpha? 352 if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) { 353 354 // use the default of 1 355 if ( inst[ cache ][ 3 ] == null ) { 356 inst[ cache ][ 3 ] = 1; 357 } 358 359 if ( space.from ) { 360 inst._rgba = space.from( inst[ cache ] ); 361 } 362 } 363 } ); 364 } 365 return this; 366 } 367 }, 368 is: function( compare ) { 369 var is = color( compare ), 370 same = true, 371 inst = this; 372 373 each( spaces, function( _, space ) { 374 var localCache, 375 isCache = is[ space.cache ]; 376 if ( isCache ) { 377 localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || []; 378 each( space.props, function( _, prop ) { 379 if ( isCache[ prop.idx ] != null ) { 380 same = ( isCache[ prop.idx ] === localCache[ prop.idx ] ); 381 return same; 382 } 383 } ); 384 } 385 return same; 386 } ); 387 return same; 388 }, 389 _space: function() { 390 var used = [], 391 inst = this; 392 each( spaces, function( spaceName, space ) { 393 if ( inst[ space.cache ] ) { 394 used.push( spaceName ); 395 } 396 } ); 397 return used.pop(); 398 }, 399 transition: function( other, distance ) { 400 var end = color( other ), 401 spaceName = end._space(), 402 space = spaces[ spaceName ], 403 startColor = this.alpha() === 0 ? color( "transparent" ) : this, 404 start = startColor[ space.cache ] || space.to( startColor._rgba ), 405 result = start.slice(); 406 407 end = end[ space.cache ]; 408 each( space.props, function( _key, prop ) { 409 var index = prop.idx, 410 startValue = start[ index ], 411 endValue = end[ index ], 412 type = propTypes[ prop.type ] || {}; 413 414 // if null, don't override start value 415 if ( endValue === null ) { 416 return; 417 } 418 419 // if null - use end 420 if ( startValue === null ) { 421 result[ index ] = endValue; 422 } else { 423 if ( type.mod ) { 424 if ( endValue - startValue > type.mod / 2 ) { 425 startValue += type.mod; 426 } else if ( startValue - endValue > type.mod / 2 ) { 427 startValue -= type.mod; 428 } 429 } 430 result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop ); 431 } 432 } ); 433 return this[ spaceName ]( result ); 434 }, 435 blend: function( opaque ) { 436 437 // if we are already opaque - return ourself 438 if ( this._rgba[ 3 ] === 1 ) { 439 return this; 440 } 441 442 var rgb = this._rgba.slice(), 443 a = rgb.pop(), 444 blend = color( opaque )._rgba; 445 446 return color( jQuery.map( rgb, function( v, i ) { 447 return ( 1 - a ) * blend[ i ] + a * v; 448 } ) ); 449 }, 450 toRgbaString: function() { 451 var prefix = "rgba(", 452 rgba = jQuery.map( this._rgba, function( v, i ) { 453 if ( v != null ) { 454 return v; 455 } 456 return i > 2 ? 1 : 0; 457 } ); 458 459 if ( rgba[ 3 ] === 1 ) { 460 rgba.pop(); 461 prefix = "rgb("; 462 } 463 464 return prefix + rgba.join() + ")"; 465 }, 466 toHslaString: function() { 467 var prefix = "hsla(", 468 hsla = jQuery.map( this.hsla(), function( v, i ) { 469 if ( v == null ) { 470 v = i > 2 ? 1 : 0; 471 } 472 473 // catch 1 and 2 474 if ( i && i < 3 ) { 475 v = Math.round( v * 100 ) + "%"; 476 } 477 return v; 478 } ); 479 480 if ( hsla[ 3 ] === 1 ) { 481 hsla.pop(); 482 prefix = "hsl("; 483 } 484 return prefix + hsla.join() + ")"; 485 }, 486 toHexString: function( includeAlpha ) { 487 var rgba = this._rgba.slice(), 488 alpha = rgba.pop(); 489 490 if ( includeAlpha ) { 491 rgba.push( ~~( alpha * 255 ) ); 492 } 493 494 return "#" + jQuery.map( rgba, function( v ) { 495 496 // default to 0 when nulls exist 497 v = ( v || 0 ).toString( 16 ); 498 return v.length === 1 ? "0" + v : v; 499 } ).join( "" ); 500 }, 501 toString: function() { 502 return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString(); 503 } 504 } ); 505 color.fn.parse.prototype = color.fn; 506 507 // hsla conversions adapted from: 508 // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021 509 510 function hue2rgb( p, q, h ) { 511 h = ( h + 1 ) % 1; 512 if ( h * 6 < 1 ) { 513 return p + ( q - p ) * h * 6; 514 } 515 if ( h * 2 < 1 ) { 516 return q; 517 } 518 if ( h * 3 < 2 ) { 519 return p + ( q - p ) * ( ( 2 / 3 ) - h ) * 6; 520 } 521 return p; 522 } 523 524 spaces.hsla.to = function( rgba ) { 525 if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) { 526 return [ null, null, null, rgba[ 3 ] ]; 527 } 528 var r = rgba[ 0 ] / 255, 529 g = rgba[ 1 ] / 255, 530 b = rgba[ 2 ] / 255, 531 a = rgba[ 3 ], 532 max = Math.max( r, g, b ), 533 min = Math.min( r, g, b ), 534 diff = max - min, 535 add = max + min, 536 l = add * 0.5, 537 h, s; 538 539 if ( min === max ) { 540 h = 0; 541 } else if ( r === max ) { 542 h = ( 60 * ( g - b ) / diff ) + 360; 543 } else if ( g === max ) { 544 h = ( 60 * ( b - r ) / diff ) + 120; 545 } else { 546 h = ( 60 * ( r - g ) / diff ) + 240; 547 } 548 549 // chroma (diff) == 0 means greyscale which, by definition, saturation = 0% 550 // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add) 551 if ( diff === 0 ) { 552 s = 0; 553 } else if ( l <= 0.5 ) { 554 s = diff / add; 555 } else { 556 s = diff / ( 2 - add ); 557 } 558 return [ Math.round( h ) % 360, s, l, a == null ? 1 : a ]; 559 }; 560 561 spaces.hsla.from = function( hsla ) { 562 if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) { 563 return [ null, null, null, hsla[ 3 ] ]; 564 } 565 var h = hsla[ 0 ] / 360, 566 s = hsla[ 1 ], 567 l = hsla[ 2 ], 568 a = hsla[ 3 ], 569 q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s, 570 p = 2 * l - q; 571 572 return [ 573 Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ), 574 Math.round( hue2rgb( p, q, h ) * 255 ), 575 Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ), 576 a 577 ]; 578 }; 579 580 581 each( spaces, function( spaceName, space ) { 582 var props = space.props, 583 cache = space.cache, 584 to = space.to, 585 from = space.from; 586 587 // makes rgba() and hsla() 588 color.fn[ spaceName ] = function( value ) { 589 590 // generate a cache for this space if it doesn't exist 591 if ( to && !this[ cache ] ) { 592 this[ cache ] = to( this._rgba ); 593 } 594 if ( value === undefined ) { 595 return this[ cache ].slice(); 596 } 597 598 var ret, 599 type = getType( value ), 600 arr = ( type === "array" || type === "object" ) ? value : arguments, 601 local = this[ cache ].slice(); 602 603 each( props, function( key, prop ) { 604 var val = arr[ type === "object" ? key : prop.idx ]; 605 if ( val == null ) { 606 val = local[ prop.idx ]; 607 } 608 local[ prop.idx ] = clamp( val, prop ); 609 } ); 610 611 if ( from ) { 612 ret = color( from( local ) ); 613 ret[ cache ] = local; 614 return ret; 615 } else { 616 return color( local ); 617 } 618 }; 619 620 // makes red() green() blue() alpha() hue() saturation() lightness() 621 each( props, function( key, prop ) { 622 623 // alpha is included in more than one space 624 if ( color.fn[ key ] ) { 625 return; 626 } 627 color.fn[ key ] = function( value ) { 628 var local, cur, match, fn, 629 vtype = getType( value ); 630 631 if ( key === "alpha" ) { 632 fn = this._hsla ? "hsla" : "rgba"; 633 } else { 634 fn = spaceName; 635 } 636 local = this[ fn ](); 637 cur = local[ prop.idx ]; 638 639 if ( vtype === "undefined" ) { 640 return cur; 641 } 642 643 if ( vtype === "function" ) { 644 value = value.call( this, cur ); 645 vtype = getType( value ); 646 } 647 if ( value == null && prop.empty ) { 648 return this; 649 } 650 if ( vtype === "string" ) { 651 match = rplusequals.exec( value ); 652 if ( match ) { 653 value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 ); 654 } 655 } 656 local[ prop.idx ] = value; 657 return this[ fn ]( local ); 658 }; 659 } ); 660 } ); 661 662 // add cssHook and .fx.step function for each named hook. 663 // accept a space separated string of properties 664 color.hook = function( hook ) { 665 var hooks = hook.split( " " ); 666 each( hooks, function( _i, hook ) { 667 jQuery.cssHooks[ hook ] = { 668 set: function( elem, value ) { 669 var parsed, curElem, 670 backgroundColor = ""; 671 672 if ( value !== "transparent" && ( getType( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) { 673 value = color( parsed || value ); 674 if ( !support.rgba && value._rgba[ 3 ] !== 1 ) { 675 curElem = hook === "backgroundColor" ? elem.parentNode : elem; 676 while ( 677 ( backgroundColor === "" || backgroundColor === "transparent" ) && 678 curElem && curElem.style 679 ) { 680 try { 681 backgroundColor = jQuery.css( curElem, "backgroundColor" ); 682 curElem = curElem.parentNode; 683 } catch ( e ) { 684 } 685 } 686 687 value = value.blend( backgroundColor && backgroundColor !== "transparent" ? 688 backgroundColor : 689 "_default" ); 690 } 691 692 value = value.toRgbaString(); 693 } 694 try { 695 elem.style[ hook ] = value; 696 } catch ( e ) { 697 698 // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit' 699 } 700 } 701 }; 702 jQuery.fx.step[ hook ] = function( fx ) { 703 if ( !fx.colorInit ) { 704 fx.start = color( fx.elem, hook ); 705 fx.end = color( fx.end ); 706 fx.colorInit = true; 707 } 708 jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) ); 709 }; 710 } ); 711 712 }; 713 714 color.hook( stepHooks ); 715 716 jQuery.cssHooks.borderColor = { 717 expand: function( value ) { 718 var expanded = {}; 719 720 each( [ "Top", "Right", "Bottom", "Left" ], function( _i, part ) { 721 expanded[ "border" + part + "Color" ] = value; 722 } ); 723 return expanded; 724 } 725 }; 726 727 // Basic color names only. 728 // Usage of any of the other color names requires adding yourself or including 729 // jquery.color.svg-names.js. 730 colors = jQuery.Color.names = { 731 732 // 4.1. Basic color keywords 733 aqua: "#00ffff", 734 black: "#000000", 735 blue: "#0000ff", 736 fuchsia: "#ff00ff", 737 gray: "#808080", 738 green: "#008000", 739 lime: "#00ff00", 740 maroon: "#800000", 741 navy: "#000080", 742 olive: "#808000", 743 purple: "#800080", 744 red: "#ff0000", 745 silver: "#c0c0c0", 746 teal: "#008080", 747 white: "#ffffff", 748 yellow: "#ffff00", 749 750 // 4.2.3. "transparent" color keyword 751 transparent: [ null, null, null, 0 ], 752 753 _default: "#ffffff" 754 }; 755 756 var dataSpace = "ui-effects-", 757 dataSpaceStyle = "ui-effects-style", 758 dataSpaceAnimated = "ui-effects-animated"; 759 760 $.effects = { 761 effect: {} 762 }; 763 764 /******************************************************************************/ 765 /****************************** CLASS ANIMATIONS ******************************/ 766 /******************************************************************************/ 767 ( function() { 768 769 var classAnimationActions = [ "add", "remove", "toggle" ], 770 shorthandStyles = { 771 border: 1, 772 borderBottom: 1, 773 borderColor: 1, 774 borderLeft: 1, 775 borderRight: 1, 776 borderTop: 1, 777 borderWidth: 1, 778 margin: 1, 779 padding: 1 780 }; 781 782 $.each( 783 [ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], 784 function( _, prop ) { 785 $.fx.step[ prop ] = function( fx ) { 786 if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) { 787 jQuery.style( fx.elem, prop, fx.end ); 788 fx.setAttr = true; 789 } 790 }; 791 } 792 ); 793 794 function camelCase( string ) { 795 return string.replace( /-([\da-z])/gi, function( all, letter ) { 796 return letter.toUpperCase(); 797 } ); 798 } 799 800 function getElementStyles( elem ) { 801 var key, len, 802 style = elem.ownerDocument.defaultView ? 803 elem.ownerDocument.defaultView.getComputedStyle( elem, null ) : 804 elem.currentStyle, 805 styles = {}; 806 807 if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) { 808 len = style.length; 809 while ( len-- ) { 810 key = style[ len ]; 811 if ( typeof style[ key ] === "string" ) { 812 styles[ camelCase( key ) ] = style[ key ]; 813 } 814 } 815 816 // Support: Opera, IE <9 817 } else { 818 for ( key in style ) { 819 if ( typeof style[ key ] === "string" ) { 820 styles[ key ] = style[ key ]; 821 } 822 } 823 } 824 825 return styles; 826 } 827 828 function styleDifference( oldStyle, newStyle ) { 829 var diff = {}, 830 name, value; 831 832 for ( name in newStyle ) { 833 value = newStyle[ name ]; 834 if ( oldStyle[ name ] !== value ) { 835 if ( !shorthandStyles[ name ] ) { 836 if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) { 837 diff[ name ] = value; 838 } 839 } 840 } 841 } 842 843 return diff; 844 } 845 846 // Support: jQuery <1.8 847 if ( !$.fn.addBack ) { 848 $.fn.addBack = function( selector ) { 849 return this.add( selector == null ? 850 this.prevObject : this.prevObject.filter( selector ) 851 ); 852 }; 853 } 854 855 $.effects.animateClass = function( value, duration, easing, callback ) { 856 var o = $.speed( duration, easing, callback ); 857 858 return this.queue( function() { 859 var animated = $( this ), 860 baseClass = animated.attr( "class" ) || "", 861 applyClassChange, 862 allAnimations = o.children ? animated.find( "*" ).addBack() : animated; 863 864 // Map the animated objects to store the original styles. 865 allAnimations = allAnimations.map( function() { 866 var el = $( this ); 867 return { 868 el: el, 869 start: getElementStyles( this ) 870 }; 871 } ); 872 873 // Apply class change 874 applyClassChange = function() { 875 $.each( classAnimationActions, function( i, action ) { 876 if ( value[ action ] ) { 877 animated[ action + "Class" ]( value[ action ] ); 878 } 879 } ); 880 }; 881 applyClassChange(); 882 883 // Map all animated objects again - calculate new styles and diff 884 allAnimations = allAnimations.map( function() { 885 this.end = getElementStyles( this.el[ 0 ] ); 886 this.diff = styleDifference( this.start, this.end ); 887 return this; 888 } ); 889 890 // Apply original class 891 animated.attr( "class", baseClass ); 892 893 // Map all animated objects again - this time collecting a promise 894 allAnimations = allAnimations.map( function() { 895 var styleInfo = this, 896 dfd = $.Deferred(), 897 opts = $.extend( {}, o, { 898 queue: false, 899 complete: function() { 900 dfd.resolve( styleInfo ); 901 } 902 } ); 903 904 this.el.animate( this.diff, opts ); 905 return dfd.promise(); 906 } ); 907 908 // Once all animations have completed: 909 $.when.apply( $, allAnimations.get() ).done( function() { 910 911 // Set the final class 912 applyClassChange(); 913 914 // For each animated element, 915 // clear all css properties that were animated 916 $.each( arguments, function() { 917 var el = this.el; 918 $.each( this.diff, function( key ) { 919 el.css( key, "" ); 920 } ); 921 } ); 922 923 // This is guarnteed to be there if you use jQuery.speed() 924 // it also handles dequeuing the next anim... 925 o.complete.call( animated[ 0 ] ); 926 } ); 927 } ); 928 }; 929 930 $.fn.extend( { 931 addClass: ( function( orig ) { 932 return function( classNames, speed, easing, callback ) { 933 return speed ? 934 $.effects.animateClass.call( this, 935 { add: classNames }, speed, easing, callback ) : 936 orig.apply( this, arguments ); 937 }; 938 } )( $.fn.addClass ), 939 940 removeClass: ( function( orig ) { 941 return function( classNames, speed, easing, callback ) { 942 return arguments.length > 1 ? 943 $.effects.animateClass.call( this, 944 { remove: classNames }, speed, easing, callback ) : 945 orig.apply( this, arguments ); 946 }; 947 } )( $.fn.removeClass ), 948 949 toggleClass: ( function( orig ) { 950 return function( classNames, force, speed, easing, callback ) { 951 if ( typeof force === "boolean" || force === undefined ) { 952 if ( !speed ) { 953 954 // Without speed parameter 955 return orig.apply( this, arguments ); 956 } else { 957 return $.effects.animateClass.call( this, 958 ( force ? { add: classNames } : { remove: classNames } ), 959 speed, easing, callback ); 960 } 961 } else { 962 963 // Without force parameter 964 return $.effects.animateClass.call( this, 965 { toggle: classNames }, force, speed, easing ); 966 } 967 }; 968 } )( $.fn.toggleClass ), 969 970 switchClass: function( remove, add, speed, easing, callback ) { 971 return $.effects.animateClass.call( this, { 972 add: add, 973 remove: remove 974 }, speed, easing, callback ); 975 } 976 } ); 977 978 } )(); 979 980 /******************************************************************************/ 981 /*********************************** EFFECTS **********************************/ 982 /******************************************************************************/ 983 984 ( function() { 985 986 if ( $.expr && $.expr.pseudos && $.expr.pseudos.animated ) { 987 $.expr.pseudos.animated = ( function( orig ) { 988 return function( elem ) { 989 return !!$( elem ).data( dataSpaceAnimated ) || orig( elem ); 990 }; 991 } )( $.expr.pseudos.animated ); 992 } 993 994 if ( $.uiBackCompat !== false ) { 995 $.extend( $.effects, { 996 997 // Saves a set of properties in a data storage 998 save: function( element, set ) { 999 var i = 0, length = set.length; 1000 for ( ; i < length; i++ ) { 1001 if ( set[ i ] !== null ) { 1002 element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] ); 1003 } 1004 } 1005 }, 1006 1007 // Restores a set of previously saved properties from a data storage 1008 restore: function( element, set ) { 1009 var val, i = 0, length = set.length; 1010 for ( ; i < length; i++ ) { 1011 if ( set[ i ] !== null ) { 1012 val = element.data( dataSpace + set[ i ] ); 1013 element.css( set[ i ], val ); 1014 } 1015 } 1016 }, 1017 1018 setMode: function( el, mode ) { 1019 if ( mode === "toggle" ) { 1020 mode = el.is( ":hidden" ) ? "show" : "hide"; 1021 } 1022 return mode; 1023 }, 1024 1025 // Wraps the element around a wrapper that copies position properties 1026 createWrapper: function( element ) { 1027 1028 // If the element is already wrapped, return it 1029 if ( element.parent().is( ".ui-effects-wrapper" ) ) { 1030 return element.parent(); 1031 } 1032 1033 // Wrap the element 1034 var props = { 1035 width: element.outerWidth( true ), 1036 height: element.outerHeight( true ), 1037 "float": element.css( "float" ) 1038 }, 1039 wrapper = $( "<div></div>" ) 1040 .addClass( "ui-effects-wrapper" ) 1041 .css( { 1042 fontSize: "100%", 1043 background: "transparent", 1044 border: "none", 1045 margin: 0, 1046 padding: 0 1047 } ), 1048 1049 // Store the size in case width/height are defined in % - Fixes #5245 1050 size = { 1051 width: element.width(), 1052 height: element.height() 1053 }, 1054 active = document.activeElement; 1055 1056 // Support: Firefox 1057 // Firefox incorrectly exposes anonymous content 1058 // https://bugzilla.mozilla.org/show_bug.cgi?id=561664 1059 try { 1060 // eslint-disable-next-line no-unused-expressions 1061 active.id; 1062 } catch ( e ) { 1063 active = document.body; 1064 } 1065 1066 element.wrap( wrapper ); 1067 1068 // Fixes #7595 - Elements lose focus when wrapped. 1069 if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { 1070 $( active ).trigger( "focus" ); 1071 } 1072 1073 // Hotfix for jQuery 1.4 since some change in wrap() seems to actually 1074 // lose the reference to the wrapped element 1075 wrapper = element.parent(); 1076 1077 // Transfer positioning properties to the wrapper 1078 if ( element.css( "position" ) === "static" ) { 1079 wrapper.css( { position: "relative" } ); 1080 element.css( { position: "relative" } ); 1081 } else { 1082 $.extend( props, { 1083 position: element.css( "position" ), 1084 zIndex: element.css( "z-index" ) 1085 } ); 1086 $.each( [ "top", "left", "bottom", "right" ], function( i, pos ) { 1087 props[ pos ] = element.css( pos ); 1088 if ( isNaN( parseInt( props[ pos ], 10 ) ) ) { 1089 props[ pos ] = "auto"; 1090 } 1091 } ); 1092 element.css( { 1093 position: "relative", 1094 top: 0, 1095 left: 0, 1096 right: "auto", 1097 bottom: "auto" 1098 } ); 1099 } 1100 element.css( size ); 1101 1102 return wrapper.css( props ).show(); 1103 }, 1104 1105 removeWrapper: function( element ) { 1106 var active = document.activeElement; 1107 1108 if ( element.parent().is( ".ui-effects-wrapper" ) ) { 1109 element.parent().replaceWith( element ); 1110 1111 // Fixes #7595 - Elements lose focus when wrapped. 1112 if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { 1113 $( active ).trigger( "focus" ); 1114 } 1115 } 1116 1117 return element; 1118 } 1119 } ); 1120 } 1121 1122 $.extend( $.effects, { 1123 version: "1.13.2", 1124 1125 define: function( name, mode, effect ) { 1126 if ( !effect ) { 1127 effect = mode; 1128 mode = "effect"; 1129 } 1130 1131 $.effects.effect[ name ] = effect; 1132 $.effects.effect[ name ].mode = mode; 1133 1134 return effect; 1135 }, 1136 1137 scaledDimensions: function( element, percent, direction ) { 1138 if ( percent === 0 ) { 1139 return { 1140 height: 0, 1141 width: 0, 1142 outerHeight: 0, 1143 outerWidth: 0 1144 }; 1145 } 1146 1147 var x = direction !== "horizontal" ? ( ( percent || 100 ) / 100 ) : 1, 1148 y = direction !== "vertical" ? ( ( percent || 100 ) / 100 ) : 1; 1149 1150 return { 1151 height: element.height() * y, 1152 width: element.width() * x, 1153 outerHeight: element.outerHeight() * y, 1154 outerWidth: element.outerWidth() * x 1155 }; 1156 1157 }, 1158 1159 clipToBox: function( animation ) { 1160 return { 1161 width: animation.clip.right - animation.clip.left, 1162 height: animation.clip.bottom - animation.clip.top, 1163 left: animation.clip.left, 1164 top: animation.clip.top 1165 }; 1166 }, 1167 1168 // Injects recently queued functions to be first in line (after "inprogress") 1169 unshift: function( element, queueLength, count ) { 1170 var queue = element.queue(); 1171 1172 if ( queueLength > 1 ) { 1173 queue.splice.apply( queue, 1174 [ 1, 0 ].concat( queue.splice( queueLength, count ) ) ); 1175 } 1176 element.dequeue(); 1177 }, 1178 1179 saveStyle: function( element ) { 1180 element.data( dataSpaceStyle, element[ 0 ].style.cssText ); 1181 }, 1182 1183 restoreStyle: function( element ) { 1184 element[ 0 ].style.cssText = element.data( dataSpaceStyle ) || ""; 1185 element.removeData( dataSpaceStyle ); 1186 }, 1187 1188 mode: function( element, mode ) { 1189 var hidden = element.is( ":hidden" ); 1190 1191 if ( mode === "toggle" ) { 1192 mode = hidden ? "show" : "hide"; 1193 } 1194 if ( hidden ? mode === "hide" : mode === "show" ) { 1195 mode = "none"; 1196 } 1197 return mode; 1198 }, 1199 1200 // Translates a [top,left] array into a baseline value 1201 getBaseline: function( origin, original ) { 1202 var y, x; 1203 1204 switch ( origin[ 0 ] ) { 1205 case "top": 1206 y = 0; 1207 break; 1208 case "middle": 1209 y = 0.5; 1210 break; 1211 case "bottom": 1212 y = 1; 1213 break; 1214 default: 1215 y = origin[ 0 ] / original.height; 1216 } 1217 1218 switch ( origin[ 1 ] ) { 1219 case "left": 1220 x = 0; 1221 break; 1222 case "center": 1223 x = 0.5; 1224 break; 1225 case "right": 1226 x = 1; 1227 break; 1228 default: 1229 x = origin[ 1 ] / original.width; 1230 } 1231 1232 return { 1233 x: x, 1234 y: y 1235 }; 1236 }, 1237 1238 // Creates a placeholder element so that the original element can be made absolute 1239 createPlaceholder: function( element ) { 1240 var placeholder, 1241 cssPosition = element.css( "position" ), 1242 position = element.position(); 1243 1244 // Lock in margins first to account for form elements, which 1245 // will change margin if you explicitly set height 1246 // see: http://jsfiddle.net/JZSMt/3/ https://bugs.webkit.org/show_bug.cgi?id=107380 1247 // Support: Safari 1248 element.css( { 1249 marginTop: element.css( "marginTop" ), 1250 marginBottom: element.css( "marginBottom" ), 1251 marginLeft: element.css( "marginLeft" ), 1252 marginRight: element.css( "marginRight" ) 1253 } ) 1254 .outerWidth( element.outerWidth() ) 1255 .outerHeight( element.outerHeight() ); 1256 1257 if ( /^(static|relative)/.test( cssPosition ) ) { 1258 cssPosition = "absolute"; 1259 1260 placeholder = $( "<" + element[ 0 ].nodeName + ">" ).insertAfter( element ).css( { 1261 1262 // Convert inline to inline block to account for inline elements 1263 // that turn to inline block based on content (like img) 1264 display: /^(inline|ruby)/.test( element.css( "display" ) ) ? 1265 "inline-block" : 1266 "block", 1267 visibility: "hidden", 1268 1269 // Margins need to be set to account for margin collapse 1270 marginTop: element.css( "marginTop" ), 1271 marginBottom: element.css( "marginBottom" ), 1272 marginLeft: element.css( "marginLeft" ), 1273 marginRight: element.css( "marginRight" ), 1274 "float": element.css( "float" ) 1275 } ) 1276 .outerWidth( element.outerWidth() ) 1277 .outerHeight( element.outerHeight() ) 1278 .addClass( "ui-effects-placeholder" ); 1279 1280 element.data( dataSpace + "placeholder", placeholder ); 1281 } 1282 1283 element.css( { 1284 position: cssPosition, 1285 left: position.left, 1286 top: position.top 1287 } ); 1288 1289 return placeholder; 1290 }, 1291 1292 removePlaceholder: function( element ) { 1293 var dataKey = dataSpace + "placeholder", 1294 placeholder = element.data( dataKey ); 1295 1296 if ( placeholder ) { 1297 placeholder.remove(); 1298 element.removeData( dataKey ); 1299 } 1300 }, 1301 1302 // Removes a placeholder if it exists and restores 1303 // properties that were modified during placeholder creation 1304 cleanUp: function( element ) { 1305 $.effects.restoreStyle( element ); 1306 $.effects.removePlaceholder( element ); 1307 }, 1308 1309 setTransition: function( element, list, factor, value ) { 1310 value = value || {}; 1311 $.each( list, function( i, x ) { 1312 var unit = element.cssUnit( x ); 1313 if ( unit[ 0 ] > 0 ) { 1314 value[ x ] = unit[ 0 ] * factor + unit[ 1 ]; 1315 } 1316 } ); 1317 return value; 1318 } 1319 } ); 1320 1321 // Return an effect options object for the given parameters: 1322 function _normalizeArguments( effect, options, speed, callback ) { 1323 1324 // Allow passing all options as the first parameter 1325 if ( $.isPlainObject( effect ) ) { 1326 options = effect; 1327 effect = effect.effect; 1328 } 1329 1330 // Convert to an object 1331 effect = { effect: effect }; 1332 1333 // Catch (effect, null, ...) 1334 if ( options == null ) { 1335 options = {}; 1336 } 1337 1338 // Catch (effect, callback) 1339 if ( typeof options === "function" ) { 1340 callback = options; 1341 speed = null; 1342 options = {}; 1343 } 1344 1345 // Catch (effect, speed, ?) 1346 if ( typeof options === "number" || $.fx.speeds[ options ] ) { 1347 callback = speed; 1348 speed = options; 1349 options = {}; 1350 } 1351 1352 // Catch (effect, options, callback) 1353 if ( typeof speed === "function" ) { 1354 callback = speed; 1355 speed = null; 1356 } 1357 1358 // Add options to effect 1359 if ( options ) { 1360 $.extend( effect, options ); 1361 } 1362 1363 speed = speed || options.duration; 1364 effect.duration = $.fx.off ? 0 : 1365 typeof speed === "number" ? speed : 1366 speed in $.fx.speeds ? $.fx.speeds[ speed ] : 1367 $.fx.speeds._default; 1368 1369 effect.complete = callback || options.complete; 1370 1371 return effect; 1372 } 1373 1374 function standardAnimationOption( option ) { 1375 1376 // Valid standard speeds (nothing, number, named speed) 1377 if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) { 1378 return true; 1379 } 1380 1381 // Invalid strings - treat as "normal" speed 1382 if ( typeof option === "string" && !$.effects.effect[ option ] ) { 1383 return true; 1384 } 1385 1386 // Complete callback 1387 if ( typeof option === "function" ) { 1388 return true; 1389 } 1390 1391 // Options hash (but not naming an effect) 1392 if ( typeof option === "object" && !option.effect ) { 1393 return true; 1394 } 1395 1396 // Didn't match any standard API 1397 return false; 1398 } 1399 1400 $.fn.extend( { 1401 effect: function( /* effect, options, speed, callback */ ) { 1402 var args = _normalizeArguments.apply( this, arguments ), 1403 effectMethod = $.effects.effect[ args.effect ], 1404 defaultMode = effectMethod.mode, 1405 queue = args.queue, 1406 queueName = queue || "fx", 1407 complete = args.complete, 1408 mode = args.mode, 1409 modes = [], 1410 prefilter = function( next ) { 1411 var el = $( this ), 1412 normalizedMode = $.effects.mode( el, mode ) || defaultMode; 1413 1414 // Sentinel for duck-punching the :animated pseudo-selector 1415 el.data( dataSpaceAnimated, true ); 1416 1417 // Save effect mode for later use, 1418 // we can't just call $.effects.mode again later, 1419 // as the .show() below destroys the initial state 1420 modes.push( normalizedMode ); 1421 1422 // See $.uiBackCompat inside of run() for removal of defaultMode in 1.14 1423 if ( defaultMode && ( normalizedMode === "show" || 1424 ( normalizedMode === defaultMode && normalizedMode === "hide" ) ) ) { 1425 el.show(); 1426 } 1427 1428 if ( !defaultMode || normalizedMode !== "none" ) { 1429 $.effects.saveStyle( el ); 1430 } 1431 1432 if ( typeof next === "function" ) { 1433 next(); 1434 } 1435 }; 1436 1437 if ( $.fx.off || !effectMethod ) { 1438 1439 // Delegate to the original method (e.g., .show()) if possible 1440 if ( mode ) { 1441 return this[ mode ]( args.duration, complete ); 1442 } else { 1443 return this.each( function() { 1444 if ( complete ) { 1445 complete.call( this ); 1446 } 1447 } ); 1448 } 1449 } 1450 1451 function run( next ) { 1452 var elem = $( this ); 1453 1454 function cleanup() { 1455 elem.removeData( dataSpaceAnimated ); 1456 1457 $.effects.cleanUp( elem ); 1458 1459 if ( args.mode === "hide" ) { 1460 elem.hide(); 1461 } 1462 1463 done(); 1464 } 1465 1466 function done() { 1467 if ( typeof complete === "function" ) { 1468 complete.call( elem[ 0 ] ); 1469 } 1470 1471 if ( typeof next === "function" ) { 1472 next(); 1473 } 1474 } 1475 1476 // Override mode option on a per element basis, 1477 // as toggle can be either show or hide depending on element state 1478 args.mode = modes.shift(); 1479 1480 if ( $.uiBackCompat !== false && !defaultMode ) { 1481 if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) { 1482 1483 // Call the core method to track "olddisplay" properly 1484 elem[ mode ](); 1485 done(); 1486 } else { 1487 effectMethod.call( elem[ 0 ], args, done ); 1488 } 1489 } else { 1490 if ( args.mode === "none" ) { 1491 1492 // Call the core method to track "olddisplay" properly 1493 elem[ mode ](); 1494 done(); 1495 } else { 1496 effectMethod.call( elem[ 0 ], args, cleanup ); 1497 } 1498 } 1499 } 1500 1501 // Run prefilter on all elements first to ensure that 1502 // any showing or hiding happens before placeholder creation, 1503 // which ensures that any layout changes are correctly captured. 1504 return queue === false ? 1505 this.each( prefilter ).each( run ) : 1506 this.queue( queueName, prefilter ).queue( queueName, run ); 1507 }, 1508 1509 show: ( function( orig ) { 1510 return function( option ) { 1511 if ( standardAnimationOption( option ) ) { 1512 return orig.apply( this, arguments ); 1513 } else { 1514 var args = _normalizeArguments.apply( this, arguments ); 1515 args.mode = "show"; 1516 return this.effect.call( this, args ); 1517 } 1518 }; 1519 } )( $.fn.show ), 1520 1521 hide: ( function( orig ) { 1522 return function( option ) { 1523 if ( standardAnimationOption( option ) ) { 1524 return orig.apply( this, arguments ); 1525 } else { 1526 var args = _normalizeArguments.apply( this, arguments ); 1527 args.mode = "hide"; 1528 return this.effect.call( this, args ); 1529 } 1530 }; 1531 } )( $.fn.hide ), 1532 1533 toggle: ( function( orig ) { 1534 return function( option ) { 1535 if ( standardAnimationOption( option ) || typeof option === "boolean" ) { 1536 return orig.apply( this, arguments ); 1537 } else { 1538 var args = _normalizeArguments.apply( this, arguments ); 1539 args.mode = "toggle"; 1540 return this.effect.call( this, args ); 1541 } 1542 }; 1543 } )( $.fn.toggle ), 1544 1545 cssUnit: function( key ) { 1546 var style = this.css( key ), 1547 val = []; 1548 1549 $.each( [ "em", "px", "%", "pt" ], function( i, unit ) { 1550 if ( style.indexOf( unit ) > 0 ) { 1551 val = [ parseFloat( style ), unit ]; 1552 } 1553 } ); 1554 return val; 1555 }, 1556 1557 cssClip: function( clipObj ) { 1558 if ( clipObj ) { 1559 return this.css( "clip", "rect(" + clipObj.top + "px " + clipObj.right + "px " + 1560 clipObj.bottom + "px " + clipObj.left + "px)" ); 1561 } 1562 return parseClip( this.css( "clip" ), this ); 1563 }, 1564 1565 transfer: function( options, done ) { 1566 var element = $( this ), 1567 target = $( options.to ), 1568 targetFixed = target.css( "position" ) === "fixed", 1569 body = $( "body" ), 1570 fixTop = targetFixed ? body.scrollTop() : 0, 1571 fixLeft = targetFixed ? body.scrollLeft() : 0, 1572 endPosition = target.offset(), 1573 animation = { 1574 top: endPosition.top - fixTop, 1575 left: endPosition.left - fixLeft, 1576 height: target.innerHeight(), 1577 width: target.innerWidth() 1578 }, 1579 startPosition = element.offset(), 1580 transfer = $( "<div class='ui-effects-transfer'></div>" ); 1581 1582 transfer 1583 .appendTo( "body" ) 1584 .addClass( options.className ) 1585 .css( { 1586 top: startPosition.top - fixTop, 1587 left: startPosition.left - fixLeft, 1588 height: element.innerHeight(), 1589 width: element.innerWidth(), 1590 position: targetFixed ? "fixed" : "absolute" 1591 } ) 1592 .animate( animation, options.duration, options.easing, function() { 1593 transfer.remove(); 1594 if ( typeof done === "function" ) { 1595 done(); 1596 } 1597 } ); 1598 } 1599 } ); 1600 1601 function parseClip( str, element ) { 1602 var outerWidth = element.outerWidth(), 1603 outerHeight = element.outerHeight(), 1604 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)\)$/, 1605 values = clipRegex.exec( str ) || [ "", 0, outerWidth, outerHeight, 0 ]; 1606 1607 return { 1608 top: parseFloat( values[ 1 ] ) || 0, 1609 right: values[ 2 ] === "auto" ? outerWidth : parseFloat( values[ 2 ] ), 1610 bottom: values[ 3 ] === "auto" ? outerHeight : parseFloat( values[ 3 ] ), 1611 left: parseFloat( values[ 4 ] ) || 0 1612 }; 1613 } 1614 1615 $.fx.step.clip = function( fx ) { 1616 if ( !fx.clipInit ) { 1617 fx.start = $( fx.elem ).cssClip(); 1618 if ( typeof fx.end === "string" ) { 1619 fx.end = parseClip( fx.end, fx.elem ); 1620 } 1621 fx.clipInit = true; 1622 } 1623 1624 $( fx.elem ).cssClip( { 1625 top: fx.pos * ( fx.end.top - fx.start.top ) + fx.start.top, 1626 right: fx.pos * ( fx.end.right - fx.start.right ) + fx.start.right, 1627 bottom: fx.pos * ( fx.end.bottom - fx.start.bottom ) + fx.start.bottom, 1628 left: fx.pos * ( fx.end.left - fx.start.left ) + fx.start.left 1629 } ); 1630 }; 1631 1632 } )(); 1633 1634 /******************************************************************************/ 1635 /*********************************** EASING ***********************************/ 1636 /******************************************************************************/ 1637 1638 ( function() { 1639 1640 // Based on easing equations from Robert Penner (http://www.robertpenner.com/easing) 1641 1642 var baseEasings = {}; 1643 1644 $.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) { 1645 baseEasings[ name ] = function( p ) { 1646 return Math.pow( p, i + 2 ); 1647 }; 1648 } ); 1649 1650 $.extend( baseEasings, { 1651 Sine: function( p ) { 1652 return 1 - Math.cos( p * Math.PI / 2 ); 1653 }, 1654 Circ: function( p ) { 1655 return 1 - Math.sqrt( 1 - p * p ); 1656 }, 1657 Elastic: function( p ) { 1658 return p === 0 || p === 1 ? p : 1659 -Math.pow( 2, 8 * ( p - 1 ) ) * Math.sin( ( ( p - 1 ) * 80 - 7.5 ) * Math.PI / 15 ); 1660 }, 1661 Back: function( p ) { 1662 return p * p * ( 3 * p - 2 ); 1663 }, 1664 Bounce: function( p ) { 1665 var pow2, 1666 bounce = 4; 1667 1668 while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {} 1669 return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 ); 1670 } 1671 } ); 1672 1673 $.each( baseEasings, function( name, easeIn ) { 1674 $.easing[ "easeIn" + name ] = easeIn; 1675 $.easing[ "easeOut" + name ] = function( p ) { 1676 return 1 - easeIn( 1 - p ); 1677 }; 1678 $.easing[ "easeInOut" + name ] = function( p ) { 1679 return p < 0.5 ? 1680 easeIn( p * 2 ) / 2 : 1681 1 - easeIn( p * -2 + 2 ) / 2; 1682 }; 1683 } ); 1684 1685 } )(); 1686 1687 return $.effects; 1688 1689 } );
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Mon Mar 18 08:20:01 2024 | Cross-referenced by PHPXref |