Usuário:ZioNicco/common.js
Aspeto
Nota: Depois de publicar, poderá ter de contornar a cache do seu navegador para ver as alterações.
- Firefox / Safari: Pressione Shift enquanto clica Recarregar, ou pressione Ctrl-F5 ou Ctrl-R (⌘-R no Mac)
- Google Chrome: Pressione Ctrl-Shift-R (⌘-Shift-R no Mac)
- Edge: Pressione Ctrl enquanto clica Recarregar, ou pressione Ctrl-F5.
/*
Collegamento all'elemento di Wikidata
*/
( function ( mw, $ ) {
var wiki = 'ptwiki'; //codice di lingua della tua wiki
var namespace = mw.config.get( 'wgCanonicalNamespace' );
if( namespace === '' ) {
var page = mw.config.get( 'wgTitle' );
} else {
var page = namespace + ':' + mw.config.get( 'wgTitle' );
}
$.ajax( {
url: '//www.wikidata.org/w/api.php',
data: {
'format': 'json',
'action': 'wbgetentities',
'sites': wiki,
'titles': page,
'language': mw.config.get( 'wgPageContentLanguage' )
},
dataType: 'jsonp',
success: function( data ) {
if( data.success ) {
for( var i in data.entities ) {
if( i != -1 ) {
mw.util.addPortletLink( 'p-tb', '//www.wikidata.org/wiki/' + data.entities[i].title, 'Wikidata' );
}
}
}
}
} );
} ( mediaWiki, jQuery ) );
/*
Info elemento Wikidata
*/
mw.loader.load("//www.wikidata.org/w/index.php?title=User:Yair rand/WikidataInfo.js&action=raw&ctype=text/javascript");