使用者:小躍/Text-animated.js

Chhiùng Wikipedia lòi

Chu-yi: Chhai tú-chhùn yî-heu, ngì pit-sî khoai chhái-chhí chhîn-chhù hi-khí chhòi-nèn khon-tó chok-chhut ke kói-pien. Mozilla / Firefox / Safari: on-tén Shift chai tiám-kit Chhùng-sîn chṳ́n-lî (fe̍t-chá on-hâ Ctrl-Shift-R, chhai Phìn-kó Mac song on-hâ Cmd-Shift-R); IE: on-tén Ctrl chai tiám-kit Chhùng-sîn chṳ́n-lî, fe̍t-he on-hâ Ctrl-F5Konqueror: chak sî-yeu tiám-kit Chhùng-sîn chṳ́n-lî; Opera: yung-fu sî-yeu chhai kûng-khí-sat-thin chûng vàn-cháng-thi chhîn-chhù ke khoai-chhí.

/*導自http://minecraft-zh.gamepedia.com/MediaWiki:Common.js中帶有文字自動化的內容。*/
importStylesheet('User:小躍/Text-animated.css');

/**
 * Instead of cluttering up the global scope with
 * variables, they should instead be set as a
 * property of this global variable
 *
 * E.g: Instead of
 *   myVar = 'blah';
 * use
 *   mcw.myVar = 'blah';
 */
var mcw = window.mcw = {};


/* Keep track of delegated events on dynamic content */
mcw.events = {};
/**
 * Element animator
 *
 * Will cycle the active class on any child elements
 * within an element with the animated class.
 */
( function() {
	if ( !mcw.animate ) {
		mcw.animate = setInterval( function() {
			$( '.animated' ).each( function() {
				var $elem = $( this );
				var $current = $elem.children( '.active' );
				var $next = $current.nextAll( ':not(.skip):first' );
				// Loop back to the start
				if ( !$next.length ) {
					$next = $elem.children( ':not(.skip):first' );
				}
				$current.removeClass( 'active' );
				$next.addClass( 'active' );
			} );
		}, 5000 );
	}
}() );

/**
 * Pause grid GUI templates (e.g. [[Template:Grid/Crafting Table]]) on mouseover
 *
 * This is so people have a chance to look at each image on the cell
 * and click on pages they want to view.
 */
$( '#mw-content-text' ).on( {
	'mouseenter': function() { 
		$( this ).find( '.animated' ).removeClass( 'animated' ).addClass( 'paused' );
	},
	'mouseleave': function() {
		$( this ).find( '.paused' ).removeClass( 'paused' ).addClass( 'animated' );
	}
}, '.grid-generic, .grid-Crafting_Table, .grid-Furnace, .grid-Brewing_Stand, .mcui' );