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