Blame view

app/bower_components/jquery/src/effects.js 16.9 KB
87c93a029   Dang YoungWorld   add modal
1
  define( [
f986e111b   TRUONG   add libs
2
  	"./core",
87c93a029   Dang YoungWorld   add modal
3
4
5
  	"./var/document",
  	"./var/rcssNum",
  	"./var/rnothtmlwhite",
f986e111b   TRUONG   add libs
6
  	"./css/var/cssExpand",
87c93a029   Dang YoungWorld   add modal
7
8
9
10
11
  	"./css/var/isHiddenWithinTree",
  	"./css/var/swap",
  	"./css/adjustCSS",
  	"./data/var/dataPriv",
  	"./css/showHide",
f986e111b   TRUONG   add libs
12
13
  
  	"./core/init",
f986e111b   TRUONG   add libs
14
  	"./queue",
f986e111b   TRUONG   add libs
15
  	"./deferred",
87c93a029   Dang YoungWorld   add modal
16
17
18
19
20
21
22
23
  	"./traversing",
  	"./manipulation",
  	"./css",
  	"./effects/Tween"
  ], function( jQuery, document, rcssNum, rnothtmlwhite, cssExpand, isHiddenWithinTree, swap,
  	adjustCSS, dataPriv, showHide ) {
  
  "use strict";
f986e111b   TRUONG   add libs
24
25
26
27
  
  var
  	fxNow, timerId,
  	rfxtypes = /^(?:toggle|show|hide)$/,
87c93a029   Dang YoungWorld   add modal
28
  	rrun = /queueHooks$/;
f986e111b   TRUONG   add libs
29

87c93a029   Dang YoungWorld   add modal
30
31
32
33
34
35
  function raf() {
  	if ( timerId ) {
  		window.requestAnimationFrame( raf );
  		jQuery.fx.tick();
  	}
  }
f986e111b   TRUONG   add libs
36
37
38
  
  // Animations created synchronously will run synchronously
  function createFxNow() {
87c93a029   Dang YoungWorld   add modal
39
  	window.setTimeout( function() {
f986e111b   TRUONG   add libs
40
  		fxNow = undefined;
87c93a029   Dang YoungWorld   add modal
41
  	} );
f986e111b   TRUONG   add libs
42
43
44
45
46
47
  	return ( fxNow = jQuery.now() );
  }
  
  // Generate parameters to create a standard animation
  function genFx( type, includeWidth ) {
  	var which,
87c93a029   Dang YoungWorld   add modal
48
49
  		i = 0,
  		attrs = { height: type };
f986e111b   TRUONG   add libs
50

87c93a029   Dang YoungWorld   add modal
51
52
  	// If we include width, step value is 1 to do all cssExpand values,
  	// otherwise step value is 2 to skip over Left and Right
f986e111b   TRUONG   add libs
53
  	includeWidth = includeWidth ? 1 : 0;
87c93a029   Dang YoungWorld   add modal
54
  	for ( ; i < 4; i += 2 - includeWidth ) {
f986e111b   TRUONG   add libs
55
56
57
58
59
60
61
62
63
64
65
66
67
  		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,
87c93a029   Dang YoungWorld   add modal
68
  		collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
f986e111b   TRUONG   add libs
69
70
71
  		index = 0,
  		length = collection.length;
  	for ( ; index < length; index++ ) {
87c93a029   Dang YoungWorld   add modal
72
  		if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
f986e111b   TRUONG   add libs
73

87c93a029   Dang YoungWorld   add modal
74
  			// We're done with this property
f986e111b   TRUONG   add libs
75
76
77
78
79
80
  			return tween;
  		}
  	}
  }
  
  function defaultPrefilter( elem, props, opts ) {
87c93a029   Dang YoungWorld   add modal
81
82
  	var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  		isBox = "width" in props || "height" in props,
f986e111b   TRUONG   add libs
83
84
85
  		anim = this,
  		orig = {},
  		style = elem.style,
87c93a029   Dang YoungWorld   add modal
86
87
  		hidden = elem.nodeType && isHiddenWithinTree( elem ),
  		dataShow = dataPriv.get( elem, "fxshow" );
f986e111b   TRUONG   add libs
88

87c93a029   Dang YoungWorld   add modal
89
  	// Queue-skipping animations hijack the fx hooks
f986e111b   TRUONG   add libs
90
91
92
93
94
95
96
97
98
99
100
101
  	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++;
87c93a029   Dang YoungWorld   add modal
102
103
104
105
  		anim.always( function() {
  
  			// Ensure the complete handler is called before this completes
  			anim.always( function() {
f986e111b   TRUONG   add libs
106
107
108
109
  				hooks.unqueued--;
  				if ( !jQuery.queue( elem, "fx" ).length ) {
  					hooks.empty.fire();
  				}
87c93a029   Dang YoungWorld   add modal
110
111
  			} );
  		} );
f986e111b   TRUONG   add libs
112
  	}
87c93a029   Dang YoungWorld   add modal
113
  	// Detect show/hide animations
f986e111b   TRUONG   add libs
114
115
  	for ( prop in props ) {
  		value = props[ prop ];
87c93a029   Dang YoungWorld   add modal
116
  		if ( rfxtypes.test( value ) ) {
f986e111b   TRUONG   add libs
117
118
119
  			delete props[ prop ];
  			toggle = toggle || value === "toggle";
  			if ( value === ( hidden ? "hide" : "show" ) ) {
87c93a029   Dang YoungWorld   add modal
120
121
  				// Pretend to be hidden if this is a "show" and
  				// there is still data from a stopped show/hide
f986e111b   TRUONG   add libs
122
123
  				if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  					hidden = true;
87c93a029   Dang YoungWorld   add modal
124
125
  
  				// Ignore all other no-op show/hide data
f986e111b   TRUONG   add libs
126
127
128
129
130
  				} else {
  					continue;
  				}
  			}
  			orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
f986e111b   TRUONG   add libs
131
132
  		}
  	}
87c93a029   Dang YoungWorld   add modal
133
134
135
136
137
  	// Bail out if this is a no-op like .hide().hide()
  	propTween = !jQuery.isEmptyObject( props );
  	if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  		return;
  	}
f986e111b   TRUONG   add libs
138

87c93a029   Dang YoungWorld   add modal
139
140
141
142
143
144
145
146
147
148
149
150
  	// Restrict "overflow" and "display" styles during box animations
  	if ( isBox && elem.nodeType === 1 ) {
  
  		// Support: IE <=9 - 11, Edge 12 - 13
  		// Record all 3 overflow attributes because IE does not infer the shorthand
  		// from identically-valued overflowX and overflowY
  		opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  
  		// Identify a display type, preferring old show/hide data over the CSS cascade
  		restoreDisplay = dataShow && dataShow.display;
  		if ( restoreDisplay == null ) {
  			restoreDisplay = dataPriv.get( elem, "display" );
f986e111b   TRUONG   add libs
151
  		}
87c93a029   Dang YoungWorld   add modal
152
153
154
155
156
157
158
159
160
161
162
163
  		display = jQuery.css( elem, "display" );
  		if ( display === "none" ) {
  			if ( restoreDisplay ) {
  				display = restoreDisplay;
  			} else {
  
  				// Get nonempty value(s) by temporarily forcing visibility
  				showHide( [ elem ], true );
  				restoreDisplay = elem.style.display || restoreDisplay;
  				display = jQuery.css( elem, "display" );
  				showHide( [ elem ] );
  			}
f986e111b   TRUONG   add libs
164
  		}
87c93a029   Dang YoungWorld   add modal
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
  
  		// Animate inline elements as inline-block
  		if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  			if ( jQuery.css( elem, "float" ) === "none" ) {
  
  				// Restore the original display value at the end of pure show/hide animations
  				if ( !propTween ) {
  					anim.done( function() {
  						style.display = restoreDisplay;
  					} );
  					if ( restoreDisplay == null ) {
  						display = style.display;
  						restoreDisplay = display === "none" ? "" : display;
  					}
  				}
  				style.display = "inline-block";
f986e111b   TRUONG   add libs
181
  			}
87c93a029   Dang YoungWorld   add modal
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
  		}
  	}
  
  	if ( opts.overflow ) {
  		style.overflow = "hidden";
  		anim.always( function() {
  			style.overflow = opts.overflow[ 0 ];
  			style.overflowX = opts.overflow[ 1 ];
  			style.overflowY = opts.overflow[ 2 ];
  		} );
  	}
  
  	// Implement show/hide animations
  	propTween = false;
  	for ( prop in orig ) {
  
  		// General show/hide setup for this element animation
  		if ( !propTween ) {
  			if ( dataShow ) {
  				if ( "hidden" in dataShow ) {
  					hidden = dataShow.hidden;
f986e111b   TRUONG   add libs
203
  				}
87c93a029   Dang YoungWorld   add modal
204
205
206
207
208
209
210
211
212
213
214
215
  			} else {
  				dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  			}
  
  			// Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  			if ( toggle ) {
  				dataShow.hidden = !hidden;
  			}
  
  			// Show elements before animating them
  			if ( hidden ) {
  				showHide( [ elem ], true );
f986e111b   TRUONG   add libs
216
  			}
87c93a029   Dang YoungWorld   add modal
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
  
  			/* eslint-disable no-loop-func */
  
  			anim.done( function() {
  
  			/* eslint-enable no-loop-func */
  
  				// The final step of a "hide" animation is actually hiding the element
  				if ( !hidden ) {
  					showHide( [ elem ] );
  				}
  				dataPriv.remove( elem, "fxshow" );
  				for ( prop in orig ) {
  					jQuery.style( elem, prop, orig[ prop ] );
  				}
  			} );
f986e111b   TRUONG   add libs
233
  		}
87c93a029   Dang YoungWorld   add modal
234
235
236
237
238
239
240
241
242
  		// Per-property setup
  		propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  		if ( !( prop in dataShow ) ) {
  			dataShow[ prop ] = propTween.start;
  			if ( hidden ) {
  				propTween.end = propTween.start;
  				propTween.start = 0;
  			}
  		}
f986e111b   TRUONG   add libs
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
  	}
  }
  
  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 ];
87c93a029   Dang YoungWorld   add modal
268
269
  			// Not quite $.extend, this won't overwrite existing keys.
  			// Reusing 'index' because we have the correct "name"
f986e111b   TRUONG   add libs
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
  			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,
87c93a029   Dang YoungWorld   add modal
286
  		length = Animation.prefilters.length,
f986e111b   TRUONG   add libs
287
  		deferred = jQuery.Deferred().always( function() {
87c93a029   Dang YoungWorld   add modal
288
289
  
  			// Don't match elem in the :animated selector
f986e111b   TRUONG   add libs
290
  			delete tick.elem;
87c93a029   Dang YoungWorld   add modal
291
  		} ),
f986e111b   TRUONG   add libs
292
293
294
295
296
297
  		tick = function() {
  			if ( stopped ) {
  				return false;
  			}
  			var currentTime = fxNow || createFxNow(),
  				remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
87c93a029   Dang YoungWorld   add modal
298
299
300
  
  				// Support: Android 2.3 only
  				// Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
f986e111b   TRUONG   add libs
301
302
303
304
  				temp = remaining / animation.duration || 0,
  				percent = 1 - temp,
  				index = 0,
  				length = animation.tweens.length;
87c93a029   Dang YoungWorld   add modal
305
  			for ( ; index < length; index++ ) {
f986e111b   TRUONG   add libs
306
307
  				animation.tweens[ index ].run( percent );
  			}
87c93a029   Dang YoungWorld   add modal
308
  			deferred.notifyWith( elem, [ animation, percent, remaining ] );
f986e111b   TRUONG   add libs
309
310
311
312
313
314
315
316
  
  			if ( percent < 1 && length ) {
  				return remaining;
  			} else {
  				deferred.resolveWith( elem, [ animation ] );
  				return false;
  			}
  		},
87c93a029   Dang YoungWorld   add modal
317
  		animation = deferred.promise( {
f986e111b   TRUONG   add libs
318
319
  			elem: elem,
  			props: jQuery.extend( {}, properties ),
87c93a029   Dang YoungWorld   add modal
320
321
322
323
  			opts: jQuery.extend( true, {
  				specialEasing: {},
  				easing: jQuery.easing._default
  			}, options ),
f986e111b   TRUONG   add libs
324
325
326
327
328
329
330
331
332
333
334
335
336
  			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,
87c93a029   Dang YoungWorld   add modal
337
338
  
  					// If we are going to the end, we want to run all the tweens
f986e111b   TRUONG   add libs
339
340
341
342
343
344
  					// otherwise we skip this part
  					length = gotoEnd ? animation.tweens.length : 0;
  				if ( stopped ) {
  					return this;
  				}
  				stopped = true;
87c93a029   Dang YoungWorld   add modal
345
  				for ( ; index < length; index++ ) {
f986e111b   TRUONG   add libs
346
347
  					animation.tweens[ index ].run( 1 );
  				}
87c93a029   Dang YoungWorld   add modal
348
  				// Resolve when we played the last frame; otherwise, reject
f986e111b   TRUONG   add libs
349
  				if ( gotoEnd ) {
87c93a029   Dang YoungWorld   add modal
350
  					deferred.notifyWith( elem, [ animation, 1, 0 ] );
f986e111b   TRUONG   add libs
351
352
353
354
355
356
  					deferred.resolveWith( elem, [ animation, gotoEnd ] );
  				} else {
  					deferred.rejectWith( elem, [ animation, gotoEnd ] );
  				}
  				return this;
  			}
87c93a029   Dang YoungWorld   add modal
357
  		} ),
f986e111b   TRUONG   add libs
358
359
360
  		props = animation.props;
  
  	propFilter( props, animation.opts.specialEasing );
87c93a029   Dang YoungWorld   add modal
361
362
  	for ( ; index < length; index++ ) {
  		result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
f986e111b   TRUONG   add libs
363
  		if ( result ) {
87c93a029   Dang YoungWorld   add modal
364
365
366
367
  			if ( jQuery.isFunction( result.stop ) ) {
  				jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  					jQuery.proxy( result.stop, result );
  			}
f986e111b   TRUONG   add libs
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
  			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
87c93a029   Dang YoungWorld   add modal
383
  		} )
f986e111b   TRUONG   add libs
384
385
386
387
388
389
390
391
392
393
  	);
  
  	// 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, {
87c93a029   Dang YoungWorld   add modal
394
395
396
397
398
399
400
401
  
  	tweeners: {
  		"*": [ function( prop, value ) {
  			var tween = this.createTween( prop, value );
  			adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  			return tween;
  		} ]
  	},
f986e111b   TRUONG   add libs
402
403
404
405
406
  	tweener: function( props, callback ) {
  		if ( jQuery.isFunction( props ) ) {
  			callback = props;
  			props = [ "*" ];
  		} else {
87c93a029   Dang YoungWorld   add modal
407
  			props = props.match( rnothtmlwhite );
f986e111b   TRUONG   add libs
408
409
410
411
412
  		}
  
  		var prop,
  			index = 0,
  			length = props.length;
87c93a029   Dang YoungWorld   add modal
413
  		for ( ; index < length; index++ ) {
f986e111b   TRUONG   add libs
414
  			prop = props[ index ];
87c93a029   Dang YoungWorld   add modal
415
416
  			Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  			Animation.tweeners[ prop ].unshift( callback );
f986e111b   TRUONG   add libs
417
418
  		}
  	},
87c93a029   Dang YoungWorld   add modal
419
  	prefilters: [ defaultPrefilter ],
f986e111b   TRUONG   add libs
420
421
  	prefilter: function( callback, prepend ) {
  		if ( prepend ) {
87c93a029   Dang YoungWorld   add modal
422
  			Animation.prefilters.unshift( callback );
f986e111b   TRUONG   add libs
423
  		} else {
87c93a029   Dang YoungWorld   add modal
424
  			Animation.prefilters.push( callback );
f986e111b   TRUONG   add libs
425
426
  		}
  	}
87c93a029   Dang YoungWorld   add modal
427
  } );
f986e111b   TRUONG   add libs
428
429
430
431
432
433
434
435
  
  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
  	};
87c93a029   Dang YoungWorld   add modal
436
437
438
439
440
441
442
443
444
445
446
447
448
449
  	// Go to the end state if fx are off or if document is hidden
  	if ( jQuery.fx.off || document.hidden ) {
  		opt.duration = 0;
  
  	} else {
  		if ( typeof opt.duration !== "number" ) {
  			if ( opt.duration in jQuery.fx.speeds ) {
  				opt.duration = jQuery.fx.speeds[ opt.duration ];
  
  			} else {
  				opt.duration = jQuery.fx.speeds._default;
  			}
  		}
  	}
f986e111b   TRUONG   add libs
450

87c93a029   Dang YoungWorld   add modal
451
  	// Normalize opt.queue - true/undefined/null -> "fx"
f986e111b   TRUONG   add libs
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
  	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;
  };
87c93a029   Dang YoungWorld   add modal
471
  jQuery.fn.extend( {
f986e111b   TRUONG   add libs
472
  	fadeTo: function( speed, to, easing, callback ) {
87c93a029   Dang YoungWorld   add modal
473
474
  		// Show any hidden elements after setting opacity to 0
  		return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
f986e111b   TRUONG   add libs
475

87c93a029   Dang YoungWorld   add modal
476
477
  			// Animate to the value specified
  			.end().animate( { opacity: to }, speed, easing, callback );
f986e111b   TRUONG   add libs
478
479
480
481
482
  	},
  	animate: function( prop, speed, easing, callback ) {
  		var empty = jQuery.isEmptyObject( prop ),
  			optall = jQuery.speed( speed, easing, callback ),
  			doAnimation = function() {
87c93a029   Dang YoungWorld   add modal
483

f986e111b   TRUONG   add libs
484
485
486
487
  				// 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
87c93a029   Dang YoungWorld   add modal
488
  				if ( empty || dataPriv.get( this, "finish" ) ) {
f986e111b   TRUONG   add libs
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
  					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", [] );
  		}
87c93a029   Dang YoungWorld   add modal
513
  		return this.each( function() {
f986e111b   TRUONG   add libs
514
515
516
  			var dequeue = true,
  				index = type != null && type + "queueHooks",
  				timers = jQuery.timers,
87c93a029   Dang YoungWorld   add modal
517
  				data = dataPriv.get( this );
f986e111b   TRUONG   add libs
518
519
520
521
522
523
524
525
526
527
528
529
530
531
  
  			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--; ) {
87c93a029   Dang YoungWorld   add modal
532
533
  				if ( timers[ index ].elem === this &&
  					( type == null || timers[ index ].queue === type ) ) {
f986e111b   TRUONG   add libs
534
535
536
537
538
  					timers[ index ].anim.stop( gotoEnd );
  					dequeue = false;
  					timers.splice( index, 1 );
  				}
  			}
87c93a029   Dang YoungWorld   add modal
539
540
541
  			// 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.
f986e111b   TRUONG   add libs
542
543
544
  			if ( dequeue || !gotoEnd ) {
  				jQuery.dequeue( this, type );
  			}
87c93a029   Dang YoungWorld   add modal
545
  		} );
f986e111b   TRUONG   add libs
546
547
548
549
550
  	},
  	finish: function( type ) {
  		if ( type !== false ) {
  			type = type || "fx";
  		}
87c93a029   Dang YoungWorld   add modal
551
  		return this.each( function() {
f986e111b   TRUONG   add libs
552
  			var index,
87c93a029   Dang YoungWorld   add modal
553
  				data = dataPriv.get( this ),
f986e111b   TRUONG   add libs
554
555
556
557
  				queue = data[ type + "queue" ],
  				hooks = data[ type + "queueHooks" ],
  				timers = jQuery.timers,
  				length = queue ? queue.length : 0;
87c93a029   Dang YoungWorld   add modal
558
  			// Enable finishing flag on private data
f986e111b   TRUONG   add libs
559
  			data.finish = true;
87c93a029   Dang YoungWorld   add modal
560
  			// Empty the queue first
f986e111b   TRUONG   add libs
561
562
563
564
565
  			jQuery.queue( this, type, [] );
  
  			if ( hooks && hooks.stop ) {
  				hooks.stop.call( this, true );
  			}
87c93a029   Dang YoungWorld   add modal
566
  			// Look for any active animations, and finish them
f986e111b   TRUONG   add libs
567
568
569
570
571
572
  			for ( index = timers.length; index--; ) {
  				if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  					timers[ index ].anim.stop( true );
  					timers.splice( index, 1 );
  				}
  			}
87c93a029   Dang YoungWorld   add modal
573
  			// Look for any animations in the old queue and finish them
f986e111b   TRUONG   add libs
574
575
576
577
578
  			for ( index = 0; index < length; index++ ) {
  				if ( queue[ index ] && queue[ index ].finish ) {
  					queue[ index ].finish.call( this );
  				}
  			}
87c93a029   Dang YoungWorld   add modal
579
  			// Turn off finishing flag
f986e111b   TRUONG   add libs
580
  			delete data.finish;
87c93a029   Dang YoungWorld   add modal
581
  		} );
f986e111b   TRUONG   add libs
582
  	}
87c93a029   Dang YoungWorld   add modal
583
  } );
f986e111b   TRUONG   add libs
584

87c93a029   Dang YoungWorld   add modal
585
  jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
f986e111b   TRUONG   add libs
586
587
588
589
590
591
  	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 );
  	};
87c93a029   Dang YoungWorld   add modal
592
  } );
f986e111b   TRUONG   add libs
593
594
  
  // Generate shortcuts for custom animations
87c93a029   Dang YoungWorld   add modal
595
596
597
598
  jQuery.each( {
  	slideDown: genFx( "show" ),
  	slideUp: genFx( "hide" ),
  	slideToggle: genFx( "toggle" ),
f986e111b   TRUONG   add libs
599
600
601
602
603
604
605
  	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 );
  	};
87c93a029   Dang YoungWorld   add modal
606
  } );
f986e111b   TRUONG   add libs
607
608
609
610
  
  jQuery.timers = [];
  jQuery.fx.tick = function() {
  	var timer,
87c93a029   Dang YoungWorld   add modal
611
612
  		i = 0,
  		timers = jQuery.timers;
f986e111b   TRUONG   add libs
613
614
615
616
617
  
  	fxNow = jQuery.now();
  
  	for ( ; i < timers.length; i++ ) {
  		timer = timers[ i ];
87c93a029   Dang YoungWorld   add modal
618

f986e111b   TRUONG   add libs
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
  		// 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;
f986e111b   TRUONG   add libs
641
642
  jQuery.fx.start = function() {
  	if ( !timerId ) {
87c93a029   Dang YoungWorld   add modal
643
644
645
  		timerId = window.requestAnimationFrame ?
  			window.requestAnimationFrame( raf ) :
  			window.setInterval( jQuery.fx.tick, jQuery.fx.interval );
f986e111b   TRUONG   add libs
646
647
648
649
  	}
  };
  
  jQuery.fx.stop = function() {
87c93a029   Dang YoungWorld   add modal
650
651
652
653
654
  	if ( window.cancelAnimationFrame ) {
  		window.cancelAnimationFrame( timerId );
  	} else {
  		window.clearInterval( timerId );
  	}
f986e111b   TRUONG   add libs
655
656
657
658
659
660
  	timerId = null;
  };
  
  jQuery.fx.speeds = {
  	slow: 600,
  	fast: 200,
87c93a029   Dang YoungWorld   add modal
661

f986e111b   TRUONG   add libs
662
663
664
665
666
  	// Default speed
  	_default: 400
  };
  
  return jQuery;
87c93a029   Dang YoungWorld   add modal
667
  } );