सदस्य:Siddhartha Ghai/ShortUrl.js

मुक्त ज्ञानकोश विकिपीडिया से

सूचना: यह पृष्ठ सुरक्षित करने बाद, परिवर्तनों को देखने लिए ब्राउज़र का कैश ख़ाली करने की आवश्यकता हो सकती है।

  • मोज़िला / फ़ायरफ़ॉक्स / सफ़ारी: shift hold करें जब आप reload क्लिक करते है, या Ctrl-Shift-R (अपल मैक में Cmd-Shift-R) दबाएँ;
  • गूगल क्रोम: Ctrl-shift-R (मैक में Cmd-Shift-R) दबाएँ
  • इंटरनेट एक्सप्लोरर: Ctrl hold करें जब आप refresh क्लिक करते हैं, या Ctrl-F5 क्लिक करते हैं;
  • कॉङ्करर: सिर्फ़ Reload बटन पर क्लिक करें, या F5 क्लिक करें;
  • ऑपरा सदस्य को Tools→Preferences में सम्पूर्ण कैश ख़ाली करने की ज़रूरत हो सकती है।
/*  _____________________________________________________________________________
 * |                                                                             |
 * |                    === चेतावनी: ग्लोबल गैजेट फ़ाइल ===                            |
 * |                  इसमें किए बदलाव कई सदस्यों को प्रभावित करेंगे।                        |
 * | इसमें बदलाव करने से पहले कृपया वार्ता पृष्ठ पे अथवा चौपाल पे बदलावों से सम्बन्धित चर्चा कर लें      |
 * |_____________________________________________________________________________|
 *
 */
( 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 = $( '<a>' )
					.attr('id','title-shortlink-icon')
					.addClass('title-shortlink')
					.addClass('title-shortlink-icon')
					.tipsy( {title: function() {return 'छोटा यू॰आर॰एल: ' + window.location.protocol + url + '<a class="title-shortlink-help-link" href="//hi.wikipedia.org/wiki/सहायता:छोटा_यू॰आर॰एल"></a>';},
							html: true,
							delayOut: 5000,
							className:'title-shortlink'
					} );

	$( '#firstHeading' ).append( $icon );

} );
} ( window, document, jQuery )); // End wrap with anonymous function