MediaWiki:Gadget-InterProject-core.js: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
compatibilità solo con vector, vedi talk
rimuovo aggiornamento link, poco utile e comunque non funzionante dal 2018
Riga 1:
/**
* Legge gli interlink generati dal modulo:Interprogetto e li aggiunge alla sidebar se mancanti
* Workaround for [[bugzilla:708]] via [[Template:InterProject]].
* OriginallyBasato basedsul oncodice code fromin [[wikt:de:MediaWiki:Common.js]] bydi [[wikt:de:User:Melancholie]],
* MaintainersAltri contributori: [[User:Krinkle]], [[User:Ilmari Karonen]], [[User:Andyrom75]]
* cleaned up and modified for compatibility with the Vector skin.
*
* Maintainers: [[User:Krinkle]], [[User:Ilmari Karonen]]
* Modified by: [[User:Andyrom75]]: modifica i link di quello beta, aggiunge i progetti mancanti, se spcificati nell'interprogetto, senza crearne il menù
*/
/* global mediaWiki, jQuery */
Line 11 ⟶ 8:
( function ( mw, $ ) {
'use strict';
 
function updateOtherProjectsFromTemplate() {
// Aggiorna i link dei progetti presenti su Wikidata
$( '.wb-otherproject-wikibooks a' ).attr( 'href', $( "#interProject div ul li:contains('Wikibooks') a" ).attr( 'href' ) );
$( '.wb-otherproject-wikisource a' ).attr( 'href', $( "#interProject div ul li:contains('Wikisource') a" ).attr( 'href' ) );
$( '.wb-otherproject-wikiquote a' ).attr( 'href', $( "#interProject div ul li:contains('Wikiquote') a" ).attr( 'href' ) );
$( '.wb-otherproject-wikinews a' ).attr( 'href', $( "#interProject div ul li:contains('Wikinotizie') a" ).attr( 'href' ) );
$( '.wb-otherproject-commons a' ).attr( 'href', $( "#interProject div ul li:contains('Commons') a" ).attr( 'href' ) );
$( '.wb-otherproject-wikivoyage a' ).attr( 'href', $( "#interProject div ul li:contains('Wikivoyage') a" ).attr( 'href' ) );
$( '.wb-otherproject-species a' ).attr( 'href', $( "#interProject div ul li:contains('Wikispecies') a" ).attr( 'href' ) );
$( '.wb-otherproject-meta a' ).attr( 'href', $( "#interProject div ul li:contains('Meta-Wiki') a" ).attr( 'href' ) );
$( '.wb-otherproject-mediawiki a' ).attr( 'href', $( "#interProject div ul li:contains('Mediawiki') a" ).attr( 'href' ) );
$( '.wb-otherproject-wikiversity a' ).attr( 'href', $( "#interProject div ul li:contains('Wikiversità') a" ).attr( 'href' ) );
$( '.wb-otherproject-wiktionary a' ).attr( 'href', $( "#interProject div ul li:contains('Wikizionario') a" ).attr( 'href' ) );
}
 
function buildOtherProjectsFromTemplate() {
Line 53 ⟶ 35:
 
if ( $( '#p-wikibase-otherprojects' ).length ) {
// da integrare i link principali mancanti senza creare la sezione nella sidebar
updateOtherProjectsFromTemplate();
} else {
mw.loader.using( 'mediawiki.api' )
Line 61 ⟶ 43:
.done( buildOtherProjectsFromTemplate )
.fail( function () {
console.error( 'Impossibile avviare l\'accessorio InterProject.' );
} );
}