ব্যবহারকারী:Mahir256/Gadget-internalLinkHelper-redtipsy.js

লক্ষ্য করুন: প্রকাশ করার পর, পরিবর্তনগুলো দেখতে আপনাকে আপনার ব্রাউজারের ক্যাশে পরিষ্কার করার প্রয়োজন হতে পারে।

  • ফায়ারফক্স / সাফারি: পুনরায় লোড-এ ক্লিক করার সময় শিফট টিপে ধরে রাখুন, অথবা হয় Ctrl-F5 বা Ctrl-R টিপুন (ম্যাকে ⌘-R টিপুন)
  • গুগল ক্রোম: Ctrl-Shift-R (ম্যাকে ⌘-Shift-R) টিপুন
  • ইন্টারনেট এক্সপ্লোরার / এজ: Ctrl ধরে রাখা অবস্থায় Refresh-এ ক্লিক করুন, অথবা Ctrl-F5 টিপুন
  • অপেরা: Ctrl-F5 টিপুন।
( function( $, mw, window ) { $( function() {

	mw.hook( 'wikipage.content' ).add( function( $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>'
						+ $( '<span/>' ).text( origTitle ).html()
						+ 'পাওয়া যাচ্ছে না এখন; আপনি ' 
						+ $( '<span/>' ).text( langName ).html()
						+ ' উইকিপিডিয়াতে আরো দেখতে পারেন:'
						+ $foreignSpan.html()
						+ '。</div>';
				}
			} )
			.mouseleave( mouseleave ).mouseenter( mouseenter );
		} );
	} );
} ); } )( jQuery, mediaWiki, window );