Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 
 
 

715 řádky
22 KiB

  1. /*
  2. * jQuery UI Effects 1.8
  3. *
  4. * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
  5. * Dual licensed under the MIT (MIT-LICENSE.txt)
  6. * and GPL (GPL-LICENSE.txt) licenses.
  7. *
  8. * http://docs.jquery.com/UI/Effects/
  9. */
  10. ;jQuery.effects || (function($) {
  11. $.effects = {};
  12. /******************************************************************************/
  13. /****************************** COLOR ANIMATIONS ******************************/
  14. /******************************************************************************/
  15. // override the animation for color styles
  16. $.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor',
  17. 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'],
  18. function(i, attr) {
  19. $.fx.step[attr] = function(fx) {
  20. if (!fx.colorInit) {
  21. fx.start = getColor(fx.elem, attr);
  22. fx.end = getRGB(fx.end);
  23. fx.colorInit = true;
  24. }
  25. fx.elem.style[attr] = 'rgb(' +
  26. Math.max(Math.min(parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0], 10), 255), 0) + ',' +
  27. Math.max(Math.min(parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1], 10), 255), 0) + ',' +
  28. Math.max(Math.min(parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2], 10), 255), 0) + ')';
  29. };
  30. });
  31. // Color Conversion functions from highlightFade
  32. // By Blair Mitchelmore
  33. // http://jquery.offput.ca/highlightFade/
  34. // Parse strings looking for color tuples [255,255,255]
  35. function getRGB(color) {
  36. var result;
  37. // Check if we're already dealing with an array of colors
  38. if ( color && color.constructor == Array && color.length == 3 )
  39. return color;
  40. // Look for rgb(num,num,num)
  41. if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
  42. return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)];
  43. // Look for rgb(num%,num%,num%)
  44. if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
  45. return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
  46. // Look for #a0b1c2
  47. if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
  48. return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
  49. // Look for #fff
  50. if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
  51. return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
  52. // Look for rgba(0, 0, 0, 0) == transparent in Safari 3
  53. if (result = /rgba\(0, 0, 0, 0\)/.exec(color))
  54. return colors['transparent'];
  55. // Otherwise, we're most likely dealing with a named color
  56. return colors[$.trim(color).toLowerCase()];
  57. }
  58. function getColor(elem, attr) {
  59. var color;
  60. do {
  61. color = $.curCSS(elem, attr);
  62. // Keep going until we find an element that has color, or we hit the body
  63. if ( color != '' && color != 'transparent' || $.nodeName(elem, "body") )
  64. break;
  65. attr = "backgroundColor";
  66. } while ( elem = elem.parentNode );
  67. return getRGB(color);
  68. };
  69. // Some named colors to work with
  70. // From Interface by Stefan Petre
  71. // http://interface.eyecon.ro/
  72. var colors = {
  73. aqua:[0,255,255],
  74. azure:[240,255,255],
  75. beige:[245,245,220],
  76. black:[0,0,0],
  77. blue:[0,0,255],
  78. brown:[165,42,42],
  79. cyan:[0,255,255],
  80. darkblue:[0,0,139],
  81. darkcyan:[0,139,139],
  82. darkgrey:[169,169,169],
  83. darkgreen:[0,100,0],
  84. darkkhaki:[189,183,107],
  85. darkmagenta:[139,0,139],
  86. darkolivegreen:[85,107,47],
  87. darkorange:[255,140,0],
  88. darkorchid:[153,50,204],
  89. darkred:[139,0,0],
  90. darksalmon:[233,150,122],
  91. darkviolet:[148,0,211],
  92. fuchsia:[255,0,255],
  93. gold:[255,215,0],
  94. green:[0,128,0],
  95. indigo:[75,0,130],
  96. khaki:[240,230,140],
  97. lightblue:[173,216,230],
  98. lightcyan:[224,255,255],
  99. lightgreen:[144,238,144],
  100. lightgrey:[211,211,211],
  101. lightpink:[255,182,193],
  102. lightyellow:[255,255,224],
  103. lime:[0,255,0],
  104. magenta:[255,0,255],
  105. maroon:[128,0,0],
  106. navy:[0,0,128],
  107. olive:[128,128,0],
  108. orange:[255,165,0],
  109. pink:[255,192,203],
  110. purple:[128,0,128],
  111. violet:[128,0,128],
  112. red:[255,0,0],
  113. silver:[192,192,192],
  114. white:[255,255,255],
  115. yellow:[255,255,0],
  116. transparent: [255,255,255]
  117. };
  118. /******************************************************************************/
  119. /****************************** CLASS ANIMATIONS ******************************/
  120. /******************************************************************************/
  121. var classAnimationActions = ['add', 'remove', 'toggle'],
  122. shorthandStyles = {
  123. border: 1,
  124. borderBottom: 1,
  125. borderColor: 1,
  126. borderLeft: 1,
  127. borderRight: 1,
  128. borderTop: 1,
  129. borderWidth: 1,
  130. margin: 1,
  131. padding: 1
  132. };
  133. function getElementStyles() {
  134. var style = document.defaultView
  135. ? document.defaultView.getComputedStyle(this, null)
  136. : this.currentStyle,
  137. newStyle = {},
  138. key,
  139. camelCase;
  140. // webkit enumerates style porperties
  141. if (style && style.length && style[0] && style[style[0]]) {
  142. var len = style.length;
  143. while (len--) {
  144. key = style[len];
  145. if (typeof style[key] == 'string') {
  146. camelCase = key.replace(/\-(\w)/g, function(all, letter){
  147. return letter.toUpperCase();
  148. });
  149. newStyle[camelCase] = style[key];
  150. }
  151. }
  152. } else {
  153. for (key in style) {
  154. if (typeof style[key] === 'string') {
  155. newStyle[key] = style[key];
  156. }
  157. }
  158. }
  159. return newStyle;
  160. }
  161. function filterStyles(styles) {
  162. var name, value;
  163. for (name in styles) {
  164. value = styles[name];
  165. if (
  166. // ignore null and undefined values
  167. value == null ||
  168. // ignore functions (when does this occur?)
  169. $.isFunction(value) ||
  170. // shorthand styles that need to be expanded
  171. name in shorthandStyles ||
  172. // ignore scrollbars (break in IE)
  173. (/scrollbar/).test(name) ||
  174. // only colors or values that can be converted to numbers
  175. (!(/color/i).test(name) && isNaN(parseFloat(value)))
  176. ) {
  177. delete styles[name];
  178. }
  179. }
  180. return styles;
  181. }
  182. function styleDifference(oldStyle, newStyle) {
  183. var diff = { _: 0 }, // http://dev.jquery.com/ticket/5459
  184. name;
  185. for (name in newStyle) {
  186. if (oldStyle[name] != newStyle[name]) {
  187. diff[name] = newStyle[name];
  188. }
  189. }
  190. return diff;
  191. }
  192. $.effects.animateClass = function(value, duration, easing, callback) {
  193. if ($.isFunction(easing)) {
  194. callback = easing;
  195. easing = null;
  196. }
  197. return this.each(function() {
  198. var that = $(this),
  199. originalStyleAttr = that.attr('style') || ' ',
  200. originalStyle = filterStyles(getElementStyles.call(this)),
  201. newStyle,
  202. className = that.attr('className');
  203. $.each(classAnimationActions, function(i, action) {
  204. if (value[action]) {
  205. that[action + 'Class'](value[action]);
  206. }
  207. });
  208. newStyle = filterStyles(getElementStyles.call(this));
  209. that.attr('className', className);
  210. that.animate(styleDifference(originalStyle, newStyle), duration, easing, function() {
  211. $.each(classAnimationActions, function(i, action) {
  212. if (value[action]) { that[action + 'Class'](value[action]); }
  213. });
  214. // work around bug in IE by clearing the cssText before setting it
  215. if (typeof that.attr('style') == 'object') {
  216. that.attr('style').cssText = '';
  217. that.attr('style').cssText = originalStyleAttr;
  218. } else {
  219. that.attr('style', originalStyleAttr);
  220. }
  221. if (callback) { callback.apply(this, arguments); }
  222. });
  223. });
  224. };
  225. $.fn.extend({
  226. _addClass: $.fn.addClass,
  227. addClass: function(classNames, speed, easing, callback) {
  228. return speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames);
  229. },
  230. _removeClass: $.fn.removeClass,
  231. removeClass: function(classNames,speed,easing,callback) {
  232. return speed ? $.effects.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames);
  233. },
  234. _toggleClass: $.fn.toggleClass,
  235. toggleClass: function(classNames, force, speed, easing, callback) {
  236. if ( typeof force == "boolean" || force === undefined ) {
  237. if ( !speed ) {
  238. // without speed parameter;
  239. return this._toggleClass(classNames, force);
  240. } else {
  241. return $.effects.animateClass.apply(this, [(force?{add:classNames}:{remove:classNames}),speed,easing,callback]);
  242. }
  243. } else {
  244. // without switch parameter;
  245. return $.effects.animateClass.apply(this, [{ toggle: classNames },force,speed,easing]);
  246. }
  247. },
  248. switchClass: function(remove,add,speed,easing,callback) {
  249. return $.effects.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]);
  250. }
  251. });
  252. /******************************************************************************/
  253. /*********************************** EFFECTS **********************************/
  254. /******************************************************************************/
  255. $.extend($.effects, {
  256. version: "1.8",
  257. // Saves a set of properties in a data storage
  258. save: function(element, set) {
  259. for(var i=0; i < set.length; i++) {
  260. if(set[i] !== null) element.data("ec.storage."+set[i], element[0].style[set[i]]);
  261. }
  262. },
  263. // Restores a set of previously saved properties from a data storage
  264. restore: function(element, set) {
  265. for(var i=0; i < set.length; i++) {
  266. if(set[i] !== null) element.css(set[i], element.data("ec.storage."+set[i]));
  267. }
  268. },
  269. setMode: function(el, mode) {
  270. if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle
  271. return mode;
  272. },
  273. getBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value
  274. // this should be a little more flexible in the future to handle a string & hash
  275. var y, x;
  276. switch (origin[0]) {
  277. case 'top': y = 0; break;
  278. case 'middle': y = 0.5; break;
  279. case 'bottom': y = 1; break;
  280. default: y = origin[0] / original.height;
  281. };
  282. switch (origin[1]) {
  283. case 'left': x = 0; break;
  284. case 'center': x = 0.5; break;
  285. case 'right': x = 1; break;
  286. default: x = origin[1] / original.width;
  287. };
  288. return {x: x, y: y};
  289. },
  290. // Wraps the element around a wrapper that copies position properties
  291. createWrapper: function(element) {
  292. // if the element is already wrapped, return it
  293. if (element.parent().is('.ui-effects-wrapper')) {
  294. return element.parent();
  295. }
  296. // wrap the element
  297. var props = {
  298. width: element.outerWidth(true),
  299. height: element.outerHeight(true),
  300. 'float': element.css('float')
  301. },
  302. wrapper = $('<div></div>')
  303. .addClass('ui-effects-wrapper')
  304. .css({
  305. fontSize: '100%',
  306. background: 'transparent',
  307. border: 'none',
  308. margin: 0,
  309. padding: 0
  310. });
  311. element.wrap(wrapper);
  312. wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually loose the reference to the wrapped element
  313. // transfer positioning properties to the wrapper
  314. if (element.css('position') == 'static') {
  315. wrapper.css({ position: 'relative' });
  316. element.css({ position: 'relative' });
  317. } else {
  318. $.extend(props, {
  319. position: element.css('position'),
  320. zIndex: element.css('z-index')
  321. });
  322. $.each(['top', 'left', 'bottom', 'right'], function(i, pos) {
  323. props[pos] = element.css(pos);
  324. if (isNaN(parseInt(props[pos], 10))) {
  325. props[pos] = 'auto';
  326. }
  327. });
  328. element.css({position: 'relative', top: 0, left: 0 });
  329. }
  330. return wrapper.css(props).show();
  331. },
  332. removeWrapper: function(element) {
  333. if (element.parent().is('.ui-effects-wrapper'))
  334. return element.parent().replaceWith(element);
  335. return element;
  336. },
  337. setTransition: function(element, list, factor, value) {
  338. value = value || {};
  339. $.each(list, function(i, x){
  340. unit = element.cssUnit(x);
  341. if (unit[0] > 0) value[x] = unit[0] * factor + unit[1];
  342. });
  343. return value;
  344. }
  345. });
  346. function _normalizeArguments(effect, options, speed, callback) {
  347. // shift params for method overloading
  348. if (typeof effect == 'object') {
  349. callback = options;
  350. speed = null;
  351. options = effect;
  352. effect = options.effect;
  353. }
  354. if ($.isFunction(options)) {
  355. callback = options;
  356. speed = null;
  357. options = {};
  358. }
  359. if ($.isFunction(speed)) {
  360. callback = speed;
  361. speed = null;
  362. }
  363. if (typeof options == 'number' || $.fx.speeds[options]) {
  364. callback = speed;
  365. speed = options;
  366. options = {};
  367. }
  368. options = options || {};
  369. speed = speed || options.duration;
  370. speed = $.fx.off ? 0 : typeof speed == 'number'
  371. ? speed : $.fx.speeds[speed] || $.fx.speeds._default;
  372. callback = callback || options.complete;
  373. return [effect, options, speed, callback];
  374. }
  375. $.fn.extend({
  376. effect: function(effect, options, speed, callback) {
  377. var args = _normalizeArguments.apply(this, arguments),
  378. // TODO: make effects takes actual parameters instead of a hash
  379. args2 = {
  380. options: args[1],
  381. duration: args[2],
  382. callback: args[3]
  383. },
  384. effectMethod = $.effects[effect];
  385. return effectMethod && !$.fx.off ? effectMethod.call(this, args2) : this;
  386. },
  387. _show: $.fn.show,
  388. show: function(speed) {
  389. if (!speed || typeof speed == 'number' || $.fx.speeds[speed]) {
  390. return this._show.apply(this, arguments);
  391. } else {
  392. var args = _normalizeArguments.apply(this, arguments);
  393. args[1].mode = 'show';
  394. return this.effect.apply(this, args);
  395. }
  396. },
  397. _hide: $.fn.hide,
  398. hide: function(speed) {
  399. if (!speed || typeof speed == 'number' || $.fx.speeds[speed]) {
  400. return this._hide.apply(this, arguments);
  401. } else {
  402. var args = _normalizeArguments.apply(this, arguments);
  403. args[1].mode = 'hide';
  404. return this.effect.apply(this, args);
  405. }
  406. },
  407. // jQuery core overloads toggle and create _toggle
  408. __toggle: $.fn.toggle,
  409. toggle: function(speed) {
  410. if (!speed || typeof speed == 'number' || $.fx.speeds[speed] ||
  411. typeof speed == 'boolean' || $.isFunction(speed)) {
  412. return this.__toggle.apply(this, arguments);
  413. } else {
  414. var args = _normalizeArguments.apply(this, arguments);
  415. args[1].mode = 'toggle';
  416. return this.effect.apply(this, args);
  417. }
  418. },
  419. // helper functions
  420. cssUnit: function(key) {
  421. var style = this.css(key), val = [];
  422. $.each( ['em','px','%','pt'], function(i, unit){
  423. if(style.indexOf(unit) > 0)
  424. val = [parseFloat(style), unit];
  425. });
  426. return val;
  427. }
  428. });
  429. /******************************************************************************/
  430. /*********************************** EASING ***********************************/
  431. /******************************************************************************/
  432. /*
  433. * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
  434. *
  435. * Uses the built in easing capabilities added In jQuery 1.1
  436. * to offer multiple easing options
  437. *
  438. * TERMS OF USE - jQuery Easing
  439. *
  440. * Open source under the BSD License.
  441. *
  442. * Copyright 2008 George McGinley Smith
  443. * All rights reserved.
  444. *
  445. * Redistribution and use in source and binary forms, with or without modification,
  446. * are permitted provided that the following conditions are met:
  447. *
  448. * Redistributions of source code must retain the above copyright notice, this list of
  449. * conditions and the following disclaimer.
  450. * Redistributions in binary form must reproduce the above copyright notice, this list
  451. * of conditions and the following disclaimer in the documentation and/or other materials
  452. * provided with the distribution.
  453. *
  454. * Neither the name of the author nor the names of contributors may be used to endorse
  455. * or promote products derived from this software without specific prior written permission.
  456. *
  457. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
  458. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  459. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  460. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  461. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  462. * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  463. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  464. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  465. * OF THE POSSIBILITY OF SUCH DAMAGE.
  466. *
  467. */
  468. // t: current time, b: begInnIng value, c: change In value, d: duration
  469. $.easing.jswing = $.easing.swing;
  470. $.extend($.easing,
  471. {
  472. def: 'easeOutQuad',
  473. swing: function (x, t, b, c, d) {
  474. //alert($.easing.default);
  475. return $.easing[$.easing.def](x, t, b, c, d);
  476. },
  477. easeInQuad: function (x, t, b, c, d) {
  478. return c*(t/=d)*t + b;
  479. },
  480. easeOutQuad: function (x, t, b, c, d) {
  481. return -c *(t/=d)*(t-2) + b;
  482. },
  483. easeInOutQuad: function (x, t, b, c, d) {
  484. if ((t/=d/2) < 1) return c/2*t*t + b;
  485. return -c/2 * ((--t)*(t-2) - 1) + b;
  486. },
  487. easeInCubic: function (x, t, b, c, d) {
  488. return c*(t/=d)*t*t + b;
  489. },
  490. easeOutCubic: function (x, t, b, c, d) {
  491. return c*((t=t/d-1)*t*t + 1) + b;
  492. },
  493. easeInOutCubic: function (x, t, b, c, d) {
  494. if ((t/=d/2) < 1) return c/2*t*t*t + b;
  495. return c/2*((t-=2)*t*t + 2) + b;
  496. },
  497. easeInQuart: function (x, t, b, c, d) {
  498. return c*(t/=d)*t*t*t + b;
  499. },
  500. easeOutQuart: function (x, t, b, c, d) {
  501. return -c * ((t=t/d-1)*t*t*t - 1) + b;
  502. },
  503. easeInOutQuart: function (x, t, b, c, d) {
  504. if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
  505. return -c/2 * ((t-=2)*t*t*t - 2) + b;
  506. },
  507. easeInQuint: function (x, t, b, c, d) {
  508. return c*(t/=d)*t*t*t*t + b;
  509. },
  510. easeOutQuint: function (x, t, b, c, d) {
  511. return c*((t=t/d-1)*t*t*t*t + 1) + b;
  512. },
  513. easeInOutQuint: function (x, t, b, c, d) {
  514. if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
  515. return c/2*((t-=2)*t*t*t*t + 2) + b;
  516. },
  517. easeInSine: function (x, t, b, c, d) {
  518. return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
  519. },
  520. easeOutSine: function (x, t, b, c, d) {
  521. return c * Math.sin(t/d * (Math.PI/2)) + b;
  522. },
  523. easeInOutSine: function (x, t, b, c, d) {
  524. return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
  525. },
  526. easeInExpo: function (x, t, b, c, d) {
  527. return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
  528. },
  529. easeOutExpo: function (x, t, b, c, d) {
  530. return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
  531. },
  532. easeInOutExpo: function (x, t, b, c, d) {
  533. if (t==0) return b;
  534. if (t==d) return b+c;
  535. if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
  536. return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
  537. },
  538. easeInCirc: function (x, t, b, c, d) {
  539. return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
  540. },
  541. easeOutCirc: function (x, t, b, c, d) {
  542. return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
  543. },
  544. easeInOutCirc: function (x, t, b, c, d) {
  545. if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
  546. return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
  547. },
  548. easeInElastic: function (x, t, b, c, d) {
  549. var s=1.70158;var p=0;var a=c;
  550. if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
  551. if (a < Math.abs(c)) { a=c; var s=p/4; }
  552. else var s = p/(2*Math.PI) * Math.asin (c/a);
  553. return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
  554. },
  555. easeOutElastic: function (x, t, b, c, d) {
  556. var s=1.70158;var p=0;var a=c;
  557. if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
  558. if (a < Math.abs(c)) { a=c; var s=p/4; }
  559. else var s = p/(2*Math.PI) * Math.asin (c/a);
  560. return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
  561. },
  562. easeInOutElastic: function (x, t, b, c, d) {
  563. var s=1.70158;var p=0;var a=c;
  564. if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
  565. if (a < Math.abs(c)) { a=c; var s=p/4; }
  566. else var s = p/(2*Math.PI) * Math.asin (c/a);
  567. if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
  568. return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
  569. },
  570. easeInBack: function (x, t, b, c, d, s) {
  571. if (s == undefined) s = 1.70158;
  572. return c*(t/=d)*t*((s+1)*t - s) + b;
  573. },
  574. easeOutBack: function (x, t, b, c, d, s) {
  575. if (s == undefined) s = 1.70158;
  576. return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
  577. },
  578. easeInOutBack: function (x, t, b, c, d, s) {
  579. if (s == undefined) s = 1.70158;
  580. if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
  581. return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
  582. },
  583. easeInBounce: function (x, t, b, c, d) {
  584. return c - $.easing.easeOutBounce (x, d-t, 0, c, d) + b;
  585. },
  586. easeOutBounce: function (x, t, b, c, d) {
  587. if ((t/=d) < (1/2.75)) {
  588. return c*(7.5625*t*t) + b;
  589. } else if (t < (2/2.75)) {
  590. return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
  591. } else if (t < (2.5/2.75)) {
  592. return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
  593. } else {
  594. return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
  595. }
  596. },
  597. easeInOutBounce: function (x, t, b, c, d) {
  598. if (t < d/2) return $.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
  599. return $.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
  600. }
  601. });
  602. /*
  603. *
  604. * TERMS OF USE - EASING EQUATIONS
  605. *
  606. * Open source under the BSD License.
  607. *
  608. * Copyright 2001 Robert Penner
  609. * All rights reserved.
  610. *
  611. * Redistribution and use in source and binary forms, with or without modification,
  612. * are permitted provided that the following conditions are met:
  613. *
  614. * Redistributions of source code must retain the above copyright notice, this list of
  615. * conditions and the following disclaimer.
  616. * Redistributions in binary form must reproduce the above copyright notice, this list
  617. * of conditions and the following disclaimer in the documentation and/or other materials
  618. * provided with the distribution.
  619. *
  620. * Neither the name of the author nor the names of contributors may be used to endorse
  621. * or promote products derived from this software without specific prior written permission.
  622. *
  623. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
  624. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  625. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  626. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  627. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  628. * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  629. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  630. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  631. * OF THE POSSIBILITY OF SUCH DAMAGE.
  632. *
  633. */
  634. })(jQuery);