Code Duplication    Length = 41-50 lines in 2 locations

demo/js/jquery.js 2 locations

@@ 9318-9367 (lines=50) @@
9315
			this.each( doAnimation ) :
9316
			this.queue( optall.queue, doAnimation );
9317
	},
9318
	stop: function( type, clearQueue, gotoEnd ) {
9319
		var stopQueue = function( hooks ) {
9320
			var stop = hooks.stop;
9321
			delete hooks.stop;
9322
			stop( gotoEnd );
9323
		};
9324
9325
		if ( typeof type !== "string" ) {
9326
			gotoEnd = clearQueue;
9327
			clearQueue = type;
9328
			type = undefined;
9329
		}
9330
		if ( clearQueue && type !== false ) {
9331
			this.queue( type || "fx", [] );
9332
		}
9333
9334
		return this.each(function() {
9335
			var dequeue = true,
9336
				index = type != null && type + "queueHooks",
9337
				timers = jQuery.timers,
9338
				data = jQuery._data( this );
9339
9340
			if ( index ) {
9341
				if ( data[ index ] && data[ index ].stop ) {
9342
					stopQueue( data[ index ] );
9343
				}
9344
			} else {
9345
				for ( index in data ) {
9346
					if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
9347
						stopQueue( data[ index ] );
9348
					}
9349
				}
9350
			}
9351
9352
			for ( index = timers.length; index--; ) {
9353
				if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
9354
					timers[ index ].anim.stop( gotoEnd );
9355
					dequeue = false;
9356
					timers.splice( index, 1 );
9357
				}
9358
			}
9359
9360
			// start the next in the queue if the last step wasn't forced
9361
			// timers currently will call their complete callbacks, which will dequeue
9362
			// but only if they were gotoEnd
9363
			if ( dequeue || !gotoEnd ) {
9364
				jQuery.dequeue( this, type );
9365
			}
9366
		});
9367
	},
9368
	finish: function( type ) {
9369
		if ( type !== false ) {
9370
			type = type || "fx";
@@ 9368-9408 (lines=41) @@
9365
			}
9366
		});
9367
	},
9368
	finish: function( type ) {
9369
		if ( type !== false ) {
9370
			type = type || "fx";
9371
		}
9372
		return this.each(function() {
9373
			var index,
9374
				data = jQuery._data( this ),
9375
				queue = data[ type + "queue" ],
9376
				hooks = data[ type + "queueHooks" ],
9377
				timers = jQuery.timers,
9378
				length = queue ? queue.length : 0;
9379
9380
			// enable finishing flag on private data
9381
			data.finish = true;
9382
9383
			// empty the queue first
9384
			jQuery.queue( this, type, [] );
9385
9386
			if ( hooks && hooks.stop ) {
9387
				hooks.stop.call( this, true );
9388
			}
9389
9390
			// look for any active animations, and finish them
9391
			for ( index = timers.length; index--; ) {
9392
				if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
9393
					timers[ index ].anim.stop( true );
9394
					timers.splice( index, 1 );
9395
				}
9396
			}
9397
9398
			// look for any animations in the old queue and finish them
9399
			for ( index = 0; index < length; index++ ) {
9400
				if ( queue[ index ] && queue[ index ].finish ) {
9401
					queue[ index ].finish.call( this );
9402
				}
9403
			}
9404
9405
			// turn off finishing flag
9406
			delete data.finish;
9407
		});
9408
	}
9409
});
9410
9411
// Generate parameters to create a standard animation