User:PhiLiP/Gadget-internalLinkHelper-redtipsy.js

注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google ChromeFirefoxMicrosoft EdgeSafari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
( function( $, mw, window ) { $( function() {

	mw.hook( 'wikipage.content' ).add( function( $content ) {
		var delayIn = mw.getConfig( 'ilhDelayIn', 0 ),
			delayOut = mw.getConfig( 'ilhDelayOut', 500 );

		$( '.ilh-all', $content ).not( '.ilh-blue' ).each( function() {
			var $this = $( this ),
				origTitle = $this.data( 'orig-title' ),
				foreignTitle = $this.data( 'foreign-title' ),
				langName = $this.data( 'lang-name' ),
				$linkAnchor = $( '.ilh-page a', this ),
				$foreignSpan = $( '.ilh-link', this ),
				innerHtml = wgULS(
					'条目“$1”尚未创建,可参考$2维基百科的对应页面:$3。',
					'條目「$1」尚未創建,可參考$2維基百科的對應頁面:$3。' )
				.replace( '$1', origTitle )
				.replace( '$2', langName )
				.replace( '$3', $foreignSpan.html() );

			$linkAnchor
			.tipsy( {
				className: 'ilh-tipsy',
				gravity: 'nw',
				html: true,
				trigger: 'hover',
				delayIn: delayIn,
				delayOut: delayOut,
				title: function() {	return '<div>' + innerHtml + '</div>'; }
			} )
			.mouseenter( function() {
				// at most 1 tip can be displayed in the same time
				$( '.ilh-all:not(.ilh-blue) .ilh-page a', $content )
				.not( this ).tipsy( 'hide' );
			} );
		} );
	} );
} ); } )( jQuery, mediaWiki, window );