ମିଡ଼ିଆଉଇକି:Gadget-ShortUrl.js
ସୂଚନା: ବଦଳଗୁଡ଼ିକ ଦେଖିବା ପାଇଁ ଆପଣଙ୍କୁ ହୁଏତ ନିଜ ବ୍ରାଉଜର କ୍ୟାସ ବାଇପାସ କରିବାକୁ ପଡ଼ିପାରେ ।
- Firefox / Safari: Reload ଉପରେ କ୍ଲିକ କରିବା ବେଳେ Shift ଧରି କିମ୍ବା Ctrl-F5 ବା Ctrl-R ଦବାନ୍ତୁ (Macରେ ⌘-R)
- Google Chrome: Ctrl-Shift-R ଦବାନ୍ତୁ (Macରେ ⌘-Shift-R)
- Internet Explorer / Edge: Refresh ଉପରେ କ୍ଲିକ କଲା ବେଳେ Ctrl ଧରି ବା Ctrl-F5 ଦବାଇ
- Opera: Ctrl-F5 ଦବାନ୍ତୁ ।
/* _____________________________________________________________________________
* | |
* | === चेतावनी: ग्लोबल गैजेट फ़ाइल === |
* | इसमें किए बदलाव कई सदस्यों को प्रभावित करेंगे। |
* | इसमें बदलाव करने से पहले कृपया वार्ता पृष्ठ पे अथवा चौपाल पे बदलावों से सम्बन्धित चर्चा कर लें |
* |_____________________________________________________________________________|
*
*/
( 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( 'ଛୋଟ URL: ' + window.location.protocol + url )
.append( $( '<a>' )
.attr( {
'class': 'title-shortlink title-shortlink-help-link',
'id': 'title-shortlink-help-link',
'href': '//or.wikipedia.org/wiki/ସହଯୋଗ:ଛୋଟ URL',
'target': '_blank'
} )
);
//add tooltip to document
$( '#firstHeading' ).append( $icon );
$( 'body' ).prepend( $tooltip.hide() );
// settimeout idea...
// http://stackoverflow.com/questions/6786322#comment8062858_6786647
$( '.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