You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1689 lines
41 KiB

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