Wiki - KEONHACAI COPA

Thành viên:MeigyokuThmn/Gadget-internalLinkHelper-redtipsy.js

( function( $, mw, window ) { $( function() {

	mw.hook( 'wikipage.content' ).add( function( $content ) {
		console.log($content)
		$( '.ilh-all', $content ).not( '.ilh-blue' ).on( 'internalLinkHelper-close', function( event ) {
			var $this = $( this );
			if ( $this.data( 'internalLinkHelper-showing' ) ) {
				$( this ).removeClass( 'ilh-active' ).find( '.ilh-page a' ).tipsy( 'hide' ).end()
					.data( 'internalLinkHelper-showing', false );
			}
		} ).each( function() {
			var origTitle = $( this ).data( 'orig-title' ),
				$foreignSpan = $( '.ilh-link', this ),
				$linkAnchor = $( '.ilh-page a', this ),
				$langSpan = $( '.ilh-lang', this ),
				langName = $langSpan.text(),
				$that = $( this ).data( 'internalLinkHelper-showing', false );

			if ( !$linkAnchor.length ) {
				return;
			}

			var timeout = null;
			
			var maybeClearTimeout = function() {
				if ( timeout !== null ) {
					clearTimeout( timeout );
				}
			}, autoSetTimeout = function() {
				maybeClearTimeout();
				timeout = setTimeout.apply( null, arguments );
			};
			
			var mouseleave = function() {
				autoSetTimeout( function() {
					$that.trigger( 'internalLinkHelper-close' );
				}, 500 );
			}, mouseenter = function() {
				if ( $that.data( 'internalLinkHelper-showing' ) ) {
					maybeClearTimeout();
				} else {
					$( '.ilh-all', $content ).not( $that ).trigger( 'internalLinkHelper-close' );
					$that.addClass( 'ilh-active' ).data( 'internalLinkHelper-showing', true );
					$linkAnchor.tipsy( 'show' ).tipsy( true ).tip().mouseleave( mouseleave ).mouseenter( mouseenter );
				}
			};
			$linkAnchor.tipsy( {
				className: 'ilh-tipsy',
				gravity: 'nw',
				html: true,
				trigger: 'manual',
				title: function() {
					return '<div>'
						+ 'Mục "'
						+ $( '<span/>' ).text( origTitle ).html()
						+ '" chưa được tạo,<br/>bạn có thể tham khảo trang Wikipedia '
						+ $( '<span/>' ).text( langName ).html()
						+ ' tương ứng: '
						+ $foreignSpan.html()
						+ '.</div>';
				}
			} )
			.mouseleave( mouseleave ).mouseenter( mouseenter );
		} );
	} );
} ); } )( jQuery, mediaWiki, window );
Wiki - Keonhacai copa chuyên cung cấp kiến thức thể thao, keonhacai tỷ lệ kèo, bóng đá, khoa học, kiến thức hằng ngày được chúng tôi cập nhật mỗi ngày mà bạn có thể tìm kiếm tại đây có nguồn bài viết: https://vi.wikipedia.org/wiki/Th%C3%A0nh_vi%C3%AAn:MeigyokuThmn/Gadget-internalLinkHelper-redtipsy.js