वापरपी:The Discoverer/ShortUrl.js

विकिपीडिया कडल्यान

चत्राय: सांबाळ्ळ्या उपरांत, तुका घडयेक तुज्या ब्रावसराचो कॅश कडसरावंक पडत बदल पळोंवचे खातीर.

  • Firefox / Safari: Shift > धर Reload क्लीक करताना, वा दाम Ctrl-F5 वा Ctrl-R (⌘-R मॅक-आचेर)
  • Google Chrome: Ctrl-Shift-R दाम (⌘-Shift-R एका मॅक-आचेर)
  • Internet Explorer: Ctrl dhor Refresh क्लीक करताना, वा दाम Ctrl-F5
  • Opera: हांगा वच: Menu → Settings (Opera → Preferences मॅक-आचेर) आनी उपरांत Privacy & security → Clear browsing data → Cached images and files.‎
( function ( window, document, $, undefined ) { // Wrap with anonymous function
$( document ).ready(function () {
	'use strict';
	//get url from sidebar
	var url = $("li#t-shorturl").children().attr("href");

	//return if short url doesn't exist, or user's not in the view tab
	if ( url === undefined ||
		mw.config.get("wgAction") !== "view" ||
		window.location.href.match("diff=") !== null ) {
		return;
	}

	//create html elements
	var timeoutID = null,
		$icon = $( '<span>' )
					.addClass('title-shortlink')
					.addClass('title-shortlink-icon'),
		$tooltip = $( '<span>' )
						.addClass('title-shortlink')
						.addClass('title-shortlink-tooltip')
						.html( 'ShortURL: ' + window.location.protocol + url )
						.append( $( '<a>' )
							.attr( {
								'class': 'title-shortlink title-shortlink-help-link',
								'id': 'title-shortlink-help-link',
								'href': '//gom.wikipedia.org/wiki/Help:Short_URL',
								'target': '_blank'
							} )
						);
	//add tooltip to document
	$( '#firstHeading' ).append( $icon );
	$( 'body' ).prepend( $tooltip.hide() );

	$( '.title-shortlink' ).mouseover( function() {
		var $offset = $icon.offset(),
			left;
		if ( timeoutID !== null ) {
			clearTimeout( timeoutID );
			timeoutID = null;
		}
		$icon.animate( { opacity: 1 }, 400 );
		left = ( $offset.left + $tooltip.width() > window.innerWidth ) ?
				$offset.left - $tooltip.width() :
				$offset.left;
		$tooltip
			.css( {
				'top' : $offset.top + $icon.height() + 'px',
				'left' : left + 'px'
			} )
			.show();
	} );

	$( '.title-shortlink' ).mouseleave( function() {
		timeoutID = setTimeout ( function () {
			$tooltip.fadeOut( 400,
				function () {
					$icon.animate( { opacity: 0.5 }, 400 );
				}
			);
		}, 500);
	} );
} );
} ( window, document, jQuery )); // End wrap with anonymous function
"https://gom.wikipedia.org/w/index.php?title=वापरपी:The_Discoverer/ShortUrl.js&oldid=173539" चे कडल्यान परतून मेळयलें