/* Il codice JavaScript inserito qui viene caricato dagli utenti che usano la skin Vector */
// Codice importato da [[MediaWiki:Monobook.js]]
/* tooltips and access keys */
ta = new Object();
ta['pt-userpage'] = new Array('.','La mia pagina utente');
ta['pt-anonuserpage'] = new Array('.','La pagina utente dell\'ip che stai usando');
ta['pt-mytalk'] = new Array('n','Le mie discussioni');
ta['pt-anontalk'] = new Array('n','Discussioni riguardo le modifiche fatte da questo ip');
ta['pt-preferences'] = new Array('','Le mie preferenze');
ta['pt-watchlist'] = new Array('l','La lista delle pagine che stai tenendo sotto sorveglianza.');
ta['pt-mycontris'] = new Array('y','La lista dei miei contributi');
ta['pt-login'] = new Array('o','Ti consigliamo di registrarti, ma non è obbligatorio.');
ta['pt-anonlogin'] = new Array('o','Ti consigliamo di registrarti, ma non è obbligatorio.');
ta['pt-logout'] = new Array('o','Log out (esci)');
ta['ca-talk'] = new Array('t','Vedi le discussioni relative alla voce');
ta['ca-edit'] = new Array('e','Puoi modificare questa pagina. Per favore usa il bottone di anteprima prima di salvare.');
ta['ca-addsection'] = new Array('+','Aggiungi un commento a questa discussione.');
ta['ca-viewsource'] = new Array('e','Questa pagina è protetta, ma puoi vedere il suo codice sorgente.');
ta['ca-history'] = new Array('h','Versioni precedenti di questa pagina.');
ta['ca-protect'] = new Array('=','Proteggi questa pagina');
ta['ca-delete'] = new Array('d','Cancella questa pagina');
ta['ca-undelete'] = new Array('d','Ripristina la pagina com\'era prima della cancellazione');
ta['ca-move'] = new Array('m','Sposta questa pagina ad un altro titolo');
ta['ca-nomove'] = new Array('','Non hai il permesso di spostare questa pagina');
ta['ca-watch'] = new Array('w','Aggiungi questa pagina all\'elenco delle pagine che tieni sotto sorveglianza');
ta['ca-unwatch'] = new Array('w','Togli questa pagina dall\'elenco delle pagine che tieni sotto sorveglianza');
ta['search'] = new Array('f','Cerca questa wiki');
ta['p-logo'] = new Array('','Pagina Principale');
ta['n-mainpage'] = new Array('z','Visita la Pagina principale');
ta['n-portal'] = new Array('','Descrizione del progetto, cosa puoi fare, e dove trovare le cose');
ta['n-sitesupport'] = new Array('','Aiutaci');
ta['n-recentchanges'] = new Array('r','La lista delle ultime modifiche a questa wiki.');
ta['n-randompage'] = new Array('x','Mostra una pagina a caso');
ta['n-help'] = new Array('a','Pagine di juto, manuale, domande frequenti');
ta['n-villagepump'] = new Array('b','Per discutere di Wikipedia');
ta['n-wikipediano'] = new Array('','Per vedere gli ultimi avvenimenti di Wikipedia');
ta['n-contact'] = new Array('','I contatti di Wikipedia e Wikimedia Italia');
ta['n-vetrina'] = new Array('v','Le migliori voci di Wikipedia');
ta['n-currentevents'] = new Array('','Eventi di attualità');
ta['t-whatlinkshere'] = new Array('j','Lista di tutte le pagine che portano a questa');
ta['t-recentchangeslinked'] = new Array('k','Lista delle ultime modifiche alle pagine linkate da questa.');
ta['feed-rss'] = new Array('','feed RSS per questa pagina');
ta['feed-atom'] = new Array('','feed Atom per questa pagina');
ta['t-contributions'] = new Array('','Lista dei contributi di questo utente');
ta['t-emailuser'] = new Array('','Manda un\'E.mail a questo utente');
ta['t-upload'] = new Array('u','Carica immagini o file multimediali su wikipedia');
ta['t-specialpages'] = new Array('q','Lista di tutte le pagine speciali');
ta['ca-nstab-main'] = new Array('c','Vedi la voce relativa');
ta['ca-nstab-user'] = new Array('c','Vedi la pagina utente');
ta['ca-nstab-media'] = new Array('c','Vedi la pagina del file multimediale');
ta['ca-nstab-special'] = new Array('','Questa è una pagina speciale, non può essere modificata.');
ta['ca-nstab-wp'] = new Array('','Vedi la pagina del progetto');
ta['ca-nstab-image'] = new Array('c','Vedi la pagina dell\'immagine');
ta['ca-nstab-mediawiki'] = new Array('c','Vedi il messaggio di sistema');
ta['ca-nstab-template'] = new Array('c','Vedi il template');
ta['ca-nstab-help'] = new Array('c','Vedi la pagina di juto');
ta['ca-nstab-category'] = new Array('c','Vedi la pagina della categoria');
ta['ca-nstab-portal'] = new Array('c','Vedi il portale');
/*** Collegamento diretto alla pagina di upload di Commons nel menu di sinistra, da WP:PT */
function linkUploadToCommons()
{
if (document.getElementById("carrega-para-commons")) return;
var li_carrega = document.getElementById("t-upload");
if (!li_carrega) return;
var afegit = li_carrega.nextSibling;
var ul_eines = li_carrega.parentNode;
var li = document.createElement("li");
li.id = "carrega-para-commons";
li.innerHTML = '<a href="http://commons.wikimedia.org/wiki/Commons:Upload/it">Carica su Commons</a>';
if (afegit) ul_eines.insertBefore(li, afegit);
else ul_eines.appendChild(li);
}
addLoadEvent(linkUploadToCommons);
/*** Fine del collegamento diretto alla pagina di upload di Commons */
function LinkAdQ()
{
if ( document.getElementById( "p-lang" ) ) {
var InterwikiLinks = document.getElementById( "p-lang" ).getElementsByTagName( "li" );
for ( var i = 0; i < InterwikiLinks.length; i++ ) {
if ( document.getElementById( InterwikiLinks[i].className + "-fa" ) ) {
InterwikiLinks[i].className += " FA"
InterwikiLinks[i].title = "La voce è in vetrina in questa lingua.";
}
}
}
}
addLoadEvent( LinkAdQ );
//============================================================
// Menu caratteri speciali
//============================================================
/**
* Aggiunge il menu a tendina per selezionare un sottoinsieme di caratteri speciali
* Attenzione: l'ordine della lista deve corrispondere a quello di MediaWiki:Edittools !
*/
function aggiungiMenuSubsetCaratteri() {
var specialchars = document.getElementById('specialchars');
if (specialchars) {
var menu = "<select style=\"display:inline\" onChange=\"scegliSubsetCaratteri(selectedIndex)\">";
menu += "<option>Latino esteso</option>";
menu += "<option>Wiki</option>";
menu += "<option>Greco antico</option>";
menu += "<option>Greco moderno</option>";
menu += "<option>Cirillico</option>";
menu += "<option>Arabo</option>";
menu += "<option>Ebraico e yiddish</option>";
menu += "<option>Armeno</option>";
menu += "<option>Geroglifico</option>";
menu += "<option>Vietnamita</option>";
menu += "<option>IPA</option>";
menu += "<option>Matematica</option>";
menu += "</select>";
specialchars.innerHTML = menu + specialchars.innerHTML;
/* default subset - try to use a cookie some day */
scegliSubsetCaratteri(0);
}
}
/* select subsection of special characters */
function scegliSubsetCaratteri(s) {
var l = document.getElementById('specialchars').getElementsByTagName('p');
for (var i = 0; i < l.length ; i++) {
l[i].style.display = i == s ? 'inline' : 'none';
l[i].style.visibility = i == s ? 'visible' : 'hidden';
}
}
addLoadEvent(aggiungiMenuSubsetCaratteri);
// END Menu caratteri speciali
/* Modifica il testo della linguetta "Voce" in "Pagina principale" */
function mainPageTransform(){
var el = document.getElementById('ca-nstab-main');
if (el && wgUserLanguage=='it'){
while (el.firstChild)
el = el.firstChild;
el.nodeValue = "Pagina principale";
}
}
if (wgPageName == "Pagina_principale" || wgPageName == "Discussioni:Pagina_principale")
addOnloadHook(mainPageTransform);
/** "Technical restrictions" title fix *****************************************
*
* Description:
* Maintainers: [[User:Interiot]], [[User:Mets501]]
* copiato da [[:en:MediaWiki:Common.js]]
*/
// For pages that have something like Template:Lowercase, replace the title, but only if it is cut-and-pasteable as a valid wikilink.
// (for instance [[iPod]]'s title is updated. <nowiki>But [[C#]] is not an equivalent wikilink, so [[C Sharp]] doesn't have its main title changed)</nowiki>
//
// The function looks for a banner like this: <nowiki>
// <div id="RealTitleBanner"> <!-- div that gets hidden -->
// <span id="RealTitle">title</span>
// </div>
// </nowiki>An element with id=DisableRealTitle disables the function.
var disableRealTitle = 0; // users can disable this by making this true from their monobook.js
function correctTitle() {
try {
var realTitleBanner = document.getElementById("RealTitleBanner");
if (realTitleBanner && !document.getElementById("DisableRealTitle") && !disableRealTitle) {
var realTitle = document.getElementById("RealTitle");
if (realTitle) {
var realTitleHTML = realTitle.innerHTML;
realTitleText = pickUpText(realTitle);
var isPasteable = 0;
//var containsHTML = /</.test(realTitleHTML); // contains ANY HTML
var containsTooMuchHTML = /</.test( realTitleHTML.replace(/<\/?(sub|sup|small|big|a)>/gi, "") ); // contains HTML that will be ignored when cut-n-pasted as a wikilink
// in più, aggiunto ''a'' per mantenere funzionanti alcuni usi del vecchio Titolo errato - non è detto però che sia sempre voluto
// questo codice era in en.wiki, e se ho ben capito serviva per controllare che il nome nuovo fosse abbastanza simile all'originale, ma non è quello che vogliamo su it.wiki
// // calculate whether the title is pasteable
// var verifyTitle = realTitleText.replace(/^ +/, ""); // trim left spaces
// verifyTitle = verifyTitle.charAt(0).toUpperCase() + verifyTitle.substring(1, verifyTitle.length); // uppercase first character
// questo codice era in en.wiki, e aggiunge il prefisso del namespace se non presente, ma su it.wiki ci si aspetta che ciò non avvenga
// // if the namespace prefix is there, remove it on our verification copy. If it isn't there, add it to the original realValue copy.
// if (wgNamespaceNumber != 0) {
// if (wgCanonicalNamespace == verifyTitle.substr(0, wgCanonicalNamespace.length).replace(/ /g, "_") && verifyTitle.charAt(wgCanonicalNamespace.length) == ":") {
// verifyTitle = verifyTitle.substr(wgCanonicalNamespace.length + 1);
// } else {
// realTitleText = wgCanonicalNamespace.replace(/_/g, " ") + ":" + realTitleText;
// realTitleHTML = wgCanonicalNamespace.replace(/_/g, " ") + ":" + realTitleHTML;
// }
// }
// come sopra, faceva controlli sul titolo
// // verify whether wgTitle matches
// verifyTitle = verifyTitle.replace(/^ +/, "").replace(/ +$/, ""); // trim left and right spaces
// verifyTitle = verifyTitle.replace(/_/g, " "); // underscores to spaces
// verifyTitle = verifyTitle.charAt(0).toUpperCase() + verifyTitle.substring(1, verifyTitle.length); // uppercase first character
// isPasteable = (verifyTitle == wgTitle);
var h1 = document.getElementsByTagName("h1")[0];
if (h1) { // tolto il controllo isPasteable
h1.innerHTML = containsTooMuchHTML ? realTitleText : realTitleHTML;
// if (!containsTooMuchHTML) // ancora, adattamento per it.wiki
realTitleBanner.style.display = "none";
}
document.title = realTitleText + " - Wikipedia";
}
}
} catch (e) {
/* Something went wrong. */
}
}
addOnloadHook(correctTitle);
// similar to innerHTML, but only returns the text portions of the insides, excludes HTML
function pickUpText(aParentElement) {
var str = "";
function pickUpTextInternal(aElement) {
var child = aElement.firstChild;
while (child) {
if (child.nodeType == 1) // ELEMENT_NODE
pickUpTextInternal(child);
else if (child.nodeType == 3) // TEXT_NODE
str += child.nodeValue;
child = child.nextSibling;
}
}
pickUpTextInternal(aParentElement);
return str;
}
/** Fix al layout della Pagina principale *********************************************************
*
* Descrizione: Aggiunge un link alla lista completa di tutte
* le wikipedia in tutte le lingue disponibili.
* Da un codice di: [[en:User:AzaToth]], [[en:User:R. Koot]]
* Sistemato da: [[n:Utente:Tooby]] <--- liberi di giustiziarlo
*/
function mainPageAppendCompleteListLink() {
try {
var node = document.getElementById( "p-lang" )
.getElementsByTagName('div')[0]
.getElementsByTagName('ul')[0];
var aNode = document.createElement( 'a' );
var liNode = document.createElement( 'li' );
aNode.appendChild( document.createTextNode( 'Lista completa' ) );
aNode.setAttribute( 'href' , 'http://meta.wikimedia.org/wiki/Lista_di_Wikipedie' );
liNode.appendChild( aNode );
liNode.className = 'interwiki-completelist';
node.appendChild( liNode );
} catch(e) {
// lets just ignore what's happened
return;
}
}
if ( wgTitle == 'Pagina principale' && wgNamespaceNumber == 0 ) {
addOnloadHook( mainPageAppendCompleteListLink );
}
// Lista di voci trasferite ad altri progetti - caricato solo se si visualizza una pagina nel namespace principale
if (wgNamespaceNumber == 0 && wgTitle != 'Pagina principale' && wgArticleId == 0)
document.write('<script type="text/javascript" src="'
+ 'http://it.wikipedia.org/w/index.php?title=Wikipedia:Proposte di trasferimento/transferlist.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
function show_transfertext()
{
if (wgNamespaceNumber != 0 || (wgNamespaceNumber == 0 && wgTitle == 'Pagina principale') || wgArticleId != 0)
return;
setup_transferlist();
var i;
for(i = 0; i <= transferlist.length; i+=4)
{
if (document.title == 'Modifica di ' + transferlist[i] + ' - Wikipedia' || document.title == transferlist[i] + ' - Wikipedia')
{
var itm = document.getElementById('BoxTrasferimento');
if (itm == null) return;
txt = itm.innerHTML;
if (transferlist[i+1] == 'b' || transferlist[i+1] == 'wb')
transferlist[i+1] = 'http://it.wikibooks.org/wiki/';
if (transferlist[i+1] == 's' || transferlist[i+1] == 'ws')
transferlist[i+1] = 'http://it.wikisource.org/wiki/';
if (transferlist[i+1] == 'q' || transferlist[i+1] == 'wq')
transferlist[i+1] = 'http://it.wikiquote.org/wiki/';
if (transferlist[i+1] == 'n' || transferlist[i+1] == 'wn')
transferlist[i+1] = 'http://it.wikinews.org/wiki/';
if (transferlist[i+1] == 'wikt')
transferlist[i+1] = 'http://it.wiktionary.org/wiki/';
if (transferlist[i+1] == 'v' || transferlist[i+1] == 'wv')
transferlist[i+1] = 'http://it.wikiversity.org/wiki/';
if (transferlist[i+1] == 'wikispecies' || transferlist[i+1] == 'wsp')
transferlist[i+1] = 'http://species.wikimedia.org/wiki/';
if (transferlist[i+1] == 'm' || transferlist[i+1] == 'meta')
transferlist[i+1] = 'http://meta.wikimedia.org/wiki/';
if (transferlist[i+1] == 'commons' || transferlist[i+1] == 'com')
transferlist[i+1] = 'http://commons.wikimedia.org/wiki/';
if (transferlist[i+3] == "")
transferlist[i+3] = transferlist[i];
txt = '<div class="AvvisoTrasferito">Una vecchia versione di questa pagina è stata <b>trasferita</b> ' +
'<a href=' + transferlist[i+1] + transferlist[i+3].replace(/ /g, '_') + '>all\'interno di un altro progetto Wikimedia</a>' +
(transferlist[i+2].length > 1 ? ' perché: <i>' + transferlist[i+2] + '</i>' : "") + //solo se la motivazione è fornita
'. Se ritieni la voce enciclopedica puoi riscriverla, controllando che siano stati eliminati i motivi che ne hanno comportato ' +
'la cancellazione.</div>' + txt;
itm.innerHTML = txt;
break;
}
}
}
addLoadEvent(show_transfertext);
//****************** WIKI MINI ATLAS ******************
document.write('<script type="text/javascript" src="'
+ 'http://meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
/*
Correzione della posizione del link [modifica] delle sezioni.
Copyright 2006, Marc Mongenet
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
See http://www.gnu.org/licenses/gpl.html
The function looks for <span class="editsection">, and move them
at the end of their parent and display them inline in small font.
var oldEditsectionLinks=true disables the function.
*/
setModifySectionStyle = function()
{
try {
if (!(typeof oldEditsectionLinks == 'undefined' || oldEditsectionLinks == false)) return;
var spans = document.getElementsByTagName("span");
for (var s = 0; s < spans.length; ++s) {
var span = spans[s];
if (span.className == "editsection") {
span.style.fontSize = "x-small";
span.style.fontWeight = "normal";
span.style.cssFloat = span.style.styleFloat = "none";
span.parentNode.appendChild(document.createTextNode(" "));
span.parentNode.appendChild(span);
}
}
} catch (e) { /* something went wrong */ }
}
addOnloadHook(setModifySectionStyle);
/*** CODICE PER IL TEMPLATE:GALLERIA ***/
function toggleImage(group, remindex, shwindex) {
document.getElementById("ImageGroupsGr"+group+"Im"+remindex).style.display="none";
document.getElementById("ImageGroupsGr"+group+"Im"+shwindex).style.display="inline";
}
function ImageGroup(){
if (document.URL.match(/printable/g)) return;
var bc=document.getElementById("bodyContent");
var divs=bc.getElementsByTagName("div");
var i = 0, j = 0;
var units, search;
var currentimage;
var UnitNode;
for (i = 0; i < divs.length ; i++) {
if (divs[i].className != "ImageGroup") continue;
UnitNode=undefined;
search=divs[i].getElementsByTagName("div");
for (j = 0; j < search.length ; j++) {
if (search[j].className != "ImageGroupUnits") continue;
UnitNode=search[j];
break;
}
if (UnitNode==undefined) continue;
units=Array();
for (j = 0 ; j < UnitNode.childNodes.length ; j++ ) {
var temp = UnitNode.childNodes[j];
if (temp.className=="center") units.push(temp);
}
for (j = 0 ; j < units.length ; j++) {
currentimage=units[j];
currentimage.id="ImageGroupsGr"+i+"Im"+j;
var imghead = document.createElement("div");
var leftlink;
var rightlink;
if (j != 0) {
leftlink = document.createElement("a");
leftlink.href = "javascript:toggleImage("+i+","+j+","+(j-1)+");";
leftlink.innerHTML="◀";
} else {
leftlink = document.createElement("span");
leftlink.innerHTML=" ";
}
if (j != units.length - 1) {
rightlink = document.createElement("a");
rightlink.href = "javascript:toggleImage("+i+","+j+","+(j+1)+");";
rightlink.innerHTML="▶";
} else {
rightlink = document.createElement("span");
rightlink.innerHTML=" ";
}
var comment = document.createElement("tt");
comment.innerHTML = "("+ (j+1) + "/" + units.length + ")";
with(imghead) {
style.fontSize="110%";
style.fontweight="bold";
appendChild(leftlink);
appendChild(comment);
appendChild(rightlink);
}
currentimage.insertBefore(imghead,currentimage.childNodes[0]);
if (j != 0) currentimage.style.display="none";
}
}
}
addOnloadHook(ImageGroup);
// Toglie "Soggetto/Intestazione" nelle creazioni delle discussioni al Bar
if (wgNamespaceNumber == 4 &&
wgPageName.indexOf("Wikipedia:Bar/") == 0 &&
wgAction == "edit" &&
document.URL.indexOf("§ion=new&preload=") != -1)
addLoadEvent ( function ()
{
document.getElementById('wpSummaryLabel').style.display="none";
document.getElementById('wpSummary').style.display="none";
});
/** Supporto per il Template:Interprogetto ********************************************
*
* Attenzione: questo codice è un "hack", strettamente dipendente dal funzionamento
* della skin Vector; potrebbe smettere di funzionare in caso di modifiche alla skin.
*
* Maintainer: [[Utente:Salvatore Ingala]]
*/
if ( typeof $j != 'undefined' )
$j(document).ready(function(){
try {
if ( $j( '#interProject' ).length == 0 )
return;
//Controlli aggiuntivi sul div 'interProject'
var $ul = $j( '#interProject' ).find( 'ul' );
if ( $ul.length == 0 || $ul.find( 'li' ).length == 0)
return;
var id = 'p-iproject';
var portal = document.createElement( 'div' );
portal.id = id;
var $portal = $j( portal );
var $divbody = $j( document.createElement( 'div' ) );
$divbody.addClass( 'body' )
.append( $j( '#interProject' ).find( 'ul' ) );
$portal.addClass( 'portal' )
.html( '<h5>Altri progetti</h5>' )
.append( $divbody )
.insertAfter( $j('#p-tb') );
//Codice adattato in gran parte da http://bits.wikimedia.org/w/extensions/UsabilityInitiative/Vector/Vector.combined.js
//Se i nav collassabili non sono abilitati, non devo gestire i cookie né l'espansione/riduzione
if (typeof wgVectorEnabledModules != 'undefined' && wgVectorEnabledModules["collapsiblenav"] == true){
//Abilita espansione/collassamento e supporto cookie
var state = $j.cookie( 'vector-nav-' + id );
if(state == 'true' || state == null) //impostazione predefinita: aperto
$portal.addClass( 'expanded' ).find( 'div.body' ).show();
else
$portal.addClass( 'collapsed' );
if(state != null)
$j.cookie( 'vector-nav-' + $j( this ).attr( 'id' ), state, {'expires':30, 'path':'/'});
var toggle = function($element){
$j.cookie('vector-nav-' + $element.parent().attr( 'id' ), $element.parent().is( '.collapsed' ),{'expires':30, 'path':'/'});
$element.parent().toggleClass( 'expanded' ).toggleClass( 'collapsed' ).find( 'div.body' ).slideToggle( 'fast' );
};
$portal.find( 'h5' ).keydown(function(event){
if (event.which==13 || event.which==32)
toggle( $j(this) );
}).mousedown(function(){
toggle( $j(this) );
$j(this).blur();
return false;
});
}
//Ricalcola TabIndex
//Calcola il massimo TabIndex presente, ma escludendo i portal
var maxTI = 0;
$j( '[tabindex]' ).each(function(){
if ($j(this).is( '#mw-panel > div.portal' ))
return;
var ti = parseInt($j(this).attr( 'tabindex' ));
if (ti > maxTI)
maxTI = ti;
});
var tabIndex = maxTI+1;
//Assegna tabIndex incrementali ai portals non persistenti (anche quelli che esistevano prima)
$j( '#mw-panel > div.portal:not(.persistent) > h5' ).each(function(){
$j( this ).attr( 'tabindex', tabIndex++ );
});
} catch(e) {
//non fa nulla
}
});