| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 /*! 2 * jQuery UI Effects 1.14.2 3 * https://jqueryui.com 4 * 5 * Copyright OpenJS Foundation and other contributors 6 * Released under the MIT license. 7 * https://jquery.org/license 8 */ 9 10 //>>label: Effects Core 11 //>>group: Effects 12 //>>description: Extends the internal jQuery effects. Includes morphing and easing. Required by all other effects. 13 //>>docs: https://api.jqueryui.com/category/effects-core/ 14 //>>demos: https://jqueryui.com/effect/ 15 16 ( function( factory ) { 17 "use strict"; 18 19 if ( typeof define === "function" && define.amd ) { 20 21 // AMD. Register as an anonymous module. 22 define( [ 23 "jquery", 24 "./jquery-var-for-color", 25 "./vendor/jquery-color/jquery.color", 26 "./version" 27 ], factory ); 28 } else { 29 30 // Browser globals 31 factory( jQuery ); 32 } 33 } )( function( $ ) { 34 "use strict"; 35 36 var dataSpace = "ui-effects-", 37 dataSpaceStyle = "ui-effects-style", 38 dataSpaceAnimated = "ui-effects-animated"; 39 40 $.effects = { 41 effect: {} 42 }; 43 44 /******************************************************************************/ 45 /****************************** CLASS ANIMATIONS ******************************/ 46 /******************************************************************************/ 47 ( function() { 48 49 var classAnimationActions = [ "add", "remove", "toggle" ], 50 shorthandStyles = { 51 border: 1, 52 borderBottom: 1, 53 borderColor: 1, 54 borderLeft: 1, 55 borderRight: 1, 56 borderTop: 1, 57 borderWidth: 1, 58 margin: 1, 59 padding: 1 60 }; 61 62 $.each( 63 [ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], 64 function( _, prop ) { 65 $.fx.step[ prop ] = function( fx ) { 66 if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) { 67 jQuery.style( fx.elem, prop, fx.end ); 68 fx.setAttr = true; 69 } 70 }; 71 } 72 ); 73 74 function camelCase( string ) { 75 return string.replace( /-([\da-z])/gi, function( all, letter ) { 76 return letter.toUpperCase(); 77 } ); 78 } 79 80 function getElementStyles( elem ) { 81 var key, len, 82 style = elem.ownerDocument.defaultView.getComputedStyle( elem ), 83 styles = {}; 84 85 len = style.length; 86 while ( len-- ) { 87 key = style[ len ]; 88 if ( typeof style[ key ] === "string" ) { 89 styles[ camelCase( key ) ] = style[ key ]; 90 } 91 } 92 93 return styles; 94 } 95 96 function styleDifference( oldStyle, newStyle ) { 97 var diff = {}, 98 name, value; 99 100 for ( name in newStyle ) { 101 value = newStyle[ name ]; 102 if ( oldStyle[ name ] !== value ) { 103 if ( !shorthandStyles[ name ] ) { 104 if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) { 105 diff[ name ] = value; 106 } 107 } 108 } 109 } 110 111 return diff; 112 } 113 114 $.effects.animateClass = function( value, duration, easing, callback ) { 115 var o = $.speed( duration, easing, callback ); 116 117 return this.queue( function() { 118 var animated = $( this ), 119 baseClass = animated.attr( "class" ) || "", 120 applyClassChange, 121 allAnimations = o.children ? animated.find( "*" ).addBack() : animated; 122 123 // Map the animated objects to store the original styles. 124 allAnimations = allAnimations.map( function() { 125 var el = $( this ); 126 return { 127 el: el, 128 start: getElementStyles( this ) 129 }; 130 } ); 131 132 // Apply class change 133 applyClassChange = function() { 134 $.each( classAnimationActions, function( i, action ) { 135 if ( value[ action ] ) { 136 animated[ action + "Class" ]( value[ action ] ); 137 } 138 } ); 139 }; 140 applyClassChange(); 141 142 // Map all animated objects again - calculate new styles and diff 143 allAnimations = allAnimations.map( function() { 144 this.end = getElementStyles( this.el[ 0 ] ); 145 this.diff = styleDifference( this.start, this.end ); 146 return this; 147 } ); 148 149 // Apply original class 150 animated.attr( "class", baseClass ); 151 152 // Map all animated objects again - this time collecting a promise 153 allAnimations = allAnimations.map( function() { 154 var styleInfo = this, 155 dfd = $.Deferred(), 156 opts = $.extend( {}, o, { 157 queue: false, 158 complete: function() { 159 dfd.resolve( styleInfo ); 160 } 161 } ); 162 163 this.el.animate( this.diff, opts ); 164 return dfd.promise(); 165 } ); 166 167 // Once all animations have completed: 168 $.when.apply( $, allAnimations.get() ).done( function() { 169 170 // Set the final class 171 applyClassChange(); 172 173 // For each animated element, 174 // clear all css properties that were animated 175 $.each( arguments, function() { 176 var el = this.el; 177 $.each( this.diff, function( key ) { 178 el.css( key, "" ); 179 } ); 180 } ); 181 182 // This is guarnteed to be there if you use jQuery.speed() 183 // it also handles dequeuing the next anim... 184 o.complete.call( animated[ 0 ] ); 185 } ); 186 } ); 187 }; 188 189 $.fn.extend( { 190 addClass: ( function( orig ) { 191 return function( classNames, speed, easing, callback ) { 192 return speed ? 193 $.effects.animateClass.call( this, 194 { add: classNames }, speed, easing, callback ) : 195 orig.apply( this, arguments ); 196 }; 197 } )( $.fn.addClass ), 198 199 removeClass: ( function( orig ) { 200 return function( classNames, speed, easing, callback ) { 201 return arguments.length > 1 ? 202 $.effects.animateClass.call( this, 203 { remove: classNames }, speed, easing, callback ) : 204 orig.apply( this, arguments ); 205 }; 206 } )( $.fn.removeClass ), 207 208 toggleClass: ( function( orig ) { 209 return function( classNames, force, speed, easing, callback ) { 210 if ( typeof force === "boolean" || force === undefined ) { 211 if ( !speed ) { 212 213 // Without speed parameter 214 return orig.apply( this, arguments ); 215 } else { 216 return $.effects.animateClass.call( this, 217 ( force ? { add: classNames } : { remove: classNames } ), 218 speed, easing, callback ); 219 } 220 } else { 221 222 // Without force parameter 223 return $.effects.animateClass.call( this, 224 { toggle: classNames }, force, speed, easing ); 225 } 226 }; 227 } )( $.fn.toggleClass ), 228 229 switchClass: function( remove, add, speed, easing, callback ) { 230 return $.effects.animateClass.call( this, { 231 add: add, 232 remove: remove 233 }, speed, easing, callback ); 234 } 235 } ); 236 237 } )(); 238 239 /******************************************************************************/ 240 /*********************************** EFFECTS **********************************/ 241 /******************************************************************************/ 242 243 ( function() { 244 245 if ( $.expr && $.expr.pseudos && $.expr.pseudos.animated ) { 246 $.expr.pseudos.animated = ( function( orig ) { 247 return function( elem ) { 248 return !!$( elem ).data( dataSpaceAnimated ) || orig( elem ); 249 }; 250 } )( $.expr.pseudos.animated ); 251 } 252 253 if ( $.uiBackCompat === true ) { 254 $.extend( $.effects, { 255 256 // Saves a set of properties in a data storage 257 save: function( element, set ) { 258 var i = 0, length = set.length; 259 for ( ; i < length; i++ ) { 260 if ( set[ i ] !== null ) { 261 element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] ); 262 } 263 } 264 }, 265 266 // Restores a set of previously saved properties from a data storage 267 restore: function( element, set ) { 268 var val, i = 0, length = set.length; 269 for ( ; i < length; i++ ) { 270 if ( set[ i ] !== null ) { 271 val = element.data( dataSpace + set[ i ] ); 272 element.css( set[ i ], val ); 273 } 274 } 275 }, 276 277 setMode: function( el, mode ) { 278 if ( mode === "toggle" ) { 279 mode = el.is( ":hidden" ) ? "show" : "hide"; 280 } 281 return mode; 282 }, 283 284 // Wraps the element around a wrapper that copies position properties 285 createWrapper: function( element ) { 286 287 // If the element is already wrapped, return it 288 if ( element.parent().is( ".ui-effects-wrapper" ) ) { 289 return element.parent(); 290 } 291 292 // Wrap the element 293 var props = { 294 width: element.outerWidth( true ), 295 height: element.outerHeight( true ), 296 "float": element.css( "float" ) 297 }, 298 wrapper = $( "<div></div>" ) 299 .addClass( "ui-effects-wrapper" ) 300 .css( { 301 fontSize: "100%", 302 background: "transparent", 303 border: "none", 304 margin: 0, 305 padding: 0 306 } ), 307 308 // Store the size in case width/height are defined in % - Fixes #5245 309 size = { 310 width: element.width(), 311 height: element.height() 312 }, 313 active = document.activeElement; 314 315 // Support: Firefox 316 // Firefox incorrectly exposes anonymous content 317 // https://bugzilla.mozilla.org/show_bug.cgi?id=561664 318 try { 319 // eslint-disable-next-line no-unused-expressions 320 active.id; 321 } catch ( _e ) { 322 active = document.body; 323 } 324 325 element.wrap( wrapper ); 326 327 // Fixes #7595 - Elements lose focus when wrapped. 328 if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { 329 $( active ).trigger( "focus" ); 330 } 331 332 // Hotfix for jQuery 1.4 since some change in wrap() seems to actually 333 // lose the reference to the wrapped element 334 wrapper = element.parent(); 335 336 // Transfer positioning properties to the wrapper 337 if ( element.css( "position" ) === "static" ) { 338 wrapper.css( { position: "relative" } ); 339 element.css( { position: "relative" } ); 340 } else { 341 $.extend( props, { 342 position: element.css( "position" ), 343 zIndex: element.css( "z-index" ) 344 } ); 345 $.each( [ "top", "left", "bottom", "right" ], function( i, pos ) { 346 props[ pos ] = element.css( pos ); 347 if ( isNaN( parseInt( props[ pos ], 10 ) ) ) { 348 props[ pos ] = "auto"; 349 } 350 } ); 351 element.css( { 352 position: "relative", 353 top: 0, 354 left: 0, 355 right: "auto", 356 bottom: "auto" 357 } ); 358 } 359 element.css( size ); 360 361 return wrapper.css( props ).show(); 362 }, 363 364 removeWrapper: function( element ) { 365 var active = document.activeElement; 366 367 if ( element.parent().is( ".ui-effects-wrapper" ) ) { 368 element.parent().replaceWith( element ); 369 370 // Fixes #7595 - Elements lose focus when wrapped. 371 if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { 372 $( active ).trigger( "focus" ); 373 } 374 } 375 376 return element; 377 } 378 } ); 379 } 380 381 $.extend( $.effects, { 382 version: "1.14.2", 383 384 define: function( name, mode, effect ) { 385 if ( !effect ) { 386 effect = mode; 387 mode = "effect"; 388 } 389 390 $.effects.effect[ name ] = effect; 391 $.effects.effect[ name ].mode = mode; 392 393 return effect; 394 }, 395 396 scaledDimensions: function( element, percent, direction ) { 397 if ( percent === 0 ) { 398 return { 399 height: 0, 400 width: 0, 401 outerHeight: 0, 402 outerWidth: 0 403 }; 404 } 405 406 var x = direction !== "horizontal" ? ( ( percent || 100 ) / 100 ) : 1, 407 y = direction !== "vertical" ? ( ( percent || 100 ) / 100 ) : 1; 408 409 return { 410 height: element.height() * y, 411 width: element.width() * x, 412 outerHeight: element.outerHeight() * y, 413 outerWidth: element.outerWidth() * x 414 }; 415 416 }, 417 418 clipToBox: function( animation ) { 419 return { 420 width: animation.clip.right - animation.clip.left, 421 height: animation.clip.bottom - animation.clip.top, 422 left: animation.clip.left, 423 top: animation.clip.top 424 }; 425 }, 426 427 // Injects recently queued functions to be first in line (after "inprogress") 428 unshift: function( element, queueLength, count ) { 429 var queue = element.queue(); 430 431 if ( queueLength > 1 ) { 432 queue.splice.apply( queue, 433 [ 1, 0 ].concat( queue.splice( queueLength, count ) ) ); 434 } 435 element.dequeue(); 436 }, 437 438 saveStyle: function( element ) { 439 element.data( dataSpaceStyle, element[ 0 ].style.cssText ); 440 }, 441 442 restoreStyle: function( element ) { 443 element[ 0 ].style.cssText = element.data( dataSpaceStyle ) || ""; 444 element.removeData( dataSpaceStyle ); 445 }, 446 447 mode: function( element, mode ) { 448 var hidden = element.is( ":hidden" ); 449 450 if ( mode === "toggle" ) { 451 mode = hidden ? "show" : "hide"; 452 } 453 if ( hidden ? mode === "hide" : mode === "show" ) { 454 mode = "none"; 455 } 456 return mode; 457 }, 458 459 // Translates a [top,left] array into a baseline value 460 getBaseline: function( origin, original ) { 461 var y, x; 462 463 switch ( origin[ 0 ] ) { 464 case "top": 465 y = 0; 466 break; 467 case "middle": 468 y = 0.5; 469 break; 470 case "bottom": 471 y = 1; 472 break; 473 default: 474 y = origin[ 0 ] / original.height; 475 } 476 477 switch ( origin[ 1 ] ) { 478 case "left": 479 x = 0; 480 break; 481 case "center": 482 x = 0.5; 483 break; 484 case "right": 485 x = 1; 486 break; 487 default: 488 x = origin[ 1 ] / original.width; 489 } 490 491 return { 492 x: x, 493 y: y 494 }; 495 }, 496 497 // Creates a placeholder element so that the original element can be made absolute 498 createPlaceholder: function( element ) { 499 var placeholder, 500 cssPosition = element.css( "position" ), 501 position = element.position(); 502 503 // Lock in margins first to account for form elements, which 504 // will change margin if you explicitly set height 505 // see: https://jsfiddle.net/JZSMt/3/ https://bugs.webkit.org/show_bug.cgi?id=107380 506 // Support: Safari 507 element.css( { 508 marginTop: element.css( "marginTop" ), 509 marginBottom: element.css( "marginBottom" ), 510 marginLeft: element.css( "marginLeft" ), 511 marginRight: element.css( "marginRight" ) 512 } ) 513 .outerWidth( element.outerWidth() ) 514 .outerHeight( element.outerHeight() ); 515 516 if ( /^(static|relative)/.test( cssPosition ) ) { 517 cssPosition = "absolute"; 518 519 placeholder = $( "<" + element[ 0 ].nodeName + ">" ).insertAfter( element ).css( { 520 521 // Convert inline to inline block to account for inline elements 522 // that turn to inline block based on content (like img) 523 display: /^(inline|ruby)/.test( element.css( "display" ) ) ? 524 "inline-block" : 525 "block", 526 visibility: "hidden", 527 528 // Margins need to be set to account for margin collapse 529 marginTop: element.css( "marginTop" ), 530 marginBottom: element.css( "marginBottom" ), 531 marginLeft: element.css( "marginLeft" ), 532 marginRight: element.css( "marginRight" ), 533 "float": element.css( "float" ) 534 } ) 535 .outerWidth( element.outerWidth() ) 536 .outerHeight( element.outerHeight() ) 537 .addClass( "ui-effects-placeholder" ); 538 539 element.data( dataSpace + "placeholder", placeholder ); 540 } 541 542 element.css( { 543 position: cssPosition, 544 left: position.left, 545 top: position.top 546 } ); 547 548 return placeholder; 549 }, 550 551 removePlaceholder: function( element ) { 552 var dataKey = dataSpace + "placeholder", 553 placeholder = element.data( dataKey ); 554 555 if ( placeholder ) { 556 placeholder.remove(); 557 element.removeData( dataKey ); 558 } 559 }, 560 561 // Removes a placeholder if it exists and restores 562 // properties that were modified during placeholder creation 563 cleanUp: function( element ) { 564 $.effects.restoreStyle( element ); 565 $.effects.removePlaceholder( element ); 566 }, 567 568 setTransition: function( element, list, factor, value ) { 569 value = value || {}; 570 $.each( list, function( i, x ) { 571 var unit = element.cssUnit( x ); 572 if ( unit[ 0 ] > 0 ) { 573 value[ x ] = unit[ 0 ] * factor + unit[ 1 ]; 574 } 575 } ); 576 return value; 577 } 578 } ); 579 580 // Return an effect options object for the given parameters: 581 function _normalizeArguments( effect, options, speed, callback ) { 582 583 // Allow passing all options as the first parameter 584 if ( $.isPlainObject( effect ) ) { 585 options = effect; 586 effect = effect.effect; 587 } 588 589 // Convert to an object 590 effect = { effect: effect }; 591 592 // Catch (effect, null, ...) 593 if ( options == null ) { 594 options = {}; 595 } 596 597 // Catch (effect, callback) 598 if ( typeof options === "function" ) { 599 callback = options; 600 speed = null; 601 options = {}; 602 } 603 604 // Catch (effect, speed, ?) 605 if ( typeof options === "number" || $.fx.speeds[ options ] ) { 606 callback = speed; 607 speed = options; 608 options = {}; 609 } 610 611 // Catch (effect, options, callback) 612 if ( typeof speed === "function" ) { 613 callback = speed; 614 speed = null; 615 } 616 617 // Add options to effect 618 if ( options ) { 619 $.extend( effect, options ); 620 } 621 622 speed = speed || options.duration; 623 effect.duration = $.fx.off ? 0 : 624 typeof speed === "number" ? speed : 625 speed in $.fx.speeds ? $.fx.speeds[ speed ] : 626 $.fx.speeds._default; 627 628 effect.complete = callback || options.complete; 629 630 return effect; 631 } 632 633 function standardAnimationOption( option ) { 634 635 // Valid standard speeds (nothing, number, named speed) 636 if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) { 637 return true; 638 } 639 640 // Invalid strings - treat as "normal" speed 641 if ( typeof option === "string" && !$.effects.effect[ option ] ) { 642 return true; 643 } 644 645 // Complete callback 646 if ( typeof option === "function" ) { 647 return true; 648 } 649 650 // Options hash (but not naming an effect) 651 if ( typeof option === "object" && !option.effect ) { 652 return true; 653 } 654 655 // Didn't match any standard API 656 return false; 657 } 658 659 $.fn.extend( { 660 effect: function( /* effect, options, speed, callback */ ) { 661 var args = _normalizeArguments.apply( this, arguments ), 662 effectMethod = $.effects.effect[ args.effect ], 663 defaultMode = effectMethod.mode, 664 queue = args.queue, 665 queueName = queue || "fx", 666 complete = args.complete, 667 mode = args.mode, 668 modes = [], 669 prefilter = function( next ) { 670 var el = $( this ), 671 normalizedMode = $.effects.mode( el, mode ) || defaultMode; 672 673 // Sentinel for duck-punching the :animated pseudo-selector 674 el.data( dataSpaceAnimated, true ); 675 676 // Save effect mode for later use, 677 // we can't just call $.effects.mode again later, 678 // as the .show() below destroys the initial state 679 modes.push( normalizedMode ); 680 681 // See $.uiBackCompat inside of run() for removal of defaultMode in 1.14 682 if ( defaultMode && ( normalizedMode === "show" || 683 ( normalizedMode === defaultMode && normalizedMode === "hide" ) ) ) { 684 el.show(); 685 } 686 687 if ( !defaultMode || normalizedMode !== "none" ) { 688 $.effects.saveStyle( el ); 689 } 690 691 if ( typeof next === "function" ) { 692 next(); 693 } 694 }; 695 696 if ( $.fx.off || !effectMethod ) { 697 698 // Delegate to the original method (e.g., .show()) if possible 699 if ( mode ) { 700 return this[ mode ]( args.duration, complete ); 701 } else { 702 return this.each( function() { 703 if ( complete ) { 704 complete.call( this ); 705 } 706 } ); 707 } 708 } 709 710 function run( next ) { 711 var elem = $( this ); 712 713 function cleanup() { 714 elem.removeData( dataSpaceAnimated ); 715 716 $.effects.cleanUp( elem ); 717 718 if ( args.mode === "hide" ) { 719 elem.hide(); 720 } 721 722 done(); 723 } 724 725 function done() { 726 if ( typeof complete === "function" ) { 727 complete.call( elem[ 0 ] ); 728 } 729 730 if ( typeof next === "function" ) { 731 next(); 732 } 733 } 734 735 // Override mode option on a per element basis, 736 // as toggle can be either show or hide depending on element state 737 args.mode = modes.shift(); 738 739 if ( $.uiBackCompat === true && !defaultMode ) { 740 if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) { 741 742 // Call the core method to track "olddisplay" properly 743 elem[ mode ](); 744 done(); 745 } else { 746 effectMethod.call( elem[ 0 ], args, done ); 747 } 748 } else { 749 if ( args.mode === "none" ) { 750 751 // Call the core method to track "olddisplay" properly 752 elem[ mode ](); 753 done(); 754 } else { 755 effectMethod.call( elem[ 0 ], args, cleanup ); 756 } 757 } 758 } 759 760 // Run prefilter on all elements first to ensure that 761 // any showing or hiding happens before placeholder creation, 762 // which ensures that any layout changes are correctly captured. 763 return queue === false ? 764 this.each( prefilter ).each( run ) : 765 this.queue( queueName, prefilter ).queue( queueName, run ); 766 }, 767 768 show: ( function( orig ) { 769 return function( option ) { 770 if ( standardAnimationOption( option ) ) { 771 return orig.apply( this, arguments ); 772 } else { 773 var args = _normalizeArguments.apply( this, arguments ); 774 args.mode = "show"; 775 return this.effect.call( this, args ); 776 } 777 }; 778 } )( $.fn.show ), 779 780 hide: ( function( orig ) { 781 return function( option ) { 782 if ( standardAnimationOption( option ) ) { 783 return orig.apply( this, arguments ); 784 } else { 785 var args = _normalizeArguments.apply( this, arguments ); 786 args.mode = "hide"; 787 return this.effect.call( this, args ); 788 } 789 }; 790 } )( $.fn.hide ), 791 792 toggle: ( function( orig ) { 793 return function( option ) { 794 if ( standardAnimationOption( option ) || typeof option === "boolean" ) { 795 return orig.apply( this, arguments ); 796 } else { 797 var args = _normalizeArguments.apply( this, arguments ); 798 args.mode = "toggle"; 799 return this.effect.call( this, args ); 800 } 801 }; 802 } )( $.fn.toggle ), 803 804 cssUnit: function( key ) { 805 var style = this.css( key ), 806 val = []; 807 808 $.each( [ "em", "px", "%", "pt" ], function( i, unit ) { 809 if ( style.indexOf( unit ) > 0 ) { 810 val = [ parseFloat( style ), unit ]; 811 } 812 } ); 813 return val; 814 }, 815 816 cssClip: function( clipObj ) { 817 if ( clipObj ) { 818 return this.css( "clip", "rect(" + clipObj.top + "px " + clipObj.right + "px " + 819 clipObj.bottom + "px " + clipObj.left + "px)" ); 820 } 821 return parseClip( this.css( "clip" ), this ); 822 }, 823 824 transfer: function( options, done ) { 825 var element = $( this ), 826 target = $( options.to ), 827 targetFixed = target.css( "position" ) === "fixed", 828 body = $( "body" ), 829 fixTop = targetFixed ? body.scrollTop() : 0, 830 fixLeft = targetFixed ? body.scrollLeft() : 0, 831 endPosition = target.offset(), 832 animation = { 833 top: endPosition.top - fixTop, 834 left: endPosition.left - fixLeft, 835 height: target.innerHeight(), 836 width: target.innerWidth() 837 }, 838 startPosition = element.offset(), 839 transfer = $( "<div class='ui-effects-transfer'></div>" ); 840 841 transfer 842 .appendTo( "body" ) 843 .addClass( options.className ) 844 .css( { 845 top: startPosition.top - fixTop, 846 left: startPosition.left - fixLeft, 847 height: element.innerHeight(), 848 width: element.innerWidth(), 849 position: targetFixed ? "fixed" : "absolute" 850 } ) 851 .animate( animation, options.duration, options.easing, function() { 852 transfer.remove(); 853 if ( typeof done === "function" ) { 854 done(); 855 } 856 } ); 857 } 858 } ); 859 860 function parseClip( str, element ) { 861 var outerWidth = element.outerWidth(), 862 outerHeight = element.outerHeight(), 863 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)\)$/, 864 values = clipRegex.exec( str ) || [ "", 0, outerWidth, outerHeight, 0 ]; 865 866 return { 867 top: parseFloat( values[ 1 ] ) || 0, 868 right: values[ 2 ] === "auto" ? outerWidth : parseFloat( values[ 2 ] ), 869 bottom: values[ 3 ] === "auto" ? outerHeight : parseFloat( values[ 3 ] ), 870 left: parseFloat( values[ 4 ] ) || 0 871 }; 872 } 873 874 $.fx.step.clip = function( fx ) { 875 if ( !fx.clipInit ) { 876 fx.start = $( fx.elem ).cssClip(); 877 if ( typeof fx.end === "string" ) { 878 fx.end = parseClip( fx.end, fx.elem ); 879 } 880 fx.clipInit = true; 881 } 882 883 $( fx.elem ).cssClip( { 884 top: fx.pos * ( fx.end.top - fx.start.top ) + fx.start.top, 885 right: fx.pos * ( fx.end.right - fx.start.right ) + fx.start.right, 886 bottom: fx.pos * ( fx.end.bottom - fx.start.bottom ) + fx.start.bottom, 887 left: fx.pos * ( fx.end.left - fx.start.left ) + fx.start.left 888 } ); 889 }; 890 891 } )(); 892 893 /******************************************************************************/ 894 /*********************************** EASING ***********************************/ 895 /******************************************************************************/ 896 897 ( function() { 898 899 // Based on easing equations from Robert Penner (http://robertpenner.com/easing) 900 901 var baseEasings = {}; 902 903 $.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) { 904 baseEasings[ name ] = function( p ) { 905 return Math.pow( p, i + 2 ); 906 }; 907 } ); 908 909 $.extend( baseEasings, { 910 Sine: function( p ) { 911 return 1 - Math.cos( p * Math.PI / 2 ); 912 }, 913 Circ: function( p ) { 914 return 1 - Math.sqrt( 1 - p * p ); 915 }, 916 Elastic: function( p ) { 917 return p === 0 || p === 1 ? p : 918 -Math.pow( 2, 8 * ( p - 1 ) ) * Math.sin( ( ( p - 1 ) * 80 - 7.5 ) * Math.PI / 15 ); 919 }, 920 Back: function( p ) { 921 return p * p * ( 3 * p - 2 ); 922 }, 923 Bounce: function( p ) { 924 var pow2, 925 bounce = 4; 926 927 while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {} 928 return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 ); 929 } 930 } ); 931 932 $.each( baseEasings, function( name, easeIn ) { 933 $.easing[ "easeIn" + name ] = easeIn; 934 $.easing[ "easeOut" + name ] = function( p ) { 935 return 1 - easeIn( 1 - p ); 936 }; 937 $.easing[ "easeInOut" + name ] = function( p ) { 938 return p < 0.5 ? 939 easeIn( p * 2 ) / 2 : 940 1 - easeIn( p * -2 + 2 ) / 2; 941 }; 942 } ); 943 944 } )(); 945 946 return $.effects; 947 948 } );
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Thu Jul 16 08:20:16 2026 | Cross-referenced by PHPXref |