first commit
[wnstats.git] / public / javascripts / jqplot / examples / jquery-ui / js / jquery.effects.core.js
blobab9349a8d4df0f05cc3a2e6dcddcd739d88f83f1
1 /*
2  * jQuery UI Effects 1.9pre
3  *
4  * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
5  * Dual licensed under the MIT or GPL Version 2 licenses.
6  * http://jquery.org/license
7  *
8  * http://docs.jquery.com/UI/Effects/
9  */
10 ;jQuery.effects || (function($, undefined) {
12 var backCompat = $.uiBackCompat !== false;
14 $.effects = {
15         effect: {}
18 /******************************************************************************/
19 /****************************** COLOR ANIMATIONS ******************************/
20 /******************************************************************************/
22 // override the animation for color styles
23 $.each(["backgroundColor", "borderBottomColor", "borderLeftColor",
24         "borderRightColor", "borderTopColor", "borderColor", "color", "outlineColor"],
25 function(i, attr) {
26         $.fx.step[attr] = function(fx) {
27                 if (!fx.colorInit) {
28                         fx.start = getColor(fx.elem, attr);
29                         fx.end = getRGB(fx.end);
30                         fx.colorInit = true;
31                 }
33                 fx.elem.style[attr] = "rgb(" +
34                         Math.max(Math.min(parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0], 10), 255), 0) + "," +
35                         Math.max(Math.min(parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1], 10), 255), 0) + "," +
36                         Math.max(Math.min(parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2], 10), 255), 0) + ")";
37         };
38 });
40 // Color Conversion functions from highlightFade
41 // By Blair Mitchelmore
42 // http://jquery.offput.ca/highlightFade/
44 // Parse strings looking for color tuples [255,255,255]
45 function getRGB(color) {
46                 var result;
48                 // Check if we're already dealing with an array of colors
49                 if ( color && color.constructor === Array && color.length === 3 )
50                                 return color;
52                 // Look for rgb(num,num,num)
53                 if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
54                                 return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)];
56                 // Look for rgb(num%,num%,num%)
57                 if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
58                                 return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
60                 // Look for #a0b1c2
61                 if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
62                                 return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
64                 // Look for #fff
65                 if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
66                                 return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
68                 // Look for rgba(0, 0, 0, 0) == transparent in Safari 3
69                 if (result = /rgba\(0, 0, 0, 0\)/.exec(color))
70                                 return colors["transparent"];
72                 // Otherwise, we're most likely dealing with a named color
73                 return colors[$.trim(color).toLowerCase()];
76 function getColor(elem, attr) {
77                 var color;
79                 do {
80                                 color = $.curCSS(elem, attr);
82                                 // Keep going until we find an element that has color, or we hit the body
83                                 if ( color != "" && color !== "transparent" || $.nodeName(elem, "body") )
84                                                 break;
86                                 attr = "backgroundColor";
87                 } while ( elem = elem.parentNode );
89                 return getRGB(color);
92 // Some named colors to work with
93 // From Interface by Stefan Petre
94 // http://interface.eyecon.ro/
96 var colors = {
97         aqua:[0,255,255],
98         azure:[240,255,255],
99         beige:[245,245,220],
100         black:[0,0,0],
101         blue:[0,0,255],
102         brown:[165,42,42],
103         cyan:[0,255,255],
104         darkblue:[0,0,139],
105         darkcyan:[0,139,139],
106         darkgrey:[169,169,169],
107         darkgreen:[0,100,0],
108         darkkhaki:[189,183,107],
109         darkmagenta:[139,0,139],
110         darkolivegreen:[85,107,47],
111         darkorange:[255,140,0],
112         darkorchid:[153,50,204],
113         darkred:[139,0,0],
114         darksalmon:[233,150,122],
115         darkviolet:[148,0,211],
116         fuchsia:[255,0,255],
117         gold:[255,215,0],
118         green:[0,128,0],
119         indigo:[75,0,130],
120         khaki:[240,230,140],
121         lightblue:[173,216,230],
122         lightcyan:[224,255,255],
123         lightgreen:[144,238,144],
124         lightgrey:[211,211,211],
125         lightpink:[255,182,193],
126         lightyellow:[255,255,224],
127         lime:[0,255,0],
128         magenta:[255,0,255],
129         maroon:[128,0,0],
130         navy:[0,0,128],
131         olive:[128,128,0],
132         orange:[255,165,0],
133         pink:[255,192,203],
134         purple:[128,0,128],
135         violet:[128,0,128],
136         red:[255,0,0],
137         silver:[192,192,192],
138         white:[255,255,255],
139         yellow:[255,255,0],
140         transparent: [255,255,255]
145 /******************************************************************************/
146 /****************************** CLASS ANIMATIONS ******************************/
147 /******************************************************************************/
149 var classAnimationActions = [ "add", "remove", "toggle" ],
150         shorthandStyles = {
151                 border: 1,
152                 borderBottom: 1,
153                 borderColor: 1,
154                 borderLeft: 1,
155                 borderRight: 1,
156                 borderTop: 1,
157                 borderWidth: 1,
158                 margin: 1,
159                 padding: 1
160         },
161         // prefix used for storing data on .data()
162         dataSpace = "ec.storage.";
164 $.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function( _, prop ) {
165         $.fx.step[ prop ] = function( fx ) {
166                 if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) {
167                         jQuery.style( fx.elem, prop, fx.end );
168                         fx.setAttr = true;
169                 }
170         };
173 function getElementStyles() {
174         var style = this.ownerDocument.defaultView
175                         ? this.ownerDocument.defaultView.getComputedStyle( this, null )
176                         : this.currentStyle,
177                 newStyle = {},
178                 key,
179                 camelCase,
180                 len;
182         // webkit enumerates style porperties
183         if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) {
184                 len = style.length;
185                 while ( len-- ) {
186                         key = style[ len ];
187                         if ( typeof style[ key ] === "string" ) {
188                                 newStyle[ $.camelCase( key ) ] = style[ key ];
189                         }
190                 }
191         } else {
192                 for ( key in style ) {
193                         if ( typeof style[ key ] === "string" ) {
194                                 newStyle[ key ] = style[ key ];
195                         }
196                 }
197         }
199         return newStyle;
203 function styleDifference( oldStyle, newStyle ) {
204         var diff = {},
205                 name, value;
207         for ( name in newStyle ) {
208                 value = newStyle[ name ];
209                 if ( oldStyle[ name ] != value ) {
210                         if ( !shorthandStyles[ name ] ) {
211                                 if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) {
212                                         diff[ name ] = value;
213                                 }
214                         }
215                 }
216         }
218         return diff;
221 $.effects.animateClass = function( value, duration, easing, callback ) {
222         var o = $.speed( duration, easing, callback );
224         return this.queue( function() {
225                 var animated = $( this ),
226                         baseClass = animated.attr( "class" ) || "",
227                         finalClass,
228                         allAnimations = o.children ? animated.find( "*" ).andSelf() : animated;
230                 // map the animated objects to store the original styles.
231                 allAnimations = allAnimations.map(function() {
232                         var el = $( this );
233                         return {
234                                 el: el,
235                                 originalStyleAttr: el.attr( "style" ) || " ",
236                                 start: getElementStyles.call( this )
237                         };
238                 });
240                 // apply class change
241                 $.each( classAnimationActions, function(i, action) {
242                         if ( value[ action ] ) {
243                                 animated[ action + "Class" ]( value[ action ] );
244                         }
245                 });
246                 finalClass = animated.attr( "class" );
248                 // map all animated objects again - calculate new styles and diff
249                 allAnimations = allAnimations.map(function() {
250                         this.end = getElementStyles.call( this.el[ 0 ] );
251                         this.diff = styleDifference( this.start, this.end );
252                         return this;
253                 });
255                 // apply original class
256                 animated.attr( "class", baseClass );
258                 // map all animated objects again - this time collecting a promise
259                 allAnimations = allAnimations.map(function() {
260                         var styleInfo = this,
261                                 dfd = $.Deferred();
263                         this.el.animate( this.diff, {
264                                 duration: o.duration,
265                                 easing: o.easing,
266                                 queue: false,
267                                 complete: function() {
268                                         dfd.resolve( styleInfo );
269                                 }
270                         });
271                         return dfd.promise();
272                 });
274                 // once all animations have completed:
275                 $.when.apply( $, allAnimations.get() ).done(function() {
277                         // set the final class
278                         animated.attr( "class", finalClass );
280                         // for each animated element
281                         $.each( arguments, function() {
282                                 if ( typeof this.el.attr( "style" ) === "object" ) {
283                                         this.el.attr( "style" ).cssText = "";
284                                         this.el.attr( "style" ).cssText = this.originalStyleAttr;
285                                 } else {
286                                         this.el.attr( "style", this.originalStyleAttr );
287                                 }
288                         });
290                         // this is guarnteed to be there if you use jQuery.speed()
291                         // it also handles dequeuing the next anim...
292                         o.complete.call( animated[ 0 ] );
293                 });
294         });
297 $.fn.extend({
298         _addClass: $.fn.addClass,
299         addClass: function( classNames, speed, easing, callback ) {
300                 return speed ?
301                         $.effects.animateClass.apply( this, [{ add: classNames }, speed, easing, callback ]) :
302                         this._addClass(classNames);
303         },
305         _removeClass: $.fn.removeClass,
306         removeClass: function( classNames, speed, easing, callback ) {
307                 return speed ?
308                         $.effects.animateClass.apply( this, [{ remove: classNames }, speed, easing, callback ]) :
309                         this._removeClass(classNames);
310         },
312         _toggleClass: $.fn.toggleClass,
313         toggleClass: function( classNames, force, speed, easing, callback ) {
314                 if ( typeof force === "boolean" || force === undefined ) {
315                         if ( !speed ) {
316                                 // without speed parameter;
317                                 return this._toggleClass( classNames, force );
318                         } else {
319                                 return $.effects.animateClass.apply( this, [( force ? { add:classNames } : { remove:classNames }), speed, easing, callback ]);
320                         }
321                 } else {
322                         // without force parameter;
323                         return $.effects.animateClass.apply( this, [{ toggle: classNames }, force, speed, easing ]);
324                 }
325         },
327         switchClass: function( remove, add, speed, easing, callback) {
328                 return $.effects.animateClass.apply( this, [{
329                                 add: add,
330                                 remove: remove
331                         }, speed, easing, callback ]);
332         }
337 /******************************************************************************/
338 /*********************************** EFFECTS **********************************/
339 /******************************************************************************/
341 $.extend( $.effects, {
342         version: "1.9pre",
344         // Saves a set of properties in a data storage
345         save: function( element, set ) {
346                 for( var i=0; i < set.length; i++ ) {
347                         if ( set[ i ] !== null ) {
348                                 element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] );
349                         }
350                 }
351         },
353         // Restores a set of previously saved properties from a data storage
354         restore: function( element, set ) {
355                 for( var i=0; i < set.length; i++ ) {
356                         if ( set[ i ] !== null ) {
357                                 element.css( set[ i ], element.data( dataSpace + set[ i ] ) );
358                         }
359                 }
360         },
362         setMode: function( el, mode ) {
363                 if (mode === "toggle") {
364                         mode = el.is( ":hidden" ) ? "show" : "hide";
365                 }
366                 return mode;
367         },
369         // Translates a [top,left] array into a baseline value
370         // this should be a little more flexible in the future to handle a string & hash
371         getBaseline: function( origin, original ) {
372                 var y, x;
373                 switch ( origin[ 0 ] ) {
374                         case "top": y = 0; break;
375                         case "middle": y = 0.5; break;
376                         case "bottom": y = 1; break;
377                         default: y = origin[ 0 ] / original.height;
378                 };
379                 switch ( origin[ 1 ] ) {
380                         case "left": x = 0; break;
381                         case "center": x = 0.5; break;
382                         case "right": x = 1; break;
383                         default: x = origin[ 1 ] / original.width;
384                 };
385                 return {
386                         x: x,
387                         y: y
388                 };
389         },
391         // Wraps the element around a wrapper that copies position properties
392         createWrapper: function( element ) {
394                 // if the element is already wrapped, return it
395                 if ( element.parent().is( ".ui-effects-wrapper" )) {
396                         return element.parent();
397                 }
399                 // wrap the element
400                 var props = {
401                                 width: element.outerWidth(true),
402                                 height: element.outerHeight(true),
403                                 "float": element.css( "float" )
404                         },
405                         wrapper = $( "<div></div>" )
406                                 .addClass( "ui-effects-wrapper" )
407                                 .css({
408                                         fontSize: "100%",
409                                         background: "transparent",
410                                         border: "none",
411                                         margin: 0,
412                                         padding: 0
413                                 }),
414                         // Store the size in case width/height are defined in % - Fixes #5245
415                         size = {
416                                 width: element.width(),
417                                 height: element.height()
418                         },
419                         active = document.activeElement;
421                 element.wrap( wrapper );
423                 // Fixes #7595 - Elements lose focus when wrapped.
424                 if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
425                         $( active ).focus();
426                 }
428                 wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually loose the reference to the wrapped element
430                 // transfer positioning properties to the wrapper
431                 if ( element.css( "position" ) === "static" ) {
432                         wrapper.css({ position: "relative" });
433                         element.css({ position: "relative" });
434                 } else {
435                         $.extend( props, {
436                                 position: element.css( "position" ),
437                                 zIndex: element.css( "z-index" )
438                         });
439                         $.each([ "top", "left", "bottom", "right" ], function(i, pos) {
440                                 props[ pos ] = element.css( pos );
441                                 if ( isNaN( parseInt( props[ pos ], 10 ) ) ) {
442                                         props[ pos ] = "auto";
443                                 }
444                         });
445                         element.css({
446                                 position: "relative",
447                                 top: 0,
448                                 left: 0,
449                                 right: "auto",
450                                 bottom: "auto"
451                         });
452                 }
453                 element.css(size);
455                 return wrapper.css( props ).show();
456         },
458         removeWrapper: function( element ) {
459                 var active = document.activeElement;
461                 if ( element.parent().is( ".ui-effects-wrapper" ) ) {
462                         element.parent().replaceWith( element );
464                         // Fixes #7595 - Elements lose focus when wrapped.
465                         if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
466                                 $( active ).focus();
467                         }
468                 }
471                 return element;
472         },
474         setTransition: function( element, list, factor, value ) {
475                 value = value || {};
476                 $.each( list, function(i, x){
477                         var unit = element.cssUnit( x );
478                         if ( unit[ 0 ] > 0 ) value[ x ] = unit[ 0 ] * factor + unit[ 1 ];
479                 });
480                 return value;
481         }
484 // return an effect options object for the given parameters:
485 function _normalizeArguments( effect, options, speed, callback ) {
487         // short path for passing an effect options object:
488         if ( $.isPlainObject( effect ) ) {
489                 return effect;
490         }
492         // convert to an object
493         effect = { effect: effect };
495         // catch (effect)
496         if ( options === undefined ) {
497                 options = {};
498         }
500         // catch (effect, callback)
501         if ( $.isFunction( options ) ) {
502                 callback = options;
503                 speed = null;
504                 options = {};
505         }
507         // catch (effect, speed, ?)
508         if ( $.type( options ) === "number" || $.fx.speeds[ options ]) {
509                 callback = speed;
510                 speed = options;
511                 options = {};
512         }
514         // catch (effect, options, callback)
515         if ( $.isFunction( speed ) ) {
516                 callback = speed;
517                 speed = null;
518         }
520         // add options to effect
521         if ( options ) {
522                 $.extend( effect, options );
523         }
525         speed = speed || options.duration;
526         effect.duration = $.fx.off ? 0 : typeof speed === "number"
527                 ? speed : speed in $.fx.speeds ? $.fx.speeds[ speed ] : $.fx.speeds._default;
529         effect.complete = callback || options.complete;
531         return effect;
534 function standardSpeed( speed ) {
535         // valid standard speeds
536         if ( !speed || typeof speed === "number" || $.fx.speeds[ speed ] ) {
537                 return true;
538         }
540         // invalid strings - treat as "normal" speed
541         if ( typeof speed === "string" && !$.effects.effect[ speed ] ) {
542                 // TODO: remove in 2.0 (#7115)
543                 if ( backCompat && $.effects[ speed ] ) {
544                         return false;
545                 }
546                 return true;
547         }
549         return false;
552 $.fn.extend({
553         effect: function( effect, options, speed, callback ) {
554                 var args = _normalizeArguments.apply( this, arguments ),
555                         mode = args.mode,
556                         queue = args.queue,
557                         effectMethod = $.effects.effect[ args.effect ],
559                         // DEPRECATED: remove in 2.0 (#7115)
560                         oldEffectMethod = !effectMethod && backCompat && $.effects[ args.effect ];
562                 if ( $.fx.off || !( effectMethod || oldEffectMethod ) ) {
563                         // delegate to the original method (e.g., .show()) if possible
564                         if ( mode ) {
565                                 return this[ mode ]( args.duration, args.complete );
566                         } else {
567                                 return this.each( function() {
568                                         if ( args.complete ) {
569                                                 args.complete.call( this );
570                                         }
571                                 });
572                         }
573                 }
575                 function run( next ) {
576                         var elem = $( this ),
577                                 complete = args.complete,
578                                 mode = args.mode;
580                         function done() {
581                                 if ( $.isFunction( complete ) ) {
582                                         complete.call( elem[0] );
583                                 }
584                                 if ( $.isFunction( next ) ) {
585                                         next();
586                                 }
587                         }
589                         // if the element is hiddden and mode is hide,
590                         // or element is visible and mode is show
591                         if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) {
592                                 done();
593                         } else {
594                                 effectMethod.call( elem[0], args, done );
595                         }
596                 }
598                 // TODO: remove this check in 2.0, effectMethod will always be true
599                 if ( effectMethod ) {
600                         return queue === false ? this.each( run ) : this.queue( queue || "fx", run );
601                 } else {
602                         // DEPRECATED: remove in 2.0 (#7115)
603                         return oldEffectMethod.call(this, {
604                                 options: args,
605                                 duration: args.duration,
606                                 callback: args.complete,
607                                 mode: args.mode
608                         });
609                 }
610         },
612         _show: $.fn.show,
613         show: function( speed ) {
614                 if ( standardSpeed( speed ) ) {
615                         return this._show.apply( this, arguments );
616                 } else {
617                         var args = _normalizeArguments.apply( this, arguments );
618                         args.mode = "show";
619                         return this.effect.call( this, args );
620                 }
621         },
623         _hide: $.fn.hide,
624         hide: function( speed ) {
625                 if ( standardSpeed( speed ) ) {
626                         return this._hide.apply( this, arguments );
627                 } else {
628                         var args = _normalizeArguments.apply( this, arguments );
629                         args.mode = "hide";
630                         return this.effect.call( this, args );
631                 }
632         },
634         // jQuery core overloads toggle and creates _toggle
635         __toggle: $.fn.toggle,
636         toggle: function( speed ) {
637                 if ( standardSpeed( speed ) || typeof speed === "boolean" || $.isFunction( speed ) ) {
638                         return this.__toggle.apply( this, arguments );
639                 } else {
640                         var args = _normalizeArguments.apply( this, arguments );
641                         args.mode = "toggle";
642                         return this.effect.call( this, args );
643                 }
644         },
646         // helper functions
647         cssUnit: function(key) {
648                 var style = this.css( key ),
649                         val = [];
651                 $.each( [ "em", "px", "%", "pt" ], function( i, unit ) {
652                         if ( style.indexOf( unit ) > 0 )
653                                 val = [ parseFloat( style ), unit ];
654                 });
655                 return val;
656         }
661 /******************************************************************************/
662 /*********************************** EASING ***********************************/
663 /******************************************************************************/
666  * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
668  * Uses the built in easing capabilities added In jQuery 1.1
669  * to offer multiple easing options
671  * TERMS OF USE - jQuery Easing
673  * Open source under the BSD License.
675  * Copyright 2008 George McGinley Smith
676  * All rights reserved.
678  * Redistribution and use in source and binary forms, with or without modification,
679  * are permitted provided that the following conditions are met:
681  * Redistributions of source code must retain the above copyright notice, this list of
682  * conditions and the following disclaimer.
683  * Redistributions in binary form must reproduce the above copyright notice, this list
684  * of conditions and the following disclaimer in the documentation and/or other materials
685  * provided with the distribution.
687  * Neither the name of the author nor the names of contributors may be used to endorse
688  * or promote products derived from this software without specific prior written permission.
690  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
691  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
692  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
693  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
694  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
695  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
696  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
697  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
698  * OF THE POSSIBILITY OF SUCH DAMAGE.
702 // t: current time, b: begInnIng value, c: change In value, d: duration
703 $.easing.jswing = $.easing.swing;
705 $.extend( $.easing, {
706         def: "easeOutQuad",
707         swing: function ( x, t, b, c, d ) {
708                 return $.easing[ $.easing.def ]( x, t, b, c, d );
709         },
710         easeInQuad: function ( x, t, b, c, d ) {
711                 return c * ( t /= d ) * t + b;
712         },
713         easeOutQuad: function ( x, t, b, c, d ) {
714                 return -c * ( t /= d ) * ( t - 2 ) + b;
715         },
716         easeInOutQuad: function ( x, t, b, c, d ) {
717                 if ( ( t /= d / 2 ) < 1 ) return c / 2 * t * t + b;
718                 return -c / 2 * ( ( --t ) * ( t-2 ) - 1) + b;
719         },
720         easeInCubic: function ( x, t, b, c, d ) {
721                 return c * ( t /= d ) * t * t + b;
722         },
723         easeOutCubic: function ( x, t, b, c, d ) {
724                 return c * ( ( t = t / d - 1 ) * t * t + 1 ) + b;
725         },
726         easeInOutCubic: function ( x, t, b, c, d ) {
727                 if ( ( t /= d / 2 ) < 1 ) return c / 2 * t * t * t + b;
728                 return c / 2 * ( ( t -= 2 ) * t * t + 2) + b;
729         },
730         easeInQuart: function ( x, t, b, c, d ) {
731                 return c * ( t /= d ) * t * t * t + b;
732         },
733         easeOutQuart: function ( x, t, b, c, d ) {
734                 return -c * ( ( t = t / d - 1 ) * t * t * t - 1) + b;
735         },
736         easeInOutQuart: function ( x, t, b, c, d ) {
737                 if ( (t /= d / 2 ) < 1 ) return c / 2 * t * t * t * t + b;
738                 return -c / 2 * ( ( t -= 2 ) * t * t * t - 2) + b;
739         },
740         easeInQuint: function ( x, t, b, c, d ) {
741                 return c * ( t /= d ) * t * t * t * t + b;
742         },
743         easeOutQuint: function ( x, t, b, c, d ) {
744                 return c * ( ( t = t / d - 1 ) * t * t * t * t + 1) + b;
745         },
746         easeInOutQuint: function ( x, t, b, c, d ) {
747                 if ( ( t /= d / 2 ) < 1 ) return c / 2 * t * t  * t * t * t + b;
748                 return c / 2 * ( ( t -= 2 ) * t * t * t * t + 2) + b;
749         },
750         easeInSine: function ( x, t, b, c, d ) {
751                 return -c * Math.cos( t / d * ( Math.PI / 2 ) ) + c + b;
752         },
753         easeOutSine: function ( x, t, b, c, d ) {
754                 return c * Math.sin( t / d * ( Math.PI /2 ) ) + b;
755         },
756         easeInOutSine: function ( x, t, b, c, d ) {
757                 return -c / 2 * ( Math.cos( Math.PI * t / d ) - 1 ) + b;
758         },
759         easeInExpo: function ( x, t, b, c, d ) {
760                 return ( t==0 ) ? b : c * Math.pow( 2, 10 * ( t / d - 1) ) + b;
761         },
762         easeOutExpo: function ( x, t, b, c, d ) {
763                 return ( t==d ) ? b + c : c * ( -Math.pow( 2, -10 * t / d) + 1) + b;
764         },
765         easeInOutExpo: function ( x, t, b, c, d ) {
766                 if ( t==0 ) return b;
767                 if ( t==d ) return b + c;
768                 if ( ( t /= d / 2) < 1) return c / 2 * Math.pow( 2, 10 * (t - 1) ) + b;
769                 return c / 2 * ( -Math.pow( 2, -10 * --t ) + 2 ) + b;
770         },
771         easeInCirc: function ( x, t, b, c, d ) {
772                 return -c * ( Math.sqrt( 1 - ( t /= d ) * t ) - 1 ) + b;
773         },
774         easeOutCirc: function ( x, t, b, c, d ) {
775                 return c * Math.sqrt( 1 - ( t = t / d - 1 ) * t ) + b;
776         },
777         easeInOutCirc: function ( x, t, b, c, d ) {
778                 if ( ( t /= d / 2) < 1 ) return -c / 2 * ( Math.sqrt( 1 - t * t ) - 1 ) + b;
779                 return c / 2 * ( Math.sqrt( 1 - ( t -= 2 ) * t ) + 1 ) + b;
780         },
781         easeInElastic: function ( x, t, b, c, d ) {
782                 var s = 1.70158,
783                         p = d * 0.3,
784                         a = c;
785                 if ( t == 0 ) return b;
786                 if ( ( t /= d ) == 1 ) return b+c;
787                 if ( a < Math.abs( c ) ) {
788                         a = c;
789                         s = p / 4;
790                 } else {
791                         s = p / ( 2 * Math.PI ) * Math.asin( c / a );
792                 }
793                 return - ( a * Math.pow( 2, 10 * ( t -= 1 ) ) * Math.sin( ( t * d - s) * ( 2 * Math.PI ) / p ) ) + b;
794         },
795         easeOutElastic: function ( x, t, b, c, d ) {
796                 var s = 1.70158,
797                         p = d * 0.3,
798                         a = c;
799                 if ( t == 0 ) return b;
800                 if ( ( t /= d ) == 1 ) return b+c;
801                 if ( a < Math.abs( c ) ) {
802                         a = c;
803                         s = p / 4;
804                 } else {
805                         s = p / ( 2 * Math.PI ) * Math.asin( c / a );
806                 }
807                 return a * Math.pow( 2, -10 * t ) * Math.sin( ( t * d - s ) * ( 2 * Math.PI ) / p ) + c + b;
808         },
809         easeInOutElastic: function ( x, t, b, c, d ) {
810                 var s = 1.70158,
811                         p = d * ( 0.3 * 1.5 ),
812                         a = c;
813                 if ( t == 0 ) return b;
814                 if ( ( t /= d / 2 ) == 2 ) return b+c;
815                 if ( a < Math.abs( c ) ) {
816                         a = c;
817                         s = p / 4;
818                 } else {
819                         s = p / ( 2 * Math.PI ) * Math.asin( c / a );
820                 }
821                 if ( t < 1 ) return -.5 * ( a * Math.pow( 2, 10 * ( t -= 1 ) ) * Math.sin( ( t * d - s ) * ( 2 * Math.PI ) / p ) ) + b;
822                 return a * Math.pow( 2, -10 * ( t -= 1 ) ) * Math.sin( ( t * d - s ) * ( 2 * Math.PI ) / p ) *.5 + c + b;
823         },
824         easeInBack: function ( x, t, b, c, d, s ) {
825                 if ( s == undefined ) s = 1.70158;
826                 return c * ( t /= d ) * t * ( ( s+1 ) * t - s ) + b;
827         },
828         easeOutBack: function ( x, t, b, c, d, s ) {
829                 if ( s == undefined ) s = 1.70158;
830                 return c * ( ( t = t / d - 1 ) * t * ( ( s + 1 ) * t + s) + 1) + b;
831         },
832         easeInOutBack: function ( x, t, b, c, d, s ) {
833                 if ( s == undefined ) s = 1.70158;
834                 if ( ( t /= d / 2 ) < 1 ) return c / 2 * ( t * t * ( ( ( s *= 1.525 ) + 1 ) * t - s ) ) + b;
835                 return c / 2 * ( ( t -= 2 ) * t * ( ( ( s *= 1.525 ) + 1 ) * t + s) + 2) + b;
836         },
837         easeInBounce: function ( x, t, b, c, d ) {
838                 return c - $.easing.easeOutBounce( x, d - t, 0, c, d ) + b;
839         },
840         easeOutBounce: function ( x, t, b, c, d ) {
841                 if ( ( t /= d ) < ( 1 / 2.75 ) ) {
842                         return c * ( 7.5625 * t * t ) + b;
843                 } else if ( t < ( 2 / 2.75 ) ) {
844                         return c * ( 7.5625 * ( t -= ( 1.5 / 2.75 ) ) * t + .75 ) + b;
845                 } else if ( t < ( 2.5 / 2.75 ) ) {
846                         return c * ( 7.5625 * ( t -= ( 2.25/ 2.75 ) ) * t + .9375 ) + b;
847                 } else {
848                         return c * ( 7.5625 * ( t -= ( 2.625 / 2.75 ) ) * t + .984375 ) + b;
849                 }
850         },
851         easeInOutBounce: function ( x, t, b, c, d ) {
852                 if ( t < d / 2 ) return $.easing.easeInBounce( x, t * 2, 0, c, d ) * .5 + b;
853                 return $.easing.easeOutBounce( x, t * 2 - d, 0, c, d ) * .5 + c * .5 + b;
854         }
859  * TERMS OF USE - EASING EQUATIONS
861  * Open source under the BSD License.
863  * Copyright 2001 Robert Penner
864  * All rights reserved.
866  * Redistribution and use in source and binary forms, with or without modification,
867  * are permitted provided that the following conditions are met:
869  * Redistributions of source code must retain the above copyright notice, this list of
870  * conditions and the following disclaimer.
871  * Redistributions in binary form must reproduce the above copyright notice, this list
872  * of conditions and the following disclaimer in the documentation and/or other materials
873  * provided with the distribution.
875  * Neither the name of the author nor the names of contributors may be used to endorse
876  * or promote products derived from this software without specific prior written permission.
878  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
879  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
880  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
881  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
882  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
883  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
884  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
885  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
886  * OF THE POSSIBILITY OF SUCH DAMAGE.
888  */
890 })(jQuery);