/*

<nowiki> */

/**
 * Derivato dal monobook.js di [[:en:User:Wayward]], basato su [[:en:User:Alphax/monobook.js]]
 * Necessita dell'[[Wikipedia:Monobook.js/monobook.css|apposito monobook.css]]
 * Testato su Firefox e IE
 * Contiene codice preso dagli script di [[Utente:Salvatore Ingala]], [[Utente:Paulatz]], [[Utente:Helios89]], [[Utente:Timendum]], [[Utente:Senpai]], [[Utente:Kiado]], [[Utente:Pietrodn]]
 * Reso modulare ed elaborato da [[Utente:Jalo]]
 * Forked from [[User:ABCD/monobook.js]] around April 2005
 * Dual licensed under the GFDL and GPL
 */

/** VARIABILI GLOBALI **/


var httpsext = '';
if(window.___location.protocol == 'https:') {
  httpsext = '/wikipedia/it';
}

// Utilities del monobook<br/>
// Vedi [[Wikipedia:Monobook.js/Utils.js]]
document.write('<script type="text/javascript" src="'
    + 'http://it.wikipedia.org/w/index.php?title=Wikipedia:Monobook.js/Utils.js'
    + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

//script per il conteggio dei wikilink doppi
if (document.title.indexOf("Modifica") != -1) //usato solo in modifica
document.write('<script type="text/javascript" src="'
    + 'http://it.wikipedia.org/w/index.php?title=Wikipedia:Monobook.js/WikilinkDoppi.js'
    + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');


//Questa variabile contiene il nome del browser utilizzato. Molto utile per evitare problemi
// di incompatibilita' tra la varie funzioni Javascript
// Si autovalorizza. Le sottovariabili da usare sono "BrowserDetect.browser", "BrowserDetect.version"
// e "BrowserDetect.OS"
var BrowserDetect = {
    init: function () {
        this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
        this.version = this.searchVersion(navigator.userAgent)
            || this.searchVersion(navigator.appVersion)
            || "an unknown version";
        this.OS = this.searchString(this.dataOS) || "an unknown OS";
    },
    searchString: function (data) {
        for (var i=0;i<data.length;i++)    {
            var dataString = data[i].string;
            var dataProp = data[i].prop;
            this.versionSearchString = data[i].versionSearch || data[i].identity;
            if (dataString) {
                if (dataString.indexOf(data[i].subString) != -1)
                    return data[i].identity;
            }
            else if (dataProp)
                return data[i].identity;
        }
    },
    searchVersion: function (dataString) {
        var index = dataString.indexOf(this.versionSearchString);
        if (index == -1) return;
        return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
    },
    dataBrowser: [
        {     string: navigator.userAgent,
            subString: "OmniWeb",
            versionSearch: "OmniWeb/",
            identity: "OmniWeb"
        },
        {
            string: navigator.vendor,
            subString: "Apple",
            identity: "Safari"
        },
        {
            prop: window.opera,
            identity: "Opera"
        },
        {
            string: navigator.vendor,
            subString: "iCab",
            identity: "iCab"
        },
        {
            string: navigator.vendor,
            subString: "KDE",
            identity: "Konqueror"
        },
        {
            string: navigator.userAgent,
            subString: "Firefox",
            identity: "Firefox"
        },
        {
            string: navigator.vendor,
            subString: "Camino",
            identity: "Camino"
        },
        {        // for newer Netscapes (6+)
            string: navigator.userAgent,
            subString: "Netscape",
            identity: "Netscape"
        },
        {
            string: navigator.userAgent,
            subString: "MSIE",
            identity: "Explorer",
            versionSearch: "MSIE"
        },
        {
            string: navigator.userAgent,
            subString: "Gecko",
            identity: "Mozilla",
            versionSearch: "rv"
        },
        {         // for older Netscapes (4-)
            string: navigator.userAgent,
            subString: "Mozilla",
            identity: "Netscape",
            versionSearch: "Mozilla"
        }
    ],
    dataOS : [
        {
            string: navigator.platform,
            subString: "Win",
            identity: "Windows"
        },
        {
            string: navigator.platform,
            subString: "Mac",
            identity: "Mac"
        },
        {
            string: navigator.platform,
            subString: "Linux",
            identity: "Linux"
        }
    ]

};
BrowserDetect.init();

/**** Inizializzazione ****/

//Alias di document.getElementById
$ = function(id){
    return document.getElementById(id);
};


//Ritorna true se la variabile toLoad contiene l'opzione str
mustLoad = (function(){
    mustLoadCache = {};
    var A = toLoad ? toLoad.split(' ') : [];
    for(var i = 0; i < A.length; i++)
        if (A[i])
            mustLoadCache[A[i]] = true;
    return function(str){
        return mustLoadCache[str] === true;
    };
})();


/** Codice di compatibilità con WikEd **/
//Copia dal frame di wikEd (http://en.wikipedia.org/wiki/User:Cacycle/wikEd.js) alla wpTextbox1 textarea
function WEUpdateTextarea(){
  if (typeof(wikEdUseWikEd) != 'undefined')
    if (wikEdUseWikEd == true)
      WikEdUpdateTextarea();
}


//Copia la wpTextbox1 textarea nel frame del wikEd
function WEUpdateFrame(){
  if (typeof(wikEdUseWikEd) != 'undefined')
    if (wikEdUseWikEd == true)
      WikEdUpdateFrame();
}

/**** Carica le funzioni personalizzate ****/

//Codice adattato da Prototype 1.6.0, http://www.prototypejs.org/
//Distribuito con licenza MIT-style
(function() {
  /* Support for the DOMContentLoaded event is based on work by Dan Webb,
     Matthias Miller, Dean Edwards and John Resig. */

  var timer, fired = false;

  function fireContentLoadedEvent() {
    if (fired) return;
    if (timer) window.clearInterval(timer);
    contentLoaded();
    fired = true;
  }

  if (document.addEventListener) {
    if (navigator.userAgent.indexOf('AppleWebKit/') > -1) {
      timer = window.setInterval(function() {
        if (/loaded|complete/.test(document.readyState))
          fireContentLoadedEvent();
      }, 0);

      window.addEventListener('load', fireContentLoadedEvent, false);

    } else {
      document.addEventListener("DOMContentLoaded",
        fireContentLoadedEvent, false);
    }

  } else {
    document.write("<script id=__onDOMContentLoaded defer src=//:><\/script>");
    $("__onDOMContentLoaded").onreadystatechange = function() {
      if (this.readyState == "complete") {
        this.onreadystatechange = null;
        fireContentLoadedEvent();
      }
    };
  }
})();

function contentLoaded(){
    saveHistoryToCookie(); //memorizza le pagine visitate in un cookie
    changeLinks();
    addNavBarLinks();
    addToolBoxLinks();

    if(wgNamespaceNumber != -1){ //non nelle pagine speciali
        if (mustLoad("ns0")) addEditSection0();
        if (mustLoad("led")) lastEdit();
        if (mustLoad("purg")) addPurge();
        if (mustLoad("tabs")) add_tabs();
    }

    if (mustLoad("chat")) addChat();
    if (mustLoad("since")) addSince();
    if (mustLoad("allp")) setup_allpages_button();

    ta['pt-logout'] = ['x', 'Logout (esci)']; //cambia l'accesskey per "logout"
    akeytt();
}



//Modifica la sezione 0 della pagina
function addEditSection0(){
    if(!$('ca-history'))
        return;
    var newLink = wgServer + wgScript + '?title=' + wgPageName + '&action=edit&section=0';
    addPortletLink('p-cactions', newLink, '0', 'ca-edit-0', 'Modifica la sezione 0');
}

/** AutoComplete: Based on http://www.webreference.com/programming/javascript/gr/column5/ **/
function AutoComplete(db, oText, /* optional */ nMaxSize){
    this.oText = oText;
    this.nMaxSize = nMaxSize || 20;

    var oDiv = document.createElement('div');
    oDiv.style.border = '2px solid green';
    oDiv.style.position = 'absolute';
    oDiv.style.visibility = 'hidden';
    oDiv.style.backgroundColor = 'white';
    this.oDiv = oDiv;
    oText.parentNode.insertBefore(oDiv, oText.nextSibling);

    this.db = db.sort();
            
    oText.AutoComplete = this;
    oText.onkeyup = AutoComplete.prototype.onTextChange;
    oText.onblur = AutoComplete.prototype.onTextBlur;
};

AutoComplete.prototype.onTextBlur = function(){ this.AutoComplete.onblur(); };
AutoComplete.prototype.onblur = function(){ this.oDiv.style.visibility = "hidden"; };
AutoComplete.prototype.onTextChange = function(){ this.AutoComplete.onchange(); };
AutoComplete.prototype.onDivMouseDown = function(){ this.AutoComplete.oText.value = this.innerHTML; };
AutoComplete.prototype.onDivMouseOver = function(){ this.style.backgroundColor = 'lime'; };
AutoComplete.prototype.onDivMouseOut = function(){ this.style.backgroundColor = 'white'; };
AutoComplete.prototype.onchange = function(){
    var txt = this.oText.value;
    
    var aStr = [];
    for(var i = 0; i < this.db.length; i++)
        if(this.db[i].toLowerCase().indexOf(txt.toLowerCase()) == 0)
            aStr.push(this.db[i]);
    
    var nCount = aStr.length;
    if ((this.nMaxSize == -1) || ((nCount < this.nMaxSize) && (nCount > 0))){
        while (this.oDiv.hasChildNodes())
            this.oDiv.removeChild(this.oDiv.firstChild);
                    
        var i, n = aStr.length;
        for (i = 0; i < n; i++){
            var d = document.createElement('div');
            this.oDiv.appendChild(d);
            d.appendChild(document.createTextNode(aStr[i]));
            d.onmousedown = AutoComplete.prototype.onDivMouseDown;
            d.onmouseover = AutoComplete.prototype.onDivMouseOver;
            d.onmouseout = AutoComplete.prototype.onDivMouseOut;
            d.AutoComplete = this;          
        }
        this.oDiv.style.left = this.oText.offsetLeft+'px'; //NON-STANDARD! offsetLeft
        this.oDiv.style.top = (this.oText.offsetTop+this.oText.clientHeight)+'px'; //NON-STANDARD! offsetTop e clientHeight
        this.oDiv.style.visibility = "visible";
    }
    else {
        this.oDiv.innerHTML = "";
        this.oDiv.style.visibility = "hidden";
    }
};

/** AutoComplete END **/

// Recupera il valore di un cookie
function GetCookie(name)
{
  var cookie = ' ' + document.cookie;
  var search = ' ' + name + '=';
  var setStr = '';
  var offset = 0;
  var end = 0;
  offset = cookie.indexOf(search);
  if (offset != -1)
  {
    offset += search.length;
    end = cookie.indexOf(';', offset)
    if (end == -1)
      end = cookie.length;
    setStr = cookie.substring(offset, end);
    setStr = setStr.replace(/\\+/g, ' ');
    setStr = decodeURIComponent(setStr);
  }
  return(setStr);
}

// Setta il valore di un cookie
function SetCookie(name, value, expires, path, ___domain, secure)
{
  var cookie = name + '=' + encodeURIComponent(value);
  if (expires != null)
    cookie += '; expires=' + expires
  if (path != null)
    cookie += '; path=' + path;
  if (___domain != null)
    cookie += '; ___domain=' + ___domain;
  if (secure != null)
    cookie += '; secure';
  document.cookie = cookie;
}

/** WikiHistory **/
function getHistoryFromCookie(){
    var c = GetCookie("wikiHistory");
    var hist = c ? c.split('#') : [];
    for(var i = 0; i < hist.length; i++)
        hist[i] = decodeURIComponent(hist[i]);
    return hist;
}

function saveHistoryToCookie(){
    if(wgNamespaceNumber < 0) return;
    var c = GetCookie("wikiHistory"), i;
    var h = c ? c.split('#') : [];
    var current = encodeURIComponent(wgPageName.replace(/_/g, ' ')), found = -1;
    for(i = 0; i < h.length; i++)
        if(h[i] == current){
            found = i; break;
        }
    if(found == -1)
        h.push(current);
    else
        h[found] = null;
    var newh = [];
    for(i = Math.max(0, h.length - 100); i < h.length; i++)
        if(h[i] != null)
            newh.push(h[i]);
    var expire = new Date(); // scadenza del cookie
    expire.setTime(expire.getTime() + (60 * 60 * 1000)); //scadenza di un'ora
    SetCookie('wikiHistory', newh.join('#'), expire.toGMTString(), '/');
}

/** WikiHistory END **/



/**** Personalizza i link della barra personale ****/
function changeLinks()
{
    if (mustLoad("lks"))
    {
        // Modifica i link
        $('pt-mytalk').firstChild.innerHTML = 'discussioni';
        $('pt-preferences').firstChild.innerHTML = 'preferenze';
        $('pt-watchlist').firstChild.innerHTML = 'osservati speciali';
        $('pt-mycontris').firstChild.innerHTML = 'contributi';
    }
    if (mustLoad("orol"))
    {
        // Aggiunge l'orologio
        addPortletLink('p-personal', wgServer + wgScriptPath + '/index.php?title=' + wgPageName + '&action=purge', '', 'utcdate');
        showtime();
    }
}

/**** Aggiunge il tab "purge" ****/
function addPurge(){
    if(!$('ca-history'))
        return;
    var newLink = wgServer + wgScript + '?title=' + wgPageName + '&action=purge';
    addPortletLink('p-cactions', newLink, 'purge', 'ca-purge', 'Pulisci la cache', 'g');
}

/**** Aggiunge il tab "ultima modifica" ****/
function lastEdit(){
    if(!$('ca-history'))
        return;
    var newLink = wgServer + wgScript + '?title=' + wgPageName + '&diff=0';
    addPortletLink('p-cactions', newLink, 'ultima modifica', 'ca-ledit', 'Ultima modifica', 'u');
}

/**** Menu "strumenti vari" ****/
//Sostituzioni automatiche
function fixformat(){
    WEUpdateTextarea();

    var txt = $('wpTextbox1');
    txt.value = txt.value
    .replace(/\’/g, "'")
    .replace(/ '([\w\ ]+)' /g, ' "$1" ')
    .replace(/“/g,'"')
    .replace(/”/g,'"')
    .replace(/–/g, '-')
    .replace(/,,/g, ',')
    .replace(/ m2 /g, ' m² ')
    .replace(/a' /g, "à ")
    .replace(/([^p])o' /g, "$1ò ")
    .replace(/u' /g, "ù ")
    .replace(/i' /g, "ì ")
    .replace(/ anzich(è|e')/g, " anziché")
    .replace(/ affinch(è|e')/g, " affinché")
    .replace(/ bench(è|e')/g, " benché")
    .replace(/ cioé/g, " cioè")
    .replace(/ Dè /g, " De' ")
    .replace(/ dè /g, " de' ")
    .replace(/ dò/g, " do")
    .replace(/E' /g, "È ")
    .replace(/É /g, "È ")
    .replace(/ e' /g, " è ")
    .replace(/ é/g, " è")
    .replace(/ fà /g, " fa ")
    .replace(/ fè /g, " fe' ")
    .replace(/ Frà /g, " Fra' ")
    .replace(/ fù /g, " fu ")
    .replace(/ mò /g, " mo' ")
    .replace(/ nè /g, " né ")
    .replace(/ ne' /g, " né ")
    .replace(/ nonch(è|e')/g, " nonché")
    .replace(/ pè /g, " pe' ")
    .replace(/ perch(è|e')/g, " perché")
    .replace(/ per(ó|o') /g,' però ')
    .replace(/ piu' /g, " più ")
    .replace(/ pò/g, " po'")
    .replace(/ poich(è|e') /g, " poiché ")
    .replace(/ propio/g, " proprio")
    .replace(/ (puo|puo') /gi,' può ')
    .replace(/ quì /gi, " qui ")
    .replace(/ quà /gi, " qua ")
    .replace(/ qual'è/gi, " qual è")
    .replace(/ sà /gi, " sa ")
    .replace(/ sè /gi, " sé ")
    .replace(/si' /g, "sì")
    .replace(/ sò /g, " so ")
    .replace(/ sù /g, " su ")
    .replace(/ tr(è|e'|é) /g, " tre ")
    .replace(/ sucessivo /gi, " successivo ")
    .replace(/&lt;/g,'<')
    .replace(/&gt;/g,'>')
    .replace(/&amp;/g,'&')
    .replace(/&quot;/g,'"')
    .replace(/&agrave;/g,'à')
    .replace(/&egrave;/g,'è')
    .replace(/&eacute;/g,'é')
    .replace(/&igrave;/g,'ì')
    .replace(/&iexcl;/g,'¡')
    .replace(/&cent;/g,'¢')
    .replace(/&pound;/g,'£')
    .replace(/&yen;/g,'¥')
    .replace(/&acute;/g,"'")
    .replace(/&plusmn;/g,'±')
    .replace(/&times;/g,'×')
    .replace(/&divide;/g,'÷')
    .replace(/&micro;/g,'µ')
    .replace(/&deg;/g,'°')
    .replace(/&frac14;/g,'¼')
    .replace(/&frac12;/g,'½')
    .replace(/&frac34;/g,'¾')
    .replace(/&sup1;/g,'¹')
    .replace(/&sup2;/g,'²')
    .replace(/&sup3;/g,'³')
    .replace(/&sect;/g,'§')
    .replace(/<\/?(b|strong)>/gi, "'''")
    .replace(/<\/?(i|em|var)>/gi, "''")
    .replace(/<br>\n\n/g,'\n\n')
    .replace(/<br>/gi,'<br />')
    .replace(/\n<hr[ \/]*>\n/gi, '\n----\n')
    .replace(/ +<hr[ \/]*> +/gi, '\n----\n')
    .replace(/<hr ([^>\/]+?)>/gi,'<hr $1 />')
    .replace(/\n *<h1> *([^<]+?) *<\/h1> *\n/gi,  "\n= $1 =\n")
    .replace(/\n *<h2> *([^<]+?) *<\/h2> *\n/gi,  "\n== $1 ==\n")
    .replace(/\n *<h3> *([^<]+?) *<\/h3> *\n/gi,  "\n=== $1 ===\n")
    .replace(/\n *<h4> *([^<]+?) *<\/h4> *\n/gi,  "\n==== $1 ====\n")
    .replace(/\n *<h5> *([^<]+?) *<\/h5> *\n/gi,  "\n===== $1 =====\n")
    .replace(/\n *<h6> *([^<]+?) *<\/h6> *\n/gi,  "\n====== $1 =======\n")
        ;
    $('wpSummary').value += "+formattazione ";

    WEUpdateFrame();
}

//Cerca e sostituisci
function replace(){
    WEUpdateTextarea();

    var s = prompt("Search regexp?");
    if(s){
        var r = prompt("Replace regexp?");
        if(!r && r != '') return;
        var txt = $('wpTextbox1');
        txt.value = txt.value.replace(new RegExp(s, "g"), r);
    }

    WEUpdateFrame();
}

/**** Funzioni per le pagine di discussione ****/
// Aggiunge il messaggio "msg" alla pagina editata, scrive "summ" nell'oggetto,
// segna o meno "segui questa pagina" a seconda dell'impostazione precedente
// e spunta "modifica minore"
function edit_summary_watch(msg, summ, watch, minor)
{
  WEUpdateTextarea();

  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += msg;
  f.wpSummary.value = summ;
  f.wpWatchthis.checked = watch;
  f.wpMinoredit.checked = minor;

  WEUpdateFrame();
}

// Come il precedente, ma aggiunge "msg" all'inizio della pagina
function edit_summary_watch2(msg, summ, watch, minor)
{
  WEUpdateTextarea();

  var f = document.editform, t = f.wpTextbox1;
  t.value = msg + '\n' + t.value;
  f.wpSummary.value = summ;
  f.wpWatchthis.checked = watch;
  f.wpMinoredit.checked = minor;

  WEUpdateFrame();
}


/**** Aggiunge i tab e i menu ****/
// aggiunge vari tabs e menu-tabs
function add_tabs()
{
  var tabs = $('p-cactions').getElementsByTagName('ul')[0];

  //Solo per le pagine di discussioni degli utenti
  if((document.title.indexOf("Modifica") != -1) && (document.title.indexOf("Discussioni utente") != -1))
  {
    addlimenu(tabs, 'Messaggi talk', 'talkm');
    var talkm = $('talkm').getElementsByTagName('ul')[0];
    addlilink(talkm,'javascript:edit_summary_watch("{{subst:benve|~~~~}}", "Benvenuto", false, true)','welcome', 'pb-welcome');
    ta['pb-welcome'] = new Array('b', 'Da il benvenuto');
    addlilink(talkm,'javascript:edit_summary_watch("{{test}} ~~~~", "test", false, true)','Test', '');
    addlilink(talkm,'javascript:edit_summary_watch("{{vandalismo}} ~~~~", "Avviso vandalismo", false, true)','Vandal', '');
    addlilink(talkm,'javascript:edit_summary_watch("{{spam}}", "spam", false, true)','Spam', '');
    addlilink(talkm,'javascript:edit_summary_watch("{{Avvisocopyviol|articolo=|url=}} ~~~~","avviso possibile violazione di copyright",false,true)','avviso cv','');
    addlilink(talkm,'javascript:edit_summary_watch("{{cancellazione|Titolo_pagina}} ~~~~","avviso proposta di cancellazione",false,true)','avviso canc','');
  }
  else if (document.title.indexOf("Modifica") != -1) // Solo durante le modifiche
  {
    addlimenu(tabs, 'strumenti vari', 'tools');
    var tools = $('tools').getElementsByTagName('ul')[0];
    addlilink(tools,'javascript:fixformat()','format', '');
    addlilink(tools,'javascript:replace()','replace', '');
    addlilink(tools,'javascript:edit_summary_watch2("{{cancella subito|motivo=}}", "cancimm", false, true)','cancimm', '');
    addlilink(tools,'javascript:edit_summary_watch2("{{cancelcopy|firma=~~~|fonte=}}", "cancelcopy", false, true)','cancelcopy', '');
    addlilink(tools,'javascript:edit_summary_watch2("{{cancellazione}}", "cancellare", false, true)','da cancellare', '');
    addlilink(tools,'javascript:WikilinkDoppi()', 'Wikilink doppi', '');
  }
}

/**** Aggiunge i link nel portlet "navigazione" ****/
function addNavBarLinks()
{
    var navbar = 'p-navigation';
    if (mustLoad("nav") || mustLoad("aut"))
        addPortletLink(navbar, httpsext + '/wiki/Wikipedia:Autorizzazioni_ottenute', 'Autorizzazioni ottenute', '');
    if (mustLoad("nav") || mustLoad("csu"))
        addPortletLink(navbar, httpsext + '/wiki/Categoria:Da_cancellare_subito', 'Cancella subito', '');
    if (mustLoad("nav") || mustLoad("blk"))
        addPortletLink(navbar, httpsext + '/wiki/Speciale:Ipblocklist', 'Block Log', '');
    if (mustLoad("nav") || mustLoad("log"))
        addPortletLink(navbar, httpsext + '/wiki/Speciale:Log', 'Log', '');
    if (mustLoad("nav") || mustLoad("mcss"))
        addPortletLink(navbar, httpsext + '/w/index.php?title=Utente:' + wgUserName + '/monobook.css&action=edit', 'monobook.css', '');
    if (mustLoad("nav") || mustLoad("mjs"))
        addPortletLink(navbar, httpsext + '/w/index.php?title=Utente:' + wgUserName + '/monobook.js&action=edit', 'monobook.js', '');
    if (mustLoad("nav") || mustLoad("pca"))
        addPortletLink(navbar, httpsext + '/wiki/Wikipedia:Pagine_da_cancellare', 'Pagine da cancellare', '');
    if (mustLoad("nav") || mustLoad("newp"))
        addPortletLink(navbar, httpsext + '/wiki/Speciale:Newpages', 'Pagine nuove', '');
    if (mustLoad("nav") || mustLoad("rich"))
        addPortletLink(navbar, httpsext + '/wiki/Wikipedia:Richieste_agli_amministratori', 'Richieste agli amministratori', '');
    if (mustLoad("nav") || mustLoad("sand"))
        addPortletLink(navbar, httpsext + '/wiki/Utente:' + wgUserName + '/Sandbox', 'Sandbox', '');
    if (mustLoad("nav") || mustLoad("admin"))
        addPortletLink(navbar, httpsext + '/wiki/Utente:' + wgUserName + '/strumenti admin', 'Strumenti Admin', '');
    if (mustLoad("nav") || mustLoad("stub"))
        addPortletLink(navbar, httpsext + '/wiki/Categoria:Stub', 'Stub', '');
    if (mustLoad("nav") || mustLoad("prob"))
        addPortletLink(navbar, httpsext + '/wiki/Wikipedia:Utenti problematici', 'Utenti problematici', '');
    if (mustLoad("nav") || mustLoad("vand"))
        addPortletLink(navbar, httpsext + '/wiki/Wikipedia:Vandalismi_in_corso', 'Vandalismi in corso', '');
    if (mustLoad("nav") || mustLoad("bot")) {
        if (typeof(nomeBot) != "undefined")
        {
            addPortletLink(navbar, '/wiki/Speciale:Contributi/' + nomeBot, 'Contributi ' + nomeBot, '');
        }
    }

    // Se sono stati stati installati alcuni collegamenti personali
    if (typeof(myLinks) != 'undefined')
        for (var i = 0; i < myLinks.length; i++)
        {
            nome = myLinks[i][0];
            link = myLinks[i][1];

            // Sostituisco %TITOLO% con il titolo della voce
            var link = link.replace(/%TITOLO%/, wgPageName);

            // Sostituisco %TITOLO2% con il titolo della voce senza namespace
            var link = link.replace(/%TITOLO2%/, wgTitle);

            //Aggiungo il link
            addPortletLink(navbar, link, nome, '');
        }
}

/**** Aggiunge i link nel portlet "strumenti" ****/
function addToolBoxLinks()
{
    var tb = 'p-tb';

    //Edit count
    if (mustLoad("stru") || mustLoad("uec"))
    {
        addPortletLink(tb, 'http://toolserver.org/~soxred93/count/index.php?name=' + wgUserName + '&lang=it&wiki=wikipedia', 'Edit count (' + wgUserName + ')', '');

        var cur_user = "";
        if (wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk"){
            var slashpos = wgTitle.indexOf('/');
            cur_user = slashpos != -1 ? wgTitle.substr(0, slashpos) : wgTitle;
        }

        if (cur_user != "") //Se siamo in una pagina/sottopagina della pagina utente/discussione
        {
            addPortletLink(tb, 'http://toolserver.org/~soxred93/count/index.php?name=' + cur_user + '&lang=it&wiki=wikipedia', 'Edit count (' + cur_user + ')', '');

            addPortletLink(tb, 'http://tools.wikimedia.de/~luxo/contributions/contributions.php?user=' + cur_user + '&lang=it', 'Contributi interprogetto (' + cur_user + ')', '');
        }
    }

    if (mustLoad("stru") || mustLoad("vpop"))
        addPortletLink(tb, 'http://tools.wikimedia.de/~henna/VPopSpeed/index.php?projlang=it', 'VPopSpeed', '');

    username_a = document.URL.match(/([0-9]+\.){3}[0-9]+/);
    if (username_a!=null)
    {
        username = username_a[0];
        if (mustLoad("stru") || mustLoad("whois"))
            addPortletLink(tb, 'http://whois.domaintools.com/'+username,'User\'s Whois', 'Whois', '');
    }

    addPortletLink(tb, 'javascript:var code = getpagecontent("Wikipedia:Monobook.js/Setup.js"); if(code) eval(code);', 'Setup', '');
    addPortletLink(tb, 'javascript:var code1 = getpagecontent("Wikipedia:Monobook.js/Pulsanti_personali.js"); if(code1) eval(code1);', 'Pulsanti personali', '');
    addPortletLink(tb, 'javascript:var code1 = getpagecontent("Wikipedia:Monobook.js/Collegamenti_personali.js"); if(code1) eval(code1);', 'Collegamenti personali', '');

    if (mustLoad("stru") || mustLoad("vfol"))
      if (BrowserDetect.browser=="Firefox" || BrowserDetect.browser=="Mozilla" || BrowserDetect.browser=="Netscape")
      {
         // Abilita/Disabilita il VFonLine
         var scritta = GetCookie('wikiVFOL');
         if (scritta == '') // Se il cookie non esiste
            scritta = "disabilitato"; // per default e' disabilitato
         addPortletLink(tb, 'javascript:enableVFOL()', 'VFonLine '+scritta, 'vfol');
         // Pulsanti di gestione delle liste (solo nelle pagine di modifica e solo se e' abilitato il VFOL)
         if (GetCookie('wikiVFOL') == "abilitato")
         {
            addPortletLink(tb, 'javascript:ModificaListaVFOL("White")', 'Modifica la White List', 'vfol1');
            $('vfol1').firstChild.accessKey = '1';
            $('vfol1').title = 'Alt-Shift-1';
            addPortletLink(tb, 'javascript:ModificaListaVFOL("Black")', 'Modifica la Black List', 'vfol2');
            $('vfol2').firstChild.accessKey = '2';
            $('vfol2').title = 'Alt-Shift-2';
         }
      }

    if (mustLoad("stru") || mustLoad("lrc"))
      addPortletLink(tb, 'http://it.wikipedia.org/wiki/Wikipedia:Monobook.js/LiveRC', 'LiveRC', '');

}

/**** L'orologio che si aggiorna automaticamente ****/
function showtime()
{
    var now = new Date();
    $('utcdate').firstChild.innerHTML = now.toLocaleString().replace(/GMT/, "CET");
    setTimeout('showtime()', 300);
}

//Aggiunge qualcosa ad un portlet.
//PARAMS:
//*  id: id del portlet.
//* obj: L'oggetto da aggiungere
function addToPortlet(id, obj)
{
    var f = document.getElementById(id);

    f = f.getElementsByTagName("div")[0];
    f.appendChild(obj);
}

/**** Aggiunge il pulsante "Allpages" nel portlet "ricerca" ****/
function setup_allpages_button(){
    //Non funziona correttamente con simpleSearch (Usability Initiative)
    if (document.getElementById("simpleSearch"))
        return;

    var b = document.createElement('input');
    b.type = "button";
    b.value = "Allpages";
    b.onclick = function(){
        top.___location.href = 'http://it.wikipedia.org/wiki/Speciale:Allpages/' + $('searchInput').value;
    };
    addToPortlet("p-search", document.createElement("hr"));
    addToPortlet("p-search", b);
}



// Aggiunge indirizzi nella toolbar personale
// code stolen from [[wikt:en:User:Hippietrail]]
function addChat() {
  var myprefs = $('pt-mycontris');
  var newpt, newa;

  newpt = document.createElement('li');
  newpt.id = 'id_chat';
  newa = document.createElement('a');
  newa.href='irc://calvino.freenode.net/wikipedia-it' ;
  newa.appendChild(document.createTextNode('chat'));
  newpt.appendChild(newa);
  myprefs.parentNode.insertBefore(newpt, myprefs);
}

// Aggiunge il link "Novita'" nella barra superiore
// Apre gli "Osservati Speciali" mostrando solo le modifiche avvenute dopo l'ultima volta che ci sei passato
if (mustLoad("since"))
function addSince(){
    var watchlist = $('pt-watchlist');
    var newpt = document.createElement('li');
    var link = document.createElement('a');
    link.id = 'listSince';
    link.href = '#modifiche da...';

    var fixLinkHref = function () {
        // Leggi il cookie
        var then = GetCookie('wikiSince');
        if (then == '') // Se il cookie non esiste
           then = +(new Date()) - (1000 * 60 * 60 * 24 * 3); // visualizza gli ultimi tre giorni

        var url = 'http://it.wikipedia.org/wiki/Speciale:OsservatiSpeciali';
        var days = ( +(new Date()) - then )/(1000 * 60 * 60 * 24); // trasforma i millisecondi in giorni
        this.href = url + '?days=' + days;
        return true;
    };
    link.onclick = fixLinkHref;
    link.onmousedown = fixLinkHref;

    // Crea la stringa mostrata a video
    link.appendChild(document.createTextNode("Novità"));

    // Se siamo sugli Osservati Speciali
    if (wgCanonicalSpecialPageName && wgCanonicalSpecialPageName == "Watchlist")
    {
       // Aggiorna il cookie
       var cookieExpire = new Date(); // scadenza del cookie
       cookieExpire.setTime(cookieExpire.getTime() + (30 * 24 * 60 * 60 * 1000)); // il cookie scade dopo un mese
       SetCookie('wikiSince', +(new Date()), cookieExpire.toGMTString(), '/');
    }

    // just one little ID attribute would be _so_ nice...
    newpt.appendChild(link);
    watchlist.parentNode.insertBefore(newpt, watchlist.nextSibling);
}

/** Rende il titolo editabile, in modo da usarlo come casella di ricerca **/
if (mustLoad("edt"))
if (BrowserDetect.browser!="Explorer") //non va con IE
addOnloadHook(function () {
   if((document.title.indexOf("Modifica ") == -1) &&
      (document.title.indexOf("Utente:Senpai/Filtra le ultime modifiche") == -1) &&
      (document.title.indexOf("Utente:Senpai/Tutte le ultime modifiche") == -1) &&
      (document.title.indexOf("Utente:Senpai/Ultime modifiche anonime") == -1) &&
      (document.title.indexOf("Utente:Senpai/Segui gli osservati speciali") == -1) &&
      (document.title.indexOf("Utente:Senpai/Controllo ortografico") == -1))
   {
      var staticTitle = document.getElementsByTagName("h1")[0];
      var editableTitle = document.createElement("input");
      editableTitle.type = "text";

      editableTitle.id = "editable-title";
      editableTitle.style.width = "100%";
      editableTitle.style.fontSize = "x-large";
      editableTitle.style.backgroundColor = "transparent";
      editableTitle.style.borderStyle = "none";
      editableTitle.style.borderBottomStyle = "solid";
      editableTitle.style.borderBottomWidth = "1px";

      editableTitle.value = staticTitle.childNodes[0].nodeValue;

      editableTitle.addEventListener("change", function() {
         document.___location.href="http://it.wikipedia.org/wiki/" + $("editable-title").value;
      }, false);

      editableTitle.addEventListener("focus", function() {
         $("editable-title").style.backgroundColor = "#ddf";
      }, false);

      editableTitle.addEventListener("blur", function() {
         $("editable-title").style.backgroundColor = "transparent";
      }, false);

      editableTitle.addEventListener("keypress", function(evt) {
         if (evt.keyCode == 13) {
            $("editable-title").blur();
         }
      }, false);

      staticTitle.parentNode.replaceChild(editableTitle, staticTitle);
   }
});


/* INIZIO Segna come verificata */

mphkLinkTitle = "Segna come verificata la revisione corrente";
mphkLinkTitle2 = "Segna come verificata l'ultima revisione analizzata";
mphkLinkText = "Segna come verificata";
mphkLinkText2 = "Segna come verificata";
mphkShortLinkText = "ver"

function setMarkPatrolledHotKey(){
  ta['p-verified'] = ['v', 'Segna come verificato'];
  akeytt();
}

function mphkAddMarkpatrolledLink(){
   //100 alla volta, comunque non più 2000 links
   for(var i = mphkCounter; (i < mphkCounter + 100) && (i < mphkLinks.length) && i < 2000; i++){
     var rcidpos = mphkLinks[i].href.indexOf('&rcid=');
     if ((rcidpos == -1) || (mphkLinks[i].href.indexOf('&action=') != -1)) continue;
     var rcid = mphkLinks[i].href.substring(rcidpos);
     var mp = document.createElement('a');
     mp.href = "/w/index.php?title=" + encodeURIComponent(mphkLinks[i].title) + "&action=markpatrolled"+rcid;
     mp.title = mphkLinkTitle;
     mp.appendChild(document.createTextNode(mphkShortLinkText));
     mphkLinks[i].parentNode.insertBefore(mp, mphkLinks[i+mphkOffset].nextSibling);
     mphkLinks[i].parentNode.insertBefore(document.createTextNode("; "), mp);
   }

   mphkCounter = i;

   if (mphkCounter < mphkLinks.length && mphkCounter < 2000)
     setTimeout("mphkAddMarkpatrolledLink()", 100);
   else{
     mphkLinks = null;
     mphkCount = null;
   }
}

//Aggiunge l'hotkey shift-alt-v per il link "Segna come verificato", se presente
if (window.___location.href.indexOf("rcid=") != -1)
if (mustLoad("ver"))
addOnloadHook(function (){
  var rcidpos = window.___location.href.indexOf("rcid=");
  if (rcidpos == -1) return;
  if (document.title.indexOf("Modifica verificata") != -1) return;
  var x = document.getElementsByTagName('a');
  for(var i=0;i<x.length;i++)
    if (x[i].href.indexOf('markpatrolled') != -1){
      x[i].id = 'p-verified';
      setMarkPatrolledHotKey();

      //Crea il link anche sopra il titolo
      var mp = document.createElement('a');
      mp.href = "/w/index.php?title=" + wgPageName + "&action=markpatrolled&rcid="+window.___location.href.substring(rcidpos+5);
      mp.title = mphkLinkTitle;
      mp.appendChild(document.createTextNode(mphkLinkText));
      var t = $('content');
      t.insertBefore(mp, t.firstChild);

      break;
    }
});

//Aggiungi links "verificata" in Newpages, Recentchanges e Watchlist.
if (wgCanonicalNamespace == "Special")
if (mustLoad("ver"))
addOnloadHook(function (){
  switch (wgCanonicalSpecialPageName){
  case "Newpages": mphkOffset = 1; break;
  case "Recentchanges": mphkOffset = 1; break;
  case "Watchlist": mphkOffset = 0; break;
  default: return;
  }
  mphkLinks = $('content').getElementsByTagName('a');
  mphkCounter = 0;
  mphkAddMarkpatrolledLink();
});

//Propagazione tramite cookie
if (mustLoad("ver"))
addOnloadHook(function (){
  if (($("wpTextbox1") != null) || //mai durante la modifica
      (window.___location.href.indexOf("&action=history") != -1)) //né nella history
    return;

  var c = GetCookie('wikiMarkpatrolled');
  var rcidpos = window.___location.href.indexOf("rcid=");
  //Salva pagina nel cookie;
  var expire = new Date(); // scadenza del cookie
  expire.setTime(expire.getTime() + (60 * 60 * 1000)); // scadenza di un'ora
  var A = c.split('#');

  var justVerified = document.title.indexOf("Modifica verificata") != -1;

  if ((rcidpos != -1) && (!justVerified)){
    var n = wgPageName + "&" + window.___location.href.substring(rcidpos+5);
    //Salva fino a 19 pagine precedenti
    for(var i = 0; (i < 20-1) && (i < A.length); i++)
      if ((A[i] != '') && (A[i].indexOf(wgPageName) == -1))
        n += '#' + A[i];
    SetCookie('wikiMarkpatrolled', n, expire.toGMTString(), '/');
  } else if ((c.indexOf(wgPageName) != -1) && ((rcidpos == -1) || justVerified)){
    //Rimuove la pagina corrente dal cookie
    var n = '';
    var index = -1;
    for(var i = 0; i < A.length; i++)
      if (A[i].indexOf(wgPageName) != -1)
        var index = i; //ricorda l'indice della pagina da non risalvare nel cookie
    for(var i = 0; i < A.length; i++)
      if ((i != index) && (A[i] != ''))
        n += '#' + A[i];
    SetCookie('wikiMarkpatrolled', n.substring(1), expire.toGMTString(), '/');

    if (!justVerified){
      //Crea il link sopra il titolo
      var mp = document.createElement('a');
      mp.href = "/w/index.php?title=" + wgPageName + "&action=markpatrolled&rcid="+A[index].substring(A[index].lastIndexOf('&') + 1);
      mp.title = mphkLinkTitle2;
      mp.appendChild(document.createTextNode(mphkLinkText2));
      mp.id = 'p-verified';
      var t = $('content');
      t.insertBefore(mp, t.firstChild);
      setMarkPatrolledHotKey();
    }
  }
});

/* FINE Segna come verificata */


/* INIZIO Dynamic pages */

function mbAddTrustedPages(/* params */){
  if (typeof mbTrustedPages == 'undefined') mbTrustedPages = {};
  for(var i = 0; i < arguments.length; i++)
    mbTrustedPages[arguments[i]] = true;
}

addOnloadHook(function (){
  if(!wgIsArticle) return; //non in modifica
  if(typeof mbTrustedPages == 'undefined') return;
  if (mbTrustedPages[wgPageName] == true){
    var pre = $('javascriptCode');
    if (!pre) return;
    var code = pre.innerHTML.replace(/&amp;/g, "&").replace(/&gt;/g, ">").replace(/&lt;/g, "<");
    //eval(code);
    var script = document.createElement('script');
    script.appendChild(document.createTextNode(code));
    document.body.appendChild(script);
  }
});

/* FINE Dynamic pages */

function HelpHotkeys ()
{
  var text = "";
  var counter = 0;
  
  for (codice in pulsantiHotkey)
    if (pulsantiHotkey[codice] != '')
      text += pulsantiDescr[codice] + " = Alt+" + pulsantiHotkey[codice] + '\n';
  
  alert (text);
}

/* Aggiorna la lista degli hotkeys */
if (wgAction=="edit")
addOnloadHook(function(){
  // modifica gli hotkeys di default in base a quanto scelto dall'utente
  if (typeof(tastiHotkeys) != "undefined")
    for (tasto in tastiHotkeys)
    {
      // vietato usare lo stesso codice per 2 pulsanti diversi
      for (tasto2 in pulsantiHotkey)
        if (pulsantiHotkey[tasto2] == tastiHotkeys[tasto])
          pulsantiHotkey[tasto2] = '';

      // assegna il valore scelto dall'utente
      pulsantiHotkey[tasto] = tastiHotkeys[tasto];
    }
  
  // Aggiungi gli hotkeys creati dall'utente
  if (typeof(pulsantiHotkeyPers) == "undefined")
    return;
  else
    for (pulsante in pulsantiHotkeyPers)
    {
      // vietato usare lo stesso codice per 2 pulsanti diversi
      for (pulsante2 in pulsantiHotkey)
        if (pulsantiHotkey[pulsante2] == pulsantiHotkeyPers[pulsante])
          pulsantiHotkey[pulsante2] = '';

      // assegna il valore scelto dall'utente
      pulsantiHotkey[pulsante] = pulsantiHotkeyPers[pulsante];
      pulsantiComando[pulsante] = pulsantiComandoPers[pulsante];
      if (typeof(pulsantiDescrPers) != "undefined")
        pulsantiDescr[pulsante] = pulsantiDescrPers[pulsante];
    }
});

/* Catch di hotkeys + speedy google search*/
function catchHotkeys (){
  if (BrowserDetect.browser=="Firefox" || BrowserDetect.browser=="Mozilla" || BrowserDetect.browser=="Netscape")
  {
    var listenerKeyPress = function(e){
      e = (e) ? e : ((window.event) ? window.event : null);
      if(e && e.altKey && !e.shiftKey && !e.ctrlKey){
        var toCheckNum = (e.which) ? e.which : e.keyCode;
        var toCheck = String.fromCharCode(toCheckNum);
      
        for (x in pulsantiHotkey)
        {
          if (pulsantiHotkey[x].toUpperCase() == toCheck.toUpperCase())
            eval(pulsantiComando[x]);
        }
      
        //Fermo il propagarsi degli eventi
        e.stopPropagation();
        //Cancello l'azione di default
        e.preventDefault();
      
        return false;
      }
    }

    wpTextbox1 = $("wpTextbox1");
    if (wpTextbox1 != null)
    {
      if (wpTextbox1.addEventListener)
        wpTextbox1.addEventListener('keypress', listenerKeyPress, true); //Non-IE
      else
        wpTextbox1.onkeypress = listenerKeyPress; 
    }
    wpUploadDescription = $("wpUploadDescription");
    if (wpUploadDescription!= null)
    {
      if (wpUploadDescription.addEventListener)
        wpUploadDescription.addEventListener('keypress', listenerKeyPress, true); //Non-IE
      else
        wpUploadDescription.onkeypress = listenerKeyPress; 
    }
  }
  var listenerMouseUp = function(e){
    e = (e) ? e : ((window.event) ? window.event : null);
    if(e && e.ctrlKey){
      if(navigator.appName=='Microsoft Internet Explorer' && navigator.userAgent.indexOf("Opera")==-1) //IE
        var t = document.selection.createRange().text;
      else //Non-IE
        var t = document.getSelection ? document.getSelection().toString() : window.getSelection().toString();
      t = t.replace(/^\s+/, '').replace(/\s+$/, ''); //trim
      var q = t.indexOf('"') == -1 ? '"' : '';
      if(t)
        window.open("http://www.google.com/search?q=" + q + encodeURIComponent(t) + q);
    }
  }

  if (window.addEventListener)
    window.addEventListener('mouseup', listenerMouseUp, false); //Non-IE
  else
    document.onmouseup = listenerMouseUp; //IE
}
if (wgAction=="edit")
  addOnloadHook(catchHotkeys);


/**** Fine ****/
// </nowiki></pre>


//Importa la toolbar
if (wgAction=="edit")
  importScript("Utente:Jalo/Sandbox");


// script "recent Senpaio" ver. 1.0<br/>
// Vedi [[Utente:Senpai/monobook/recent2.js]], derivato dall'[[:en:User:Lupin/Anti-vandal_tool|Anti-vandal tool]] di [[:en:user:Lupin]]; tradotto ed adattato da [[Utente:Senpai]] e [[Utente:Valepert]]
// <pre><nowiki>
if (mustLoad("avan"))
    document.writeln('<script type="text/javascript" src="/w/index.php?title=Utente:Senpai/monobook/recent2.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');
// </nowiki></pre>

// script "Catwatch" ver. 1.0<br/>
// Tradotto da [[Utente:Jalo|Jalo]]
// Vedi [[Wikipedia:Monobook.js/Catwatch.js]]
// <pre><nowiki>
if (wgPageName=="Speciale:OsservatiSpeciali")
if (mustLoad("cwtch"))
    document.writeln('<script type="text/javascript" src="/w/index.php?title=Wikipedia:Monobook.js/Catwatch.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');
// </nowiki></pre>

// script "ricerca in Namespace"<br/>
// Vedi [[Wikipedia:Monobook.js/namespaceSearch.js]], derivato dal tool di [[:en:User:Ilmari Karonen|Ilmari Karonen]]; tradotto ed adattato da [[Utente:Jalo|Jalo]]
// <pre><nowiki>
if (mustLoad("nms"))
    document.writeln('<script type="text/javascript" src="/w/index.php?title=Wikipedia:Monobook.js/namespaceSearch.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');
// </nowiki></pre>

// script "Quick Edit"<br/>
// Vedi [[Wikipedia:Monobook.js/QuickEdit.js]] di [[:de:Benutzer:ASM]]
// <pre><nowiki>
if (mustLoad("qed"))
document.writeln('<script type="text/javascript" src="'
    + 'http://de.wikipedia.org/w/index.php?title=Benutzer:ASM/quickedit.js'
    + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
// </nowiki></pre>

if (mustLoad("wed"))
if (BrowserDetect.browser!="Explorer") //non va con IE
{
// installa la traduzione del wikEd
// <pre><nowiki>
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Jalo/wikEd_international_it.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
// </nowiki></pre>

// installa il [[Wikipedia:Monobook.js/WikEd|wikEd]], editor di testo
// <pre><nowiki>
 document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
// </nowiki></pre>
}

// script Cronologia della pagina"<br/>
// Vedi [[Wikipedia:Monobook.js/MostraModifiche.js]] di [[:nl:User:JePe]]
// <pre><nowiki>
if (mustLoad("rch"))
if (BrowserDetect.browser!="Explorer") //non va con IE
document.write('<script type="text/javascript" src="'
    + 'http://it.wikipedia.org/w/index.php?title=Wikipedia:Monobook.js/MostraModifiche.js'
    + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
// </nowiki></pre>

// script "Command line"<br/>
// Vedi [[Utente:Salvatore_Ingala/commandline.js]] di [[Utente:Salvatore_Ingala]]
// NOTA: deve rimanere DOPO wikEd per motivi di compatibilità!
// <pre><nowiki>
if (mustLoad("cmd"))
document.write('<script type="text/javascript" src="'
    + 'http://it.wikipedia.org/w/index.php?title=Utente:Salvatore_Ingala/commandline.js'
    + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
// </nowiki></pre>

// script Notiziario del Monobook"<br/>
// Vedi [[Wikipedia:Monobook.js/Notiziario.js]]
// Questo script viene eseguito sempre, non ha bisogno del controllo 'mustLoad'
// <pre><nowiki>
if (wgCanonicalNamespace == 'User_talk' && wgTitle == wgUserName && typeof(disabilitaNotiziario)=="undefined")
document.write('<script type="text/javascript" src="'
    + 'http://it.wikipedia.org/w/index.php?title=Wikipedia:Monobook.js/Notiziario.js'
    + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
// </nowiki></pre>

// script del retropatrolling<br/>
// Vedi [[Wikipedia:VPopSpeed]]
// <pre><nowiki>
if (mustLoad("vpop"))
if (BrowserDetect.browser!="Explorer") //non va con IE
document.write('<script type="text/javascript" src="'
    + 'http://it.wikipedia.org/w/index.php?title=Utente:Henna/VPopSpeed.js'
    + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
// </nowiki></pre>

// script del Vandal Fighter on Line<br/>
// Vedi [[Wikipedia:Monobook.js/VFonLine]]
// Scritto da [[Utente:Jalo|Jalo]]
// <pre><nowiki>
if (mustLoad("vfol"))
{
document.write('<script type="text/javascript" src="'
    + 'http://it.wikipedia.org/w/index.php?title=Wikipedia:Monobook.js/VFonLine.js'
    + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
}

// script "Popup di navigazione"<br/>
// Vedi [[:en:User:Lupin/popups.js]] di [[:en:User:Lupin|Lupin]]
// <pre><nowiki>
if (mustLoad("popup"))
document.write('<script type="text/javascript" src="'
    + 'http://it.wikipedia.org/w/index.php?title=Wikipedia:Monobook.js/strings-it.js'
    + '&action=raw&ctype=text/javascript"></script>');

if (mustLoad("popup"))
document.write('<script type="text/javascript" src="'
    + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'
    + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
// </nowiki></pre>

// Script di Link Complete
// Scritto da [[:en:Utente:Zocky]]
// [[:en:User:Zocky/LinkComplete.js]]
// Vedi [[:en:User:Zocky/Link_Complete]]
if (mustLoad("linkcomplete"))
{
document.write('<script type="text/javascript" src="'
    + 'http://en.wikipedia.org/w/index.php?title=User:Zocky/LinkComplete.js'
    + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
}

// Script di Quick-Delete
// Vedi [[:m:MediaWiki talk:Quick-delete.js]]
if (mustLoad("qdel"))
{
document.write('<script type="text/javascript" src="'
             + 'http://it.wikipedia.org/w/index.php?title=Wikipedia:Monobook.js/Quick-delete.js'
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
}

// Script di LiveRC
// Vedi [[Wikipedia:Monobook.js/LiveRC/Documentazione]]
if (wgTitle == 'Monobook.js/LiveRC' && mustLoad("lrc"))
{
document.write('<script type="text/javascript" src="' +
               'http://it.wikipedia.org/w/index.php?title=Wikipedia:Monobook.js/LiveRC.js' +
               '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
}

// Unwatch. Aggiunge "non seguire" nella pagina degli osservati speciali
// Vedi [[Wikipedia:Monobook.js/Unwatch.js]]
if (mustLoad("unw"))
{
document.write('<script type="text/javascript" src="' +
               'http://it.wikipedia.org/w/index.php?title=Wikipedia:Monobook.js/Unwatch.js' +
               '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
}

// Ripristina. Aggiunge la "selezione automatica" nella pagina di ripristino della cronologia
// Vedi [[Wikipedia:Monobook.js/Ripristina]]
if (typeof(disableRipristina)=="undefined")
if (((wgAction == "history") && (wgUserGroups.indexOf("sysop") != -1)) ||
     (wgPageName == "Speciale:Ripristina"))
{
document.write('<script type="text/javascript" src="' +
               'http://it.wikipedia.org/w/index.php?title=Wikipedia:Monobook.js/Ripristina.js' +
               '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
}

// Cancella sezione. Aggiunge i link "cancella" da parte ad ogni sezione
if (mustLoad("dels"))
{
document.write('<script type="text/javascript" src="' +
               'http://it.wikipedia.org/w/index.php?title=Wikipedia:Monobook.js/deledesection.js' +
               '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
}

// Trasforma le cronologie incollate in versioni con wikilink
if(document.title.indexOf("Discussione") != -1 )
{
document.write('<script type="text/javascript" src="' +
               'http://it.wikipedia.org/w/index.php?title=Wikipedia:Monobook.js/Cronologia.js' +
               '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
}

// Verifica requisiti di voto di un utente
if (mustLoad("nav")||mustLoad("requi"))
{
document.write('<script type="text/javascript" src="' +
               'http://it.wikipedia.org/w/index.php?title=Wikipedia:Monobook.js/Requisiti.js' +
               '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
}

// EnhancedLiveRC
if (wgTitle == 'Monobook.js/E-LiveRC' && mustLoad("elrc"))
{
document.write('<script type="text/javascript" src="' +
               'http://it.wikipedia.org/w/index.php?title=Wikipedia:Monobook.js/E-LiveRC.js' +
               '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
}

// Link cliccabili in crono
if (mustLoad("clink"))
{
  var autolinkParseLink = false; // se si usa il wikEd
  document.write('<script type="text/javascript" src="' +
                 'http://en.wikipedia.org/w/index.php?title=User:Lenore/autolink.js' +
                 '&action=raw&ctype=text/javascript"></script>');
}

// </nowiki>