123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870 |
- (function( jQuery ) {
- var elemdisplay = {},
- iframe, iframeDoc,
- rfxtypes = /^(?:toggle|show|hide)$/,
- rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,
-
- timerId,
-
- fxNow;
- var div = document.createElement( "div" ),
- divStyle = div.style,
- trans = "Transition",
- _cubicBezier = "cubic-bezier(",
- easingTable;
- jQuery.support.transition =
- "Moz" + trans in divStyle ? "Moz" + trans :
- "Webkit" + trans in divStyle ? "Webkit" + trans :
- false;
- jQuery.cssNumber.color = jQuery.cssNumber.backgroundColor = true;
- easingTable = {
- linear: "linear",
- swing: "ease-out",
- bounce: _cubicBezier + "0,.35,.5,1.3)",
-
- easeInQuad: _cubicBezier + ".55,.085,.68,.53)",
- easeInCubic: _cubicBezier + ".55,.055,.675,.19)",
- easeInQuart: _cubicBezier + ".895,.03,.685,.22)",
- easeInQuint: _cubicBezier + ".755,.05,.855,.06)",
- easeInSine: _cubicBezier + ".47,0,.745,.715)",
- easeInExpo: _cubicBezier + ".95,.05,.795,.035)",
- easeInCirc: _cubicBezier + ".6,.04,.98,.335)",
- easeOutQuad: _cubicBezier + ".25,.46,.45,.94)",
- easeOutCubic: _cubicBezier + ".215,.61,.355,1)",
- easeOutQuart: _cubicBezier + ".165,.84,.44,1)",
- easeOutQuint: _cubicBezier + ".23,1,.32,1)",
- easeOutSine: _cubicBezier + ".39,.575,.565,1)",
- easeOutExpo: _cubicBezier + ".19,1,.22,1)",
- easeOutCirc: _cubicBezier + ".075,.82,.165,1)",
- easeInOutQuad: _cubicBezier + ".455,.03,.515,.955)",
- easeInOutCubic: _cubicBezier + ".645,.045,.355,1)",
- easeInOutQuart: _cubicBezier + ".77,0,.175,1)",
- easeInOutQuint: _cubicBezier + ".86,0,.07,1)",
- easeInOutSine: _cubicBezier + ".445,.05,.55,.95)",
- easeInOutExpo: _cubicBezier + "1,0,0,1)",
- easeInOutCirc: _cubicBezier + ".785,.135,.15,.86)"
- };
- jQuery.fn.extend({
-
- animate: function( prop, speed, easing, callback ) {
- var optall = jQuery.speed( speed, easing, callback );
- if ( jQuery.isEmptyObject( prop ) ) {
- return this.each( optall.complete, [ false ] );
- }
-
- prop = jQuery.extend( {}, prop );
- function doAnimation() {
-
-
- if ( optall.queue === false ) {
- jQuery._mark( this );
- }
- var opt = jQuery.extend( {}, optall ),
- isElement = this.nodeType === 1,
- hidden = isElement && jQuery(this).is(":hidden"),
- name, val, p, e, hooks, replace,
- parts, start, end, unit,
- method,
-
- cssProps = jQuery.cssProps,
-
- supportTransition = !opt.step && jQuery.support.transition,
- transition,
- transitions = [],
- easing, real, lower,
- computedStyle;
-
- opt.animatedProperties = {};
-
-
-
-
- opt.transition = {};
-
- for ( p in prop ) {
- name = jQuery.camelCase( p );
- if ( p !== name ) {
- prop[ name ] = prop[ p ];
- delete prop[ p ];
- }
- if ( ( hooks = jQuery.cssHooks[ name ] ) && "expand" in hooks ) {
- replace = hooks.expand( prop[ name ] );
- delete prop[ name ];
-
-
- for ( p in replace ) {
- if ( ! ( p in prop ) ) {
- prop[ p ] = replace[ p ];
- }
- }
- }
- }
- for ( name in prop ) {
- val = prop[ name ];
-
- if ( jQuery.isArray( val ) ) {
- easing = opt.animatedProperties[ name ] = val[ 1 ];
- val = prop[ name ] = val[ 0 ];
- } else {
- easing = opt.animatedProperties[ name ] = opt.specialEasing && opt.specialEasing[ name ] || opt.easing || "swing";
- }
-
-
- transition = supportTransition && isElement && opt.duration > 0 && name.indexOf( "scroll" ) && easingTable[ easing ];
-
- if ( transition ) {
- real = cssProps[ name ] || name;
- lower = real.replace(/([A-Z])/g, '-$1').toLowerCase();
- transition =
- lower +" "+
- opt.duration +"ms "+
- transition;
- opt.transition[ name ] = {
- lower: lower,
- real: real
- };
- transitions.push(transition);
- }
- if ( val === "hide" && hidden || val === "show" && !hidden ) {
- return opt.complete.call( this );
- }
- if ( isElement && ( name === "height" || name === "width" ) ) {
-
-
-
-
- opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];
-
-
- if ( jQuery.css( this, "display" ) === "inline" &&
- jQuery.css( this, "float" ) === "none" ) {
-
-
- if ( !jQuery.support.inlineBlockNeedsLayout || defaultDisplay( this.nodeName ) === "inline" ) {
- this.style.display = "inline-block";
- } else {
- this.style.zoom = 1;
- }
- }
- }
- }
- if ( opt.overflow != null ) {
- this.style.overflow = "hidden";
- }
- for ( p in prop ) {
- e = new jQuery.fx( this, opt, p );
- val = prop[ p ];
- if ( rfxtypes.test( val ) ) {
-
-
- method = jQuery._data( this, "toggle" + p ) || ( val === "toggle" ? hidden ? "show" : "hide" : 0 );
- if ( method ) {
- jQuery._data( this, "toggle" + p, method === "show" ? "hide" : "show" );
- e[ method ]();
- } else {
- e[ val ]();
- }
- } else {
- parts = rfxnum.exec( val );
- start = e.cur();
- if ( parts ) {
- end = parseFloat( parts[2] );
- unit = parts[3] || ( jQuery.cssNumber[ p ] ? "" : "px" );
-
- if ( unit !== "px" && p !== "opacity" ) {
- jQuery.style( this, p, (end || 1) + unit);
- start = ( (end || 1) / e.cur() ) * start;
- jQuery.style( this, p, start + unit);
- }
-
- if ( parts[1] ) {
- end = ( (parts[ 1 ] === "-=" ? -1 : 1) * end ) + start;
- }
- e.custom( start, end, unit );
- } else {
- e.custom( start, val, "" );
- }
- }
- }
-
- if ( supportTransition && transitions.length ) {
- transition = this.style[supportTransition];
- computedStyle = window.getComputedStyle( this );
- this.style[ supportTransition ] =
- transitions.join() + ( transition && transition.indexOf( "none" ) ? "," + transition : "" );
-
- for ( p in opt.transition ) {
-
- computedStyle[ p ];
-
- jQuery.style.apply( null, opt.transition[ p ].styleToSet );
- }
- }
-
- return true;
- }
- return optall.queue === false ?
- this.each( doAnimation ) :
- this.queue( optall.queue, doAnimation );
- },
- stop: function( type, clearQueue, gotoEnd ) {
- if ( typeof type !== "string" ) {
- gotoEnd = clearQueue;
- clearQueue = type;
- type = undefined;
- }
- if ( clearQueue && type !== false ) {
- this.queue( type || "fx", [] );
- }
- return this.each(function() {
- var index,
- hadTimers = false,
- timers = jQuery.timers,
- data = jQuery._data( this ),
-
- supportTransition = jQuery.support.transition;
-
- if ( !gotoEnd ) {
- jQuery._unmark( true, this );
- }
- function stopQueue( elem, data, index ) {
- var hooks = data[ index ];
- jQuery.removeData( elem, index, true );
- hooks.stop( gotoEnd );
- }
- if ( type == null ) {
- for ( index in data ) {
- if ( data[ index ] && data[ index ].stop && index.indexOf(".run") === index.length - 4 ) {
- stopQueue( this, data, index );
- }
- }
- } else if ( data[ index = type + ".run" ] && data[ index ].stop ){
- stopQueue( this, data, index );
- }
- for ( index = timers.length; index--; ) {
-
- if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
- if ( gotoEnd || supportTransition ) {
-
- timers[ index ]( gotoEnd );
- }
- if ( !gotoEnd ) {
- timers[ index ].saveState();
- }
- hadTimers = true;
- timers.splice( index, 1 );
- }
- }
-
-
-
- if ( !( gotoEnd && hadTimers ) ) {
- jQuery.dequeue( this, type );
- }
- });
- }
- });
- function createFxNow() {
- setTimeout( clearFxNow, 0 );
- return ( fxNow = jQuery.now() );
- }
- function clearFxNow() {
- fxNow = undefined;
- }
- jQuery.extend( jQuery.fx.prototype, {
-
- cur: function() {
- if ( this.elem[ this.prop ] != null && (!this.elem.style || this.elem.style[ this.prop ] == null) ) {
- return this.elem[ this.prop ];
- }
- var parsed,
- r = jQuery.css( this.elem, this.prop );
-
-
-
- return isNaN( parsed = parseFloat( r ) ) ? !r || r === "auto" ? 0 : r : parsed;
- },
-
- custom: function( from, to, unit ) {
- var self = this,
- fx = jQuery.fx,
-
- transition = self.options.transition,
-
- prop = this.prop;
- this.startTime = fxNow || createFxNow();
- this.end = to;
- this.now = this.start = from;
- this.pos = this.state = 0;
- this.unit = unit || this.unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
- function t( gotoEnd ) {
- return self.step( gotoEnd );
- }
- t.queue = this.options.queue;
- t.elem = this.elem;
- t.saveState = function() {
- if ( jQuery._data( self.elem, "fxshow" + self.prop ) === undefined ) {
- if ( self.options.hide ) {
- jQuery._data( self.elem, "fxshow" + self.prop, self.start );
- } else if ( self.options.show ) {
- jQuery._data( self.elem, "fxshow" + self.prop, self.end );
- }
- }
- };
-
- if ( ( t.transition = transition[ prop ] ) ) {
- jQuery.timers.push( t );
-
-
- if ( prop != "transform" ) {
- self.elem.style[ transition[ prop ].real ] = from + self.unit;
- }
-
- jQuery.fx.step[ prop ] && ( to = Math.max(0, to) );
- transition[ prop ].styleToSet = [ self.elem, prop, to + self.unit ];
-
-
- transition[ prop ].timeout = setTimeout(function() {
- jQuery.timers.splice( jQuery.timers.indexOf( t ), 1 );
- self.step( true );
-
- }, self.options.duration + 30);
- } else if ( t() && jQuery.timers.push(t) && !timerId ) {
- timerId = setInterval( fx.tick, fx.interval );
- }
- },
-
-
- step: function( gotoEnd ) {
- var p, n, complete,
- t = fxNow || createFxNow(),
- done = true,
- elem = this.elem,
- options = this.options,
-
- transition = options.transition[ this.prop ],
- naturalEnd = t >= options.duration + this.startTime,
- supportTransition = jQuery.support.transition;
- if ( transition || gotoEnd || naturalEnd ) {
- if ( !transition ) {
- this.now = this.end;
- this.pos = this.state = 1;
- this.update();
-
- } else {
- clearTimeout( transition.timeout );
-
- if ( !gotoEnd && !naturalEnd ) {
-
-
- this.elem.style[ transition.real ] = jQuery.css( this.elem, transition.real );
- }
- }
- options.animatedProperties[ this.prop ] = true;
- for ( p in options.animatedProperties ) {
- if ( options.animatedProperties[ p ] !== true ) {
- done = false;
- }
- }
- if ( done ) {
-
- if ( options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
- jQuery.each( [ "", "X", "Y" ], function( index, value ) {
- elem.style[ "overflow" + value ] = options.overflow[ index ];
- });
- }
-
- if ( options.hide ) {
- jQuery( elem ).hide();
- }
-
-
- if ( transition ) {
- transition = "," + elem.style[ supportTransition ];
- for ( p in options.transition ) {
- transition = transition.split( options.transition[ p ].lower ).join("_");
- }
- transition = transition.replace( /, ?_[^,]*/g, "" ).substr(1);
-
- elem.style[ supportTransition ] = transition || "none";
-
-
- !transition && ( elem.style[ supportTransition ] = transition );
- }
-
- if ( options.hide || options.show ) {
- for ( p in options.animatedProperties ) {
- ( gotoEnd || naturalEnd ) && jQuery.style( elem, p, options.orig[ p ] );
- jQuery.removeData( elem, "fxshow" + p, true );
-
- jQuery.removeData( elem, "toggle" + p, true );
- }
- }
-
-
-
- complete = options.complete;
- if ( complete && ( gotoEnd || naturalEnd ) ) {
- options.complete = false;
- complete.call( elem );
- }
- }
- return false;
- } else {
-
- if ( options.duration == Infinity ) {
- this.now = t;
- } else {
- n = t - this.startTime;
- this.state = n / options.duration;
-
- this.pos = jQuery.easing[ options.animatedProperties[this.prop] ]( this.state, n, 0, 1, options.duration );
- this.now = this.start + ( (this.end - this.start) * this.pos );
- }
-
- this.update();
- }
- return true;
- }
- });
- jQuery.extend( jQuery.fx, {
- tick: function() {
- var timer,
- timers = jQuery.timers,
- i = 0;
- for ( ; i < timers.length; i++ ) {
- timer = timers[ i ];
-
-
- if ( !timer.transition && !timer() && timers[ i ] === timer ) {
- timers.splice( i--, 1 );
- }
- }
- if ( !timers.length ) {
- jQuery.fx.stop();
- }
- }
- });
- function defaultDisplay( nodeName ) {
- if ( !elemdisplay[ nodeName ] ) {
- var body = document.body,
- elem = jQuery( "<" + nodeName + ">" ).appendTo( body ),
- display = elem.css( "display" );
- elem.remove();
-
-
- if ( display === "none" || display === "" ) {
-
- if ( !iframe ) {
- iframe = document.createElement( "iframe" );
- iframe.frameBorder = iframe.width = iframe.height = 0;
- }
- body.appendChild( iframe );
-
-
-
- if ( !iframeDoc || !iframe.createElement ) {
- iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
- iframeDoc.write( ( jQuery.support.boxModel ? "<!doctype html>" : "" ) + "<html><body>" );
- iframeDoc.close();
- }
- elem = iframeDoc.createElement( nodeName );
- iframeDoc.body.appendChild( elem );
- display = jQuery.css( elem, "display" );
- body.removeChild( iframe );
- }
-
- elemdisplay[ nodeName ] = display;
- }
- return elemdisplay[ nodeName ];
- }
- })( jQuery );
|