Blame view

bower_components/jquery/src/effects.js 15.5 KB
a1a3bc73   Luigi Serra   graphs updates
1
  define( [
74249687   Luigi Serra   Cross browser con...
2
  	"./core",
a1a3bc73   Luigi Serra   graphs updates
3
4
  	"./var/document",
  	"./var/rcssNum",
74249687   Luigi Serra   Cross browser con...
5
  	"./css/var/cssExpand",
a1a3bc73   Luigi Serra   graphs updates
6
  	"./var/rnotwhite",
74249687   Luigi Serra   Cross browser con...
7
  	"./css/var/isHidden",
a1a3bc73   Luigi Serra   graphs updates
8
  	"./css/adjustCSS",
74249687   Luigi Serra   Cross browser con...
9
  	"./css/defaultDisplay",
a1a3bc73   Luigi Serra   graphs updates
10
  	"./data/var/dataPriv",
74249687   Luigi Serra   Cross browser con...
11
12
13
14
15
16
17
  
  	"./core/init",
  	"./effects/Tween",
  	"./queue",
  	"./css",
  	"./deferred",
  	"./traversing"
a1a3bc73   Luigi Serra   graphs updates
18
19
  ], function( jQuery, document, rcssNum, cssExpand, rnotwhite,
  	isHidden, adjustCSS, defaultDisplay, dataPriv ) {
74249687   Luigi Serra   Cross browser con...
20
21
22
23
  
  var
  	fxNow, timerId,
  	rfxtypes = /^(?:toggle|show|hide)$/,
a1a3bc73   Luigi Serra   graphs updates
24
  	rrun = /queueHooks$/;
74249687   Luigi Serra   Cross browser con...
25
26
27
  
  // Animations created synchronously will run synchronously
  function createFxNow() {
a1a3bc73   Luigi Serra   graphs updates
28
  	window.setTimeout( function() {
74249687   Luigi Serra   Cross browser con...
29
  		fxNow = undefined;
a1a3bc73   Luigi Serra   graphs updates
30
  	} );
74249687   Luigi Serra   Cross browser con...
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
  	return ( fxNow = jQuery.now() );
  }
  
  // Generate parameters to create a standard animation
  function genFx( type, includeWidth ) {
  	var which,
  		i = 0,
  		attrs = { height: type };
  
  	// If we include width, step value is 1 to do all cssExpand values,
  	// otherwise step value is 2 to skip over Left and Right
  	includeWidth = includeWidth ? 1 : 0;
  	for ( ; i < 4 ; i += 2 - includeWidth ) {
  		which = cssExpand[ i ];
  		attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  	}
  
  	if ( includeWidth ) {
  		attrs.opacity = attrs.width = type;
  	}
  
  	return attrs;
  }
  
  function createTween( value, prop, animation ) {
  	var tween,
a1a3bc73   Luigi Serra   graphs updates
57
  		collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
74249687   Luigi Serra   Cross browser con...
58
59
60
  		index = 0,
  		length = collection.length;
  	for ( ; index < length; index++ ) {
a1a3bc73   Luigi Serra   graphs updates
61
  		if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
74249687   Luigi Serra   Cross browser con...
62
63
64
65
66
67
68
69
70
71
72
73
74
75
  
  			// We're done with this property
  			return tween;
  		}
  	}
  }
  
  function defaultPrefilter( elem, props, opts ) {
  	/* jshint validthis: true */
  	var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
  		anim = this,
  		orig = {},
  		style = elem.style,
  		hidden = elem.nodeType && isHidden( elem ),
a1a3bc73   Luigi Serra   graphs updates
76
  		dataShow = dataPriv.get( elem, "fxshow" );
74249687   Luigi Serra   Cross browser con...
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
  
  	// Handle queue: false promises
  	if ( !opts.queue ) {
  		hooks = jQuery._queueHooks( elem, "fx" );
  		if ( hooks.unqueued == null ) {
  			hooks.unqueued = 0;
  			oldfire = hooks.empty.fire;
  			hooks.empty.fire = function() {
  				if ( !hooks.unqueued ) {
  					oldfire();
  				}
  			};
  		}
  		hooks.unqueued++;
  
a1a3bc73   Luigi Serra   graphs updates
92
93
  		anim.always( function() {
  
74249687   Luigi Serra   Cross browser con...
94
  			// Ensure the complete handler is called before this completes
a1a3bc73   Luigi Serra   graphs updates
95
  			anim.always( function() {
74249687   Luigi Serra   Cross browser con...
96
97
98
99
  				hooks.unqueued--;
  				if ( !jQuery.queue( elem, "fx" ).length ) {
  					hooks.empty.fire();
  				}
a1a3bc73   Luigi Serra   graphs updates
100
101
  			} );
  		} );
74249687   Luigi Serra   Cross browser con...
102
103
104
105
  	}
  
  	// Height/width overflow pass
  	if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
a1a3bc73   Luigi Serra   graphs updates
106
  
74249687   Luigi Serra   Cross browser con...
107
108
109
110
111
112
113
114
115
116
117
118
  		// Make sure that nothing sneaks out
  		// Record all 3 overflow attributes because IE9-10 do not
  		// change the overflow attribute when overflowX and
  		// overflowY are set to the same value
  		opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  
  		// Set display property to inline-block for height/width
  		// animations on inline elements that are having width/height animated
  		display = jQuery.css( elem, "display" );
  
  		// Test default display if display is currently "none"
  		checkDisplay = display === "none" ?
a1a3bc73   Luigi Serra   graphs updates
119
  			dataPriv.get( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display;
74249687   Luigi Serra   Cross browser con...
120
121
122
123
124
125
126
127
  
  		if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) {
  			style.display = "inline-block";
  		}
  	}
  
  	if ( opts.overflow ) {
  		style.overflow = "hidden";
a1a3bc73   Luigi Serra   graphs updates
128
  		anim.always( function() {
74249687   Luigi Serra   Cross browser con...
129
130
131
  			style.overflow = opts.overflow[ 0 ];
  			style.overflowX = opts.overflow[ 1 ];
  			style.overflowY = opts.overflow[ 2 ];
a1a3bc73   Luigi Serra   graphs updates
132
  		} );
74249687   Luigi Serra   Cross browser con...
133
134
135
136
137
138
139
140
141
142
  	}
  
  	// show/hide pass
  	for ( prop in props ) {
  		value = props[ prop ];
  		if ( rfxtypes.exec( value ) ) {
  			delete props[ prop ];
  			toggle = toggle || value === "toggle";
  			if ( value === ( hidden ? "hide" : "show" ) ) {
  
a1a3bc73   Luigi Serra   graphs updates
143
144
  				// If there is dataShow left over from a stopped hide or show
  				// and we are going to proceed with show, we should pretend to be hidden
74249687   Luigi Serra   Cross browser con...
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
  				if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  					hidden = true;
  				} else {
  					continue;
  				}
  			}
  			orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  
  		// Any non-fx value stops us from restoring the original display value
  		} else {
  			display = undefined;
  		}
  	}
  
  	if ( !jQuery.isEmptyObject( orig ) ) {
  		if ( dataShow ) {
  			if ( "hidden" in dataShow ) {
  				hidden = dataShow.hidden;
  			}
  		} else {
a1a3bc73   Luigi Serra   graphs updates
165
  			dataShow = dataPriv.access( elem, "fxshow", {} );
74249687   Luigi Serra   Cross browser con...
166
167
168
169
170
171
172
173
174
  		}
  
  		// Store state if its toggle - enables .stop().toggle() to "reverse"
  		if ( toggle ) {
  			dataShow.hidden = !hidden;
  		}
  		if ( hidden ) {
  			jQuery( elem ).show();
  		} else {
a1a3bc73   Luigi Serra   graphs updates
175
  			anim.done( function() {
74249687   Luigi Serra   Cross browser con...
176
  				jQuery( elem ).hide();
a1a3bc73   Luigi Serra   graphs updates
177
  			} );
74249687   Luigi Serra   Cross browser con...
178
  		}
a1a3bc73   Luigi Serra   graphs updates
179
  		anim.done( function() {
74249687   Luigi Serra   Cross browser con...
180
181
  			var prop;
  
a1a3bc73   Luigi Serra   graphs updates
182
  			dataPriv.remove( elem, "fxshow" );
74249687   Luigi Serra   Cross browser con...
183
184
185
  			for ( prop in orig ) {
  				jQuery.style( elem, prop, orig[ prop ] );
  			}
a1a3bc73   Luigi Serra   graphs updates
186
  		} );
74249687   Luigi Serra   Cross browser con...
187
188
189
190
191
192
193
194
195
196
197
198
199
  		for ( prop in orig ) {
  			tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  
  			if ( !( prop in dataShow ) ) {
  				dataShow[ prop ] = tween.start;
  				if ( hidden ) {
  					tween.end = tween.start;
  					tween.start = prop === "width" || prop === "height" ? 1 : 0;
  				}
  			}
  		}
  
  	// If this is a noop like .hide().hide(), restore an overwritten display value
a1a3bc73   Luigi Serra   graphs updates
200
  	} else if ( ( display === "none" ? defaultDisplay( elem.nodeName ) : display ) === "inline" ) {
74249687   Luigi Serra   Cross browser con...
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
  		style.display = display;
  	}
  }
  
  function propFilter( props, specialEasing ) {
  	var index, name, easing, value, hooks;
  
  	// camelCase, specialEasing and expand cssHook pass
  	for ( index in props ) {
  		name = jQuery.camelCase( index );
  		easing = specialEasing[ name ];
  		value = props[ index ];
  		if ( jQuery.isArray( value ) ) {
  			easing = value[ 1 ];
  			value = props[ index ] = value[ 0 ];
  		}
  
  		if ( index !== name ) {
  			props[ name ] = value;
  			delete props[ index ];
  		}
  
  		hooks = jQuery.cssHooks[ name ];
  		if ( hooks && "expand" in hooks ) {
  			value = hooks.expand( value );
  			delete props[ name ];
  
  			// Not quite $.extend, this won't overwrite existing keys.
  			// Reusing 'index' because we have the correct "name"
  			for ( index in value ) {
  				if ( !( index in props ) ) {
  					props[ index ] = value[ index ];
  					specialEasing[ index ] = easing;
  				}
  			}
  		} else {
  			specialEasing[ name ] = easing;
  		}
  	}
  }
  
  function Animation( elem, properties, options ) {
  	var result,
  		stopped,
  		index = 0,
a1a3bc73   Luigi Serra   graphs updates
246
  		length = Animation.prefilters.length,
74249687   Luigi Serra   Cross browser con...
247
  		deferred = jQuery.Deferred().always( function() {
a1a3bc73   Luigi Serra   graphs updates
248
  
74249687   Luigi Serra   Cross browser con...
249
250
  			// Don't match elem in the :animated selector
  			delete tick.elem;
a1a3bc73   Luigi Serra   graphs updates
251
  		} ),
74249687   Luigi Serra   Cross browser con...
252
253
254
255
256
257
  		tick = function() {
  			if ( stopped ) {
  				return false;
  			}
  			var currentTime = fxNow || createFxNow(),
  				remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
a1a3bc73   Luigi Serra   graphs updates
258
  
74249687   Luigi Serra   Cross browser con...
259
260
261
262
263
264
265
266
267
268
269
  				// Support: Android 2.3
  				// Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  				temp = remaining / animation.duration || 0,
  				percent = 1 - temp,
  				index = 0,
  				length = animation.tweens.length;
  
  			for ( ; index < length ; index++ ) {
  				animation.tweens[ index ].run( percent );
  			}
  
a1a3bc73   Luigi Serra   graphs updates
270
  			deferred.notifyWith( elem, [ animation, percent, remaining ] );
74249687   Luigi Serra   Cross browser con...
271
272
273
274
275
276
277
278
  
  			if ( percent < 1 && length ) {
  				return remaining;
  			} else {
  				deferred.resolveWith( elem, [ animation ] );
  				return false;
  			}
  		},
a1a3bc73   Luigi Serra   graphs updates
279
  		animation = deferred.promise( {
74249687   Luigi Serra   Cross browser con...
280
281
  			elem: elem,
  			props: jQuery.extend( {}, properties ),
a1a3bc73   Luigi Serra   graphs updates
282
283
284
285
  			opts: jQuery.extend( true, {
  				specialEasing: {},
  				easing: jQuery.easing._default
  			}, options ),
74249687   Luigi Serra   Cross browser con...
286
287
288
289
290
291
292
293
294
295
296
297
298
  			originalProperties: properties,
  			originalOptions: options,
  			startTime: fxNow || createFxNow(),
  			duration: options.duration,
  			tweens: [],
  			createTween: function( prop, end ) {
  				var tween = jQuery.Tween( elem, animation.opts, prop, end,
  						animation.opts.specialEasing[ prop ] || animation.opts.easing );
  				animation.tweens.push( tween );
  				return tween;
  			},
  			stop: function( gotoEnd ) {
  				var index = 0,
a1a3bc73   Luigi Serra   graphs updates
299
  
74249687   Luigi Serra   Cross browser con...
300
301
302
303
304
305
306
307
308
309
310
311
312
  					// If we are going to the end, we want to run all the tweens
  					// otherwise we skip this part
  					length = gotoEnd ? animation.tweens.length : 0;
  				if ( stopped ) {
  					return this;
  				}
  				stopped = true;
  				for ( ; index < length ; index++ ) {
  					animation.tweens[ index ].run( 1 );
  				}
  
  				// Resolve when we played the last frame; otherwise, reject
  				if ( gotoEnd ) {
a1a3bc73   Luigi Serra   graphs updates
313
  					deferred.notifyWith( elem, [ animation, 1, 0 ] );
74249687   Luigi Serra   Cross browser con...
314
315
316
317
318
319
  					deferred.resolveWith( elem, [ animation, gotoEnd ] );
  				} else {
  					deferred.rejectWith( elem, [ animation, gotoEnd ] );
  				}
  				return this;
  			}
a1a3bc73   Luigi Serra   graphs updates
320
  		} ),
74249687   Luigi Serra   Cross browser con...
321
322
323
324
325
  		props = animation.props;
  
  	propFilter( props, animation.opts.specialEasing );
  
  	for ( ; index < length ; index++ ) {
a1a3bc73   Luigi Serra   graphs updates
326
  		result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
74249687   Luigi Serra   Cross browser con...
327
  		if ( result ) {
a1a3bc73   Luigi Serra   graphs updates
328
329
330
331
  			if ( jQuery.isFunction( result.stop ) ) {
  				jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  					jQuery.proxy( result.stop, result );
  			}
74249687   Luigi Serra   Cross browser con...
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
  			return result;
  		}
  	}
  
  	jQuery.map( props, createTween, animation );
  
  	if ( jQuery.isFunction( animation.opts.start ) ) {
  		animation.opts.start.call( elem, animation );
  	}
  
  	jQuery.fx.timer(
  		jQuery.extend( tick, {
  			elem: elem,
  			anim: animation,
  			queue: animation.opts.queue
a1a3bc73   Luigi Serra   graphs updates
347
  		} )
74249687   Luigi Serra   Cross browser con...
348
349
350
351
352
353
354
355
356
357
  	);
  
  	// attach callbacks from options
  	return animation.progress( animation.opts.progress )
  		.done( animation.opts.done, animation.opts.complete )
  		.fail( animation.opts.fail )
  		.always( animation.opts.always );
  }
  
  jQuery.Animation = jQuery.extend( Animation, {
a1a3bc73   Luigi Serra   graphs updates
358
359
360
361
362
363
364
  	tweeners: {
  		"*": [ function( prop, value ) {
  			var tween = this.createTween( prop, value );
  			adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  			return tween;
  		} ]
  	},
74249687   Luigi Serra   Cross browser con...
365
366
367
368
369
370
  
  	tweener: function( props, callback ) {
  		if ( jQuery.isFunction( props ) ) {
  			callback = props;
  			props = [ "*" ];
  		} else {
a1a3bc73   Luigi Serra   graphs updates
371
  			props = props.match( rnotwhite );
74249687   Luigi Serra   Cross browser con...
372
373
374
375
376
377
378
379
  		}
  
  		var prop,
  			index = 0,
  			length = props.length;
  
  		for ( ; index < length ; index++ ) {
  			prop = props[ index ];
a1a3bc73   Luigi Serra   graphs updates
380
381
  			Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  			Animation.tweeners[ prop ].unshift( callback );
74249687   Luigi Serra   Cross browser con...
382
383
384
  		}
  	},
  
a1a3bc73   Luigi Serra   graphs updates
385
386
  	prefilters: [ defaultPrefilter ],
  
74249687   Luigi Serra   Cross browser con...
387
388
  	prefilter: function( callback, prepend ) {
  		if ( prepend ) {
a1a3bc73   Luigi Serra   graphs updates
389
  			Animation.prefilters.unshift( callback );
74249687   Luigi Serra   Cross browser con...
390
  		} else {
a1a3bc73   Luigi Serra   graphs updates
391
  			Animation.prefilters.push( callback );
74249687   Luigi Serra   Cross browser con...
392
393
  		}
  	}
a1a3bc73   Luigi Serra   graphs updates
394
  } );
74249687   Luigi Serra   Cross browser con...
395
396
397
398
399
400
401
402
403
  
  jQuery.speed = function( speed, easing, fn ) {
  	var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  		complete: fn || !fn && easing ||
  			jQuery.isFunction( speed ) && speed,
  		duration: speed,
  		easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
  	};
  
a1a3bc73   Luigi Serra   graphs updates
404
405
406
  	opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ?
  		opt.duration : opt.duration in jQuery.fx.speeds ?
  			jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
74249687   Luigi Serra   Cross browser con...
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
  
  	// Normalize opt.queue - true/undefined/null -> "fx"
  	if ( opt.queue == null || opt.queue === true ) {
  		opt.queue = "fx";
  	}
  
  	// Queueing
  	opt.old = opt.complete;
  
  	opt.complete = function() {
  		if ( jQuery.isFunction( opt.old ) ) {
  			opt.old.call( this );
  		}
  
  		if ( opt.queue ) {
  			jQuery.dequeue( this, opt.queue );
  		}
  	};
  
  	return opt;
  };
  
a1a3bc73   Luigi Serra   graphs updates
429
  jQuery.fn.extend( {
74249687   Luigi Serra   Cross browser con...
430
431
432
433
434
435
  	fadeTo: function( speed, to, easing, callback ) {
  
  		// Show any hidden elements after setting opacity to 0
  		return this.filter( isHidden ).css( "opacity", 0 ).show()
  
  			// Animate to the value specified
a1a3bc73   Luigi Serra   graphs updates
436
  			.end().animate( { opacity: to }, speed, easing, callback );
74249687   Luigi Serra   Cross browser con...
437
438
439
440
441
  	},
  	animate: function( prop, speed, easing, callback ) {
  		var empty = jQuery.isEmptyObject( prop ),
  			optall = jQuery.speed( speed, easing, callback ),
  			doAnimation = function() {
a1a3bc73   Luigi Serra   graphs updates
442
  
74249687   Luigi Serra   Cross browser con...
443
444
445
446
  				// Operate on a copy of prop so per-property easing won't be lost
  				var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  
  				// Empty animations, or finishing resolves immediately
a1a3bc73   Luigi Serra   graphs updates
447
  				if ( empty || dataPriv.get( this, "finish" ) ) {
74249687   Luigi Serra   Cross browser con...
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
  					anim.stop( true );
  				}
  			};
  			doAnimation.finish = doAnimation;
  
  		return empty || optall.queue === false ?
  			this.each( doAnimation ) :
  			this.queue( optall.queue, doAnimation );
  	},
  	stop: function( type, clearQueue, gotoEnd ) {
  		var stopQueue = function( hooks ) {
  			var stop = hooks.stop;
  			delete hooks.stop;
  			stop( gotoEnd );
  		};
  
  		if ( typeof type !== "string" ) {
  			gotoEnd = clearQueue;
  			clearQueue = type;
  			type = undefined;
  		}
  		if ( clearQueue && type !== false ) {
  			this.queue( type || "fx", [] );
  		}
  
a1a3bc73   Luigi Serra   graphs updates
473
  		return this.each( function() {
74249687   Luigi Serra   Cross browser con...
474
475
476
  			var dequeue = true,
  				index = type != null && type + "queueHooks",
  				timers = jQuery.timers,
a1a3bc73   Luigi Serra   graphs updates
477
  				data = dataPriv.get( this );
74249687   Luigi Serra   Cross browser con...
478
479
480
481
482
483
484
485
486
487
488
489
490
491
  
  			if ( index ) {
  				if ( data[ index ] && data[ index ].stop ) {
  					stopQueue( data[ index ] );
  				}
  			} else {
  				for ( index in data ) {
  					if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  						stopQueue( data[ index ] );
  					}
  				}
  			}
  
  			for ( index = timers.length; index--; ) {
a1a3bc73   Luigi Serra   graphs updates
492
493
494
  				if ( timers[ index ].elem === this &&
  					( type == null || timers[ index ].queue === type ) ) {
  
74249687   Luigi Serra   Cross browser con...
495
496
497
498
499
500
501
502
503
504
505
506
  					timers[ index ].anim.stop( gotoEnd );
  					dequeue = false;
  					timers.splice( index, 1 );
  				}
  			}
  
  			// Start the next in the queue if the last step wasn't forced.
  			// Timers currently will call their complete callbacks, which
  			// will dequeue but only if they were gotoEnd.
  			if ( dequeue || !gotoEnd ) {
  				jQuery.dequeue( this, type );
  			}
a1a3bc73   Luigi Serra   graphs updates
507
  		} );
74249687   Luigi Serra   Cross browser con...
508
509
510
511
512
  	},
  	finish: function( type ) {
  		if ( type !== false ) {
  			type = type || "fx";
  		}
a1a3bc73   Luigi Serra   graphs updates
513
  		return this.each( function() {
74249687   Luigi Serra   Cross browser con...
514
  			var index,
a1a3bc73   Luigi Serra   graphs updates
515
  				data = dataPriv.get( this ),
74249687   Luigi Serra   Cross browser con...
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
  				queue = data[ type + "queue" ],
  				hooks = data[ type + "queueHooks" ],
  				timers = jQuery.timers,
  				length = queue ? queue.length : 0;
  
  			// Enable finishing flag on private data
  			data.finish = true;
  
  			// Empty the queue first
  			jQuery.queue( this, type, [] );
  
  			if ( hooks && hooks.stop ) {
  				hooks.stop.call( this, true );
  			}
  
  			// Look for any active animations, and finish them
  			for ( index = timers.length; index--; ) {
  				if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  					timers[ index ].anim.stop( true );
  					timers.splice( index, 1 );
  				}
  			}
  
  			// Look for any animations in the old queue and finish them
  			for ( index = 0; index < length; index++ ) {
  				if ( queue[ index ] && queue[ index ].finish ) {
  					queue[ index ].finish.call( this );
  				}
  			}
  
  			// Turn off finishing flag
  			delete data.finish;
a1a3bc73   Luigi Serra   graphs updates
548
  		} );
74249687   Luigi Serra   Cross browser con...
549
  	}
a1a3bc73   Luigi Serra   graphs updates
550
  } );
74249687   Luigi Serra   Cross browser con...
551
  
a1a3bc73   Luigi Serra   graphs updates
552
  jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
74249687   Luigi Serra   Cross browser con...
553
554
555
556
557
558
  	var cssFn = jQuery.fn[ name ];
  	jQuery.fn[ name ] = function( speed, easing, callback ) {
  		return speed == null || typeof speed === "boolean" ?
  			cssFn.apply( this, arguments ) :
  			this.animate( genFx( name, true ), speed, easing, callback );
  	};
a1a3bc73   Luigi Serra   graphs updates
559
  } );
74249687   Luigi Serra   Cross browser con...
560
561
  
  // Generate shortcuts for custom animations
a1a3bc73   Luigi Serra   graphs updates
562
563
564
565
  jQuery.each( {
  	slideDown: genFx( "show" ),
  	slideUp: genFx( "hide" ),
  	slideToggle: genFx( "toggle" ),
74249687   Luigi Serra   Cross browser con...
566
567
568
569
570
571
572
  	fadeIn: { opacity: "show" },
  	fadeOut: { opacity: "hide" },
  	fadeToggle: { opacity: "toggle" }
  }, function( name, props ) {
  	jQuery.fn[ name ] = function( speed, easing, callback ) {
  		return this.animate( props, speed, easing, callback );
  	};
a1a3bc73   Luigi Serra   graphs updates
573
  } );
74249687   Luigi Serra   Cross browser con...
574
575
576
577
578
579
580
581
582
583
584
  
  jQuery.timers = [];
  jQuery.fx.tick = function() {
  	var timer,
  		i = 0,
  		timers = jQuery.timers;
  
  	fxNow = jQuery.now();
  
  	for ( ; i < timers.length; i++ ) {
  		timer = timers[ i ];
a1a3bc73   Luigi Serra   graphs updates
585
  
74249687   Luigi Serra   Cross browser con...
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
  		// Checks the timer has not already been removed
  		if ( !timer() && timers[ i ] === timer ) {
  			timers.splice( i--, 1 );
  		}
  	}
  
  	if ( !timers.length ) {
  		jQuery.fx.stop();
  	}
  	fxNow = undefined;
  };
  
  jQuery.fx.timer = function( timer ) {
  	jQuery.timers.push( timer );
  	if ( timer() ) {
  		jQuery.fx.start();
  	} else {
  		jQuery.timers.pop();
  	}
  };
  
  jQuery.fx.interval = 13;
74249687   Luigi Serra   Cross browser con...
608
609
  jQuery.fx.start = function() {
  	if ( !timerId ) {
a1a3bc73   Luigi Serra   graphs updates
610
  		timerId = window.setInterval( jQuery.fx.tick, jQuery.fx.interval );
74249687   Luigi Serra   Cross browser con...
611
612
613
614
  	}
  };
  
  jQuery.fx.stop = function() {
a1a3bc73   Luigi Serra   graphs updates
615
616
  	window.clearInterval( timerId );
  
74249687   Luigi Serra   Cross browser con...
617
618
619
620
621
622
  	timerId = null;
  };
  
  jQuery.fx.speeds = {
  	slow: 600,
  	fast: 200,
a1a3bc73   Luigi Serra   graphs updates
623
  
74249687   Luigi Serra   Cross browser con...
624
625
626
627
628
  	// Default speed
  	_default: 400
  };
  
  return jQuery;
a1a3bc73   Luigi Serra   graphs updates
629
  } );