MediaWiki:Gadget-wikidataHeaderLink.js

Da Wikipedia, l'ençiclopedia libara.

Ocio: Daspò ver salvà, podaria esare neçesario snetare ła cache dal propio navegadore web par vedare i canbiamenti.

  • Firefox / Safari: tegner strucà el boton de łe letare grande Shift e schiciare sora Ricarga, o se nò struca Ctrl-F5 o Ctrl-R (⌘-R so Mac)
  • Google Chrome: strucare Ctrl-Shift-R (⌘-Shift-R so on Mac)
  • Internet Explorer / Edge: tegner strucà el boton Ctrl e schiciare so Ajorna, o sinò Ctrl-F5
  • Opera: Va in tel Menu → Inpostasion (Opera → Prefarense so on Mac) e pò in Privacy & sicuresa → Sneta dati del navegadore → Imajini e file in te ła cache.
/** 
 * Da ru.wiki mod del 21:21, 10 xug 2018
 */
/**
 * Crea on ligamento a l'elemento Wikidata asoçà inte l'intestasion.
 * Se invese no fuse ligà nisun elemento, el juta a fàrghene sù uno in Wikidata.
 */ 
( function ( mw, $ ) {
	var i18n = {
		createLabel: 'Faghe el ełemento'
	};

	$( function () {
		// [[phab:T185437]]
		var itemId = mw.config.get( 'wgWikibaseItemId' );
		if ( !itemId ) {
			var $wdLink = $( '#t-wikibase a' );
			if ( $wdLink.length ) {
				itemId = $wdLink.attr( 'href' ).replace( /^.*\//, '' );
			}
		}
		
		if ( itemId ) {
			$wdInfo = $( '<a>' )
				.text( itemId )
				.attr( 'href', '//www.wikidata.org/wiki/Special:EntityPage/' + itemId );
		} else {
			var namespaces = [ 0, 4, 10, 12, 14, 100, 102, 104, 446, 828 ];
			if ( $.inArray( mw.config.get( 'wgNamespaceNumber' ), namespaces ) === -1 ) {
				return;
			}

			var site = encodeURIComponent( mw.config.get( 'wgDBname' ) );
			var page = encodeURIComponent( mw.config.get( 'wgPageName' ).replace( /_/g, ' ' ) );
			var url = '//www.wikidata.org/w/index.php?title=Special:NewItem'
				+ '&site=' + site + '&page=' + page + '&label=' + page;
			$wdInfo = $( '<a>' )
				.text( i18n.createLabel )
				.attr( 'href', url );
		}
		$( '<small>' )
			.css( {
				color: '#999da2',
				fontSize: '.6em',
				marginLeft: '.6em',
			    unicodeBidi: 'embed'
			} )
			.addClass( 'noprint' )
			.append( ' (' )
			.append( $wdInfo.css( 'color', '#999da2' ) )
			.append( ')' )
			.appendTo( $( '#firstHeading' ) );
	} );
}( mediaWiki, jQuery ) );
Traesto fora da Wikipèdia - L'ençiclopedia łìbara e cołaboradiva in łéngua Vèneta "https://vec.wikipedia.org/w/index.php?title=MediaWiki:Gadget-wikidataHeaderLink.js&oldid=783618"