Nota: dopo aver pubblicato, potrebbe essere necessario pulire la cache del proprio browser per vedere i cambiamenti.

  • Firefox / Safari: tieni premuto il tasto delle maiuscole Shift e fai clic su Ricarica, oppure premi Ctrl-F5 o Ctrl-R (⌘-R su Mac)
  • Google Chrome: premi Ctrl-Shift-R (⌘-Shift-R su un Mac)
  • Internet Explorer / Edge: tieni premuto il tasto Ctrl e fai clic su Aggiorna, oppure premi Ctrl-F5
  • Opera: premi Ctrl-F5.
/* <pre><nowiki> */



/** VARIABILI GLOBALI **/
	
arrayMese = new Array("gennaio", "febbraio", "marzo", "aprile", "maggio", "giugno", 
                      "luglio", "agosto", "settembre", "ottobre", "novembre", "dicembre");

var curTemplate;

/**** Inizializzazione ****/

if (window.addEventListener) window.addEventListener("load",myLoadFuncs,false);
else if (window.attachEvent) window.attachEvent("onload",myLoadFuncs);
else
{
    window.previousLoadFunction = window.onload;
    window.onload = function()
    {
        window.previousLoadFunction();
        myLoadFuncs();
    }
}

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

function myLoadFuncs()
{
    if (toLoad.indexOf(" tabs ")!=-1)
		add_tabs();        // aggiunge i tab
    if (toLoad.indexOf(" led ")!=-1)
		lastEdit();        // aggiunge pulsante "ultima modifica"
    if (toLoad.indexOf(" purg ")!=-1)
		addPurge();        // aggiunge pulsante "purge"
    if (toLoad.indexOf(" ns0 ")!=-1)
		addEditSection0();        // aggiunge pulsante "ultima modifica"
    changeLinks();     // modifica il menu personale
    if (toLoad.indexOf(" stru ")!=-1)
		addToolBoxLinks(); // aggiunge i link nel portlet "strumenti"
    addNavBarLinks();  // aggiunge i link nel portlet "navigazione"
    ta['pt-logout'] = ['x', 'Logout (esci)']; //cambia l'accesskey per "logout"
    akeytt();    
}

function addEditSection0()
{
    ta['ca-edit-0'] = ['', 'Modifica la sezione 0'];
    if(!document.getElementById) return;
    var x = document.getElementById('ca-edit');
    if(!x) return;
    var y = document.createElement('LI');
    y.id = 'ca-edit-0';
    if(x.className == 'selected'){
      if(/&action=edit&section=0$/.test(window.location.href)){
        x.className = 'istalk';
        y.className = 'selected';
      } else {
        x.className = 'selected istalk';
      }
    } else if(x.className == 'selected istalk'){
      if(/&action=edit&section=0$/.test(window.location.href)){
        x.className = 'istalk';
        y.className = 'selected istalk';
      } else {
        y.className = 'istalk';
      }
    } else {
      y.className = x.className;
      x.className = 'istalk';
    }
    var z = document.createElement('A');
    if(x.children){
        z.href = x.children[0].href + '&section=0';
        z.appendChild(document.createTextNode('0'));
        y.appendChild(z);
        document.getElementById('p-cactions').children[1].insertBefore(y,x.nextSibling);
    }else{
        z.href = x.childNodes[0].href + '&section=0';
        z.appendChild(document.createTextNode('0'));
        y.appendChild(z);
        document.getElementById('p-cactions').childNodes[3].insertBefore(y,x.nextSibling);
    }
}

// Functions auxFicus and Ficus
function auxFicus(){
    Argument = document.getElementById('inlinePopupDiv').getElementsByTagName('select')[0].value;

    wpTextbox1 = document.getElementById("wpTextbox1");
    if (curTemplate == "W") 
        wpTextbox1.value="{{"+curTemplate+"|"+Argument+"|"+"{{subst:CURRENTMONTHNAME}} 

{{subst:CURRENTYEAR}}|~~~~}}\n"+wpTextbox1.value;
    else if (curTemplate == "S") 
        wpTextbox1.value="{{"+curTemplate+"|"+Argument+"}}\n"+wpTextbox1.value;
    else {
        Because = document.getElementById('inlinePopupDiv').getElementsByTagName('input')[0].value;
        wpTextbox1.value="{{"+curTemplate+"|"+Because+"|"+Argument+"|"+"{{subst:CURRENTMONTHNAME}} 

{{subst:CURRENTYEAR}}|~~~~}}\n"+wpTextbox1.value;
    }

    switch(curTemplate){
    case "C": var summary = "+Controllare"; break;
    case "W": var summary = "+Wikificare"; break;
    case "S": var summary = "+Stub"; break;
    }

    summ=document.getElementById("wpSummary");
    summ.value=summ.value+summary;
    RemoveNode('inlinePopupDiv');
}

function Ficus(Template){
    switch(Template){
  
        
    case "C":
        Greeter = "Hai richiesto di inserire questa pagina nella Categoria <b>\"Da controllare\"</b>\n." +
                  " Per favore scrivi una motivazione e scegli un argomento dalla lista";

        break;
    case "W":
        Greeter = "Hai richiesto di inserire questa pagina nella Categoria <b>\"Da wikificare\"</b>\n." +
                  " Per favore scegli un argomento dalla lista.";
        break;
    case "S":
        Greeter = "Hai richiesto di inserire questa pagina nella Categoria <b>\"Stub\"</b>\n." +
                  " Per favore scegli un argomento dalla lista.";

        break;
    default: Greeter = "Qualcosa è andato storto, fai pure quello che vuoi: non ho idea di cosa succederà"
    }

    curTemplate = Template;

    var div = document.createElement('div');
        div.id = 'inlinePopupDiv';
        div.style.position = 'absolute';
        div.style.zIndex   = 1000;
        div.style.left     =  '5px';
        div.style.top      =  '5px';
        div.style.backgroundColor = '#FFFFFF';
        div.style.borderStyle     = 'solid';
        div.style.borderWidth     = ' medium';
        div.style.borderColor     = '#000000';

        var top = document.createElement('div');
            top.id = 'inlinePopupTop';
            top.style.textAlign = 'right';
            top.style.margin = '8px';
            top.style.backgroundColor = '#DDDDDD';

            var a = document.createElement('a');
                a.appendChild( document.createTextNode('Close'));
                a.href = "javascript:void RemoveNode('inlinePopupDiv')";
                a.style.margin = '8px';

            top.appendChild(a);

        div.appendChild(top);

        var greet = document.createElement('p');
        greet.innerHTML = Greeter;
        div.appendChild(greet);

        var form = document.createElement('form');
        form.name = "popupForm";
        var p = document.createElement('p');

            p.appendChild(document.createTextNode('Motivazione:'));
            if(Template != 'W' && Template != 'S'){
                var myedit = document.createElement('input');
                myedit.name = 'editReason';
                myedit.type = 'text';
                p.appendChild(myedit);
            }
                     
            p.appendChild(document.createTextNode('Argomento:'));

            var sel = document.createElement('select');
            sel.name = 'popupSelect';
            sel.size = 1;
            var option;
            for (i = 0; i < arrayArgument.length; i++){
                option = new Option(arrayArgument[i],' ');
                option.value = arrayArgument[i];
                sel.options[sel.options.length] = option;
            }
            p.appendChild(sel);

            var button = document.createElement('input');
            button.value = 'OK';
            button.type = 'button';
            button.setAttribute('onclick', 'auxFicus()');
            p.appendChild(button);

        form.appendChild(p);
        div.appendChild(form);

    document.body.appendChild(div);
    div.getElementsByTagName('input')[0].focus();
}

/**** Personalizza i link della barra personale ****/

function changeLinks()
{
    if(!document.getElementById) return;

	if (toLoad.indexOf(" lks ")!=-1)
	{
	    // Modifica i link
	    document.getElementById('pt-mytalk').firstChild.innerHTML = 'discussione';
	    document.getElementById('pt-preferences').firstChild.innerHTML = 'preferenze';
	    document.getElementById('pt-watchlist').firstChild.innerHTML = 'osservati speciali';
	    document.getElementById('pt-mycontris').firstChild.innerHTML = 'contributi';
	}
	
	if (toLoad.indexOf(" orol ")!=-1)
	{
	    // Aggiunge l'orologio
	    var toplinks = document.getElementById('p-personal').getElementsByTagName('ul')[0];
	    addlilink(toplinks, '#', '', 'utcdate');
	    showtime();
	}
}

/**** Aggiunge un generico tab ****/

function addlilink(tabs, url, name, id){
    var na = document.createElement('a');
    na.href = url;
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    li.id = id;
    li.appendChild(na);
    tabs.appendChild(li);
    return li;
}

/**** Aggiunge un tab come menu ****/

function addlimenu(tabs, name, id)
{
    var na = document.createElement('a');
    na.href = '#';
    var mn = document.createElement('ul');
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    li.id = id;
    li.className = 'tabmenu';
    li.appendChild(na);
    li.appendChild(mn);
    tabs.appendChild(li);
    return li;
}

/**** Aggiunge il tab "purge" ****/

function addPurge()
{
    ta['ca-purge'] = ['g', 'Pulisci la cache'];
    if(!document.getElementById) return;
    var x = document.getElementById('ca-history');
    var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
    if(!x) return;
    if(x.children) x = x.children[0];
    else x = x.childNodes[0];
    
    var pf = document.createElement('form');
    pf.action = '?action=purge';
    pf.method = 'POST';
    pf.id = 'pf';
    x.appendChild(pf);
    
    addlilink(tabs, 'javascript:document.getElementById("pf").submit();', 'purge', 'ca-purge');
    akeytt();
}

/**** Aggiunge il tab "ultima modifica" ****/

function lastEdit()
{
    ta['ca-ledit'] = ['u', 'ultima modifica'];
    if(!document.getElementById) return;
    var x = document.getElementById('ca-history');
    var tabs2 = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
    if(!x) return;
    if(x.children) x = x.children[0];
    else x = x.childNodes[0];
    
    var led = document.createElement('form');
    led.action = '?diff=0';
    led.method = 'POST';
    led.id = 'led';
    x.appendChild(led);
    
    addlilink(tabs2, 'javascript:document.getElementById("led").submit();', 'ultima modifica', 'ca-ledit');
    akeytt();
}

function getParam(name){
    if(location.search){
        for(var x in location.search.substring(1).split('&')){
            var eq = x.indexOf('=');
            if(x.substring(0, eq) == name) return x.substring(eq + 1);
        }
    }
    return '';
}

/**** Menu "strumenti vari" ****/

//Sostituzioni automatiche
function fixformat(){
    var form = document.editform;
    var txt = form.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> *([^<]+?) *<\/h1> *\n/gi,  "\n== $1 ==\n")
	.replace(/\n *<h3> *([^<]+?) *<\/h1> *\n/gi,  "\n=== $1 ===\n")
	.replace(/\n *<h4> *([^<]+?) *<\/h1> *\n/gi,  "\n==== $1 ====\n")
	.replace(/\n *<h5> *([^<]+?) *<\/h1> *\n/gi,  "\n===== $1 =====\n")
	.replace(/\n *<h6> *([^<]+?) *<\/h1> *\n/gi,  "\n====== $1 =======\n")
        ;
    form.wpSummary.value += "formattazione";
    form.wpMinoredit.checked = true;
}

//Cerca e sostituisci
function replace(){
    var s = prompt("Search regexp?");
    if(s){
        var r = prompt("Replace regexp?");
        if(!r && r != '') return;
        var txt = document.editform.wpTextbox1;
        txt.value = txt.value.replace(new RegExp(s, "g"), r);
    }
}

/**** Funzioni per le pagine di discussione ****/

// Appends msg to the currently editted page, sets the summary to summ,
// marks or unmarks the "Watch this page" checkbox according to watch,
// and marks or unmarks the "Minor edit" checkbox
function edit_summary_watch(msg, summ, watch, minor)
{
  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;
}

// Like the former one, but adds "msg" in the beginning and not after the end
function edit_summary_watch2(msg, summ, watch, minor)
{
  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;
}

// Places perm block and name block tags at top of edit section,         
// marks or unmarks the "Watch this page" checkbox according to watch,
// and marks or unmarks the "Minor edit" checkbox 
function perm_name_block(msg, summ, watch, minor)                                
{                                                                          
  var f = document.editform, t = f.wpTextbox1;                            
  if (t.value.length > 0)                                                
      t.value += '\n';                                                  
  var temp = t.value;                                                    
  t.value = msg + '\n\n' + temp;                                                                                              

              
  f.wpSummary.value = summ;                                                
  f.wpWatchthis.checked = watch; 
  f.wpMinoredit.checked = minor;
}

/**** Aggiunge i tab e i menu ****/

// adds various tabs and menu tabs
function add_tabs()
{
  var tabs = document.getElementById('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 = document.getElementById('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 violazione di 

copyright",false,true)','avviso cv','');
    addlilink(talkm,'javascript:edit_summary_watch("{{Avvisocancellautente|wikilink=[[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 = document.getElementById('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("{{da cancellare}}", "cancellare", false, true)','da cancellare', '');
  }
}


/**** Aggiunge i link in "strumenti" ****/

function addToolBoxLinks()
{
    var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];
    var cur_user=document.getElementById("pt-userpage").textContent;
	if ((toLoad.indexOf(" stru ")!=-1) || (toLoad.indexOf(" uec ")!=-1))
		addlilink(tb, 'http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?dbname=itwiki_p&user=' + cur_user, 

'Edit count', '');
    username_a = document.URL.match(/:.*:(.*)/);
    if (username_a!=null)
        username=username_a[1];
    if ((toLoad.indexOf(" stru ")!=-1) || (toLoad.indexOf(" log ")!=-1))
		addlilink(tb, '/wiki/Speciale:Log', 'Log', '');
    if (username_a!=null)
	if ((toLoad.indexOf(" stru ")!=-1) || (toLoad.indexOf(" whois ")!=-1))
                addlilink(tb, 'http://www.dnsstuff.com/tools/whois.ch?ip='+username,'User\'s Whois', 'Whois', '');
}

/**** L'orologio che si aggiorna automaticamente ****/

function showtime()
{
    var timerID;
    var now = new Date();
    var timeValue = now.toLocaleString().replace(/GMT/, "CET");
    document.getElementById('utcdate').firstChild.innerHTML = timeValue;
    timerID = setTimeout('showtime()', 100);
}

/**** Aggiunge il link "unwatch" nella watchlist ****/
if (toLoad.indexOf(" unw ")!=-1)
$(function () {
    var query_prefix = "title=Speciale:Watchlist&action=submit&remove=1&id[]=";
    var query_prefix = "action=unwatch&title=";

    if (window.location.href.indexOf("Speciale:Watchlist") == -1) return;
    var links = document.getElementById('content').getElementsByTagName('a');
    for (var i = 0; i < links.length; i++) {
        if (links[i].href.substring(links[i].href.length-15) != '&action=history')
            continue;
        var unwatch = document.createElement('a');
        unwatch.href = "/w/index.php?" + query_prefix + encodeURIComponent(links[i].title);
        unwatch.title = "Unwatch "+links[i].title;
        unwatch.appendChild(document.createTextNode("non seguire"));
        links[i].parentNode.insertBefore(unwatch, links[i].nextSibling);
        // kluge to handle case where "diff" is unlinked:
        var delim = links[i].previousSibling;
        delim = (delim.nodeType == 3 ? delim.nodeValue : "");
        links[i].parentNode.insertBefore(document.createTextNode(delim.replace(/^.*diff/, "")), unwatch);
    }
});

/**** Funzioni varie ****/

//Elimina un Node
function RemoveNode(id){
    var node = document.getElementById(id)
    node.parentNode.removeChild(node);
}

//Aggiunge qualcosa ad un portlet.
//PARAMS:
//*  id: The id of the portlet.
//* obj: The object to be added. 
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 allpages_button_click(){
    var inputs = document.getElementById("p-search").getElementsByTagName('input');
    var i;
    for (i = 0; i < inputs.length; ++i)
      if (inputs[i].type == "text")
        top.location.href = 'http://it.wikipedia.org/wiki/Speciale:Allpages/' + inputs[i].value;
}

function setup_allpages_button(){
    var button = document.createElement('input');
    button.type = "button";
    button.value = "Allpages";
    button.setAttribute('onClick', 'allpages_button_click()');

    addToPortlet("p-search", document.createElement("hr"));
    addToPortlet("p-search", button);

}

if (toLoad.indexOf(" allp ")!=-1)
	addOnloadHook(setup_allpages_button);



/**** Personalizzazione della ToolBar ****/

function addToolbarButton(id, href, src, alt, title)
{
  var toolbar = document.getElementById("toolbar");
  var today = new Date();
  var anno= today.getYear()+1900;
  var mese = arrayMese[today.getMonth()];

  var tmp = document.createElement("a");
  tmp.id = id;
  tmp.href = href;
  var imag = document.createElement("img");
  imag.setAttribute('src', src);
  imag.setAttribute('alt', alt);
  imag.setAttribute('title', title);
  tmp.appendChild(imag);
  toolbar.appendChild(tmp);
}

function addText(text, summary, n)
{
  wpTextbox1=document.getElementById("wpTextbox1");
  if (n == 0)
    wpTextbox1.value=text + "\n" +wpTextbox1.value;
  else
    wpTextbox1.value=wpTextbox1.value + text;
  summ=document.getElementById("wpSummary");
  summ.value=summ.value+summary;
  document.getElementById("wpMinoredit").checked=1
}

function ToolbarButton() {
  var toolbar = null;
  toolbar = document.getElementById("toolbar");
  if (toolbar == null)
    return;
  
  var today = new Date();
  var anno= today.getYear()+1900;
  var mese = arrayMese[today.getMonth()];

  // serve per aggiungere le divisioni tra gruppi di pulsanti
  var qualcosa="no";

  var username=document.getElementById("pt-userpage").textContent;
  
// pulsante FARLOCCO
  addToolbarButton('tb-far', "",
                   'http://upload.wikimedia.org/wikipedia/it/5/53/Pulsante_Vuoto.png', '', '');

  
  }
// pulsante FICUS-CONTROLLARE
  if ((toLoad.indexOf(" tbar ")!=-1) || (toLoad.indexOf(" con ")!=-1))
  {
	  addToolbarButton('tb-fic', "javascript:Ficus('C');", 

'http://upload.wikimedia.org/wikipedia/it/e/e2/Pulsante-controllare.gif', 
	                   '[ficus]', '{{C}}ontrollare');
      qualcosa="si";
  }


// pulsante FICUS-WIKIFICARE
  if ((toLoad.indexOf(" tbar ")!=-1) || (toLoad.indexOf(" wiki ")!=-1))
  {
	  addToolbarButton('tb-fic', "javascript:Ficus('W');", 

'http://upload.wikimedia.org/wikipedia/it/2/24/Pulsante-wikificare.gif', 
	                   '[ficus]', '{{W}}ikificare');
      qualcosa="si";
  }

// pulsante FICUS-STUB
  if ((toLoad.indexOf(" tbar ")!=-1) || (toLoad.indexOf(" stu ")!=-1))
  {
	  addToolbarButton('tb-fic', "javascript:Ficus('S');", 'http://upload.wikimedia.org/wikipedia/it/1/11/Stubber.png', 
	                   '[ficus]', '{{S}}tub');
      qualcosa="si";

  }
  
// pulsante TRADURRE
  if ((toLoad.indexOf(" tbar ")!=-1) || (toLoad.indexOf(" tra ")!=-1))
  {
      addToolbarButton('tb-tra', 'javascript:addText("{{T|lingua=xxx|argomento=xxx|data={{subst:CURRENTMONTHNAME}} 

{{subst:CURRENTYEAR}}}}", "Da tradurre", 0)',
	                   'http://upload.wikimedia.org/wikipedia/commons/e/eb/Button_templatelink.png', '[Tra]', 

'{{T|lingua=xxx|argomento=xxx|data={{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}}}');
      qualcosa="si";
  }

// pulsante CATEGORIZZARE
  if ((toLoad.indexOf(" tbar ")!=-1) || (toLoad.indexOf(" cat ")!=-1))
  {
      addToolbarButton('tb-stb', 'javascript:addText("{{Categorizzare}}", "+{{Categorizzare}}", 1)',
                       'http://upload.wikimedia.org/wikipedia/it/5/55/Pulsante-categorizzare.gif', '[Cat]', 

'{{Categorizzare}}');
      qualcosa="si";
  }


// pulsante DA CORREGGERE
  if ((toLoad.indexOf(" tbar ")!=-1) || (toLoad.indexOf(" cgr ")!=-1))
  {
      addToolbarButton('tb-vnd', 'javascript:addText("{{da correggere}}", "{{da correggere}}", 0)',
                       'http://upload.wikimedia.org/wikipedia/commons/d/d9/Button_uncorrect.png', '[Avv]', '{{da 

correggere}}');
      qualcosa="si";
  }

// pulsante FARLOCCO
  if (qualcosa.indexOf("si")!=-1)
	  addToolbarButton('tb-far', "",
                       'http://upload.wikimedia.org/wikipedia/it/5/53/Pulsante_Vuoto.png', '', '');
  qualcosa="no";

if ((toLoad.indexOf(" tbar ")!=-1) || (toLoad.indexOf(" voto ")!=-1))
  {
    // pulsante VOTO FAVOREVOLE +1
      addToolbarButton('tb-piu', 'javascript:addText("*{{+1}} ~~~~","+1", 1)', 
                       'http://upload.wikimedia.org/wikipedia/it/f/f8/Favorevole.png', '[+1]', 'voto +1');

    // pulsante VOTO ASTENUTO =0
      addToolbarButton('tb-uguale', 'javascript:addText("*{{0}} ~~~~","=0", 1)', 
                       'http://upload.wikimedia.org/wikipedia/it/a/aa/Astenuto.png', '[=1]', 'voto =0');

    // pulsante VOTO CONTRARIO -1
      addToolbarButton('tb-meno', 'javascript:addText("*{{-1}} ~~~~","-1", 1)', 
                       'http://upload.wikimedia.org/wikipedia/it/4/43/Contrario.png', '[-1]', 'voto -1');

    // pulsante FARLOCCO
 	  addToolbarButton('tb-far', "",
                           'http://upload.wikimedia.org/wikipedia/it/5/53/Pulsante_Vuoto.png', '', '');
   }


// pulsante CANCELLAZIONE 
  if ((toLoad.indexOf(" tbar ")!=-1) || (toLoad.indexOf(" canc ")!=-1))
  {
      addToolbarButton('tb-vnd', 'javascript:addText("{{Da cancellare}}", "+cancellazione", 0)',
                       'http://upload.wikimedia.org/wikipedia/it/a/a5/Pulsante-cancsempl.gif', '[Canc]', '{{Da 

cancellare}}');
       qualcosa="si";
  }



// pulsante CANCELLAZIONE IMMEDIATA
  if ((toLoad.indexOf(" tbar ")!=-1) || (toLoad.indexOf(" cimm ")!=-1))
  {
      addToolbarButton('tb-vnd', 'javascript:addText("{{Cancella subito}}", "Da cancellare subito", 0)',
                       'http://upload.wikimedia.org/wikipedia/it/8/8f/Pulsante-cancimm.png', '[Canc]', '{{Cancella 

subito}}');
       qualcosa="si";
  }


// pulsante FARLOCCO
  if (qualcosa.indexOf("si")!=-1)
	  addToolbarButton('tb-far', "",
                       'http://upload.wikimedia.org/wikipedia/it/5/53/Pulsante_Vuoto.png', '', '');
  qualcosa="no";

// pulsante AVVISO TEST
  if ((toLoad.indexOf(" tbar ")!=-1) || (toLoad.indexOf(" avand ")!=-1))
  {
      addToolbarButton('tb-vnd', 'javascript:addText("{{test}}~~~~", "+test", 1)',
                       'http://upload.wikimedia.org/wikipedia/it/6/64/Wiki_vand.gif', '[Avv]', '{{test}}');
       qualcosa="si";
  }

// pulsante BLOCK
  if ((toLoad.indexOf(" tbar ")!=-1) || (toLoad.indexOf(" yc ")!=-1))
  {
      addToolbarButton('tb-yc', 'javascript:addText("{{block|~~~~}}", "block", 1)',
                       'http://upload.wikimedia.org/wikipedia/commons/c/cc/Bouton_Vandale2.png', '[Avv]', '{{block}}');	
       qualcosa="si";
  }

// pulsante BLOCK2
  if ((toLoad.indexOf(" tbar ")!=-1) || (toLoad.indexOf(" rc ")!=-1))
  {
      addToolbarButton('tb-rc', 'javascript:addText("{{block2|tempo del blocco}}", "block2", 1)',
                   'http://upload.wikimedia.org/wikipedia/commons/e/e4/Bouton_Vandale3.png', '[Avv]', '{{block2}}');	
       qualcosa="si";
  }

// pulsante AVVISO SPAM
  if ((toLoad.indexOf(" tbar ")!=-1) || (toLoad.indexOf(" spam ")!=-1))
  {
      addToolbarButton('tb-vnd', 'javascript:addText("{{Spam}}~~~~", "Avviso spam", 1)',
                       'http://upload.wikimedia.org/wikipedia/it/c/cb/Pulsante_spam.png', '[Avv]', '{{Spam}}');
       qualcosa="si";

  }


// pulsante BENVENUTO
  {
  if ((toLoad.indexOf(" tbar ")!=-1) || (toLoad.indexOf(" benv ")!=-1))
      addToolbarButton('tb-vnd', 'javascript:addText("{{Benvenuto|nome={{PAGENAME}}|firma=--~~~~}}", "Benvenuto su 

it.wikty!", 0)',
                       'http://upload.wikimedia.org/wikipedia/it/7/74/Pulsante_benvenuto.png', '[benv]', 

'{{Benvenuto|nome={{PAGENAME}}|firma=--~~~~}}');
       qualcosa="si";
  }


// pulsante GRAZIE
  if ((toLoad.indexOf(" tbar ")!=-1) || (toLoad.indexOf(" grz ")!=-1))
  {
      addToolbarButton('tb-gra', 'javascript:addText("{{Grazie}} ~~~~", "Grazie", 1)',
                       'http://upload.wikimedia.org/wikipedia/it/2/23/Pulsante_grazie.png', '[Gr]', '{{Grazie}}');	
       qualcosa="si";
  }

  // pulsante FARLOCCO
  if (qualcosa.indexOf("si")!=-1)
	  addToolbarButton('tb-far', "",
                       'http://upload.wikimedia.org/wikipedia/it/5/53/Pulsante_Vuoto.png', '', '');
  qualcosa="no";



  }



// pulsante VEDI ANCHE
  if ((toLoad.indexOf(" tbar ")!=-1) || (toLoad.indexOf(" vedan ")!=-1))
  {
      addToolbarButton('tb-van', 'javascript:addText("{{vedi anche|[[titolo della voce]]}}", "vedi anche", 0)',
                       'http://upload.wikimedia.org/wikipedia/commons/1/12/Button_find.png', '[va]', '{{vedi anche}}');	
       qualcosa="si";

  }

  // pulsante GALLERIA
  if ((toLoad.indexOf(" tbar ")!=-1) || (toLoad.indexOf(" gall ")!=-1))
  {
  addToolbarButton('tb-gal', 'javascript:addText("<gallery></gallery>", "galleria immagini", 1)',
                   'http://upload.wikimedia.org/wikipedia/commons/9/9e/Btn_toolbar_gallery.png', '[ga]', 'galleria 

immagini');	
       qualcosa="si";
  }

// pulsante REFERENCES
  if ((toLoad.indexOf(" tbar ")!=-1) || (toLoad.indexOf(" ref ")!=-1))
  {
  addToolbarButton('tb-gal', 'javascript:addText("<ref></ref>", "ref", 1)',
                   'http://upload.wikimedia.org/wikipedia/commons/7/79/Button_reflink.png', '[RF]', 'ref');	
       qualcosa="si";
  }

// pulsante INTERPROGETTO
  if ((toLoad.indexOf(" tbar ")!=-1) || (toLoad.indexOf(" ipro ")!=-1))
  {
  addToolbarButton('tb-van', 'javascript:addText("{{interprogetto|nome del progetto=nome pagina}}", "interprogetto", 1)',
                   'http://upload.wikimedia.org/wikipedia/commons/6/63/Button_out_relevancy.png', '[in]', 

'{{interpprogetto}}');	
       qualcosa="si";
  }

// pulsante SCROLL BOX
  if ((toLoad.indexOf(" tbar ")!=-1) || (toLoad.indexOf(" sbo ")!=-1))
  {
  addToolbarButton('tb-sbo', 'javascript:addText("{{scroll box|larghezza=100%|altezza=100px|testo=testo contenuto}}", "scroll 

box", 1)',
                   'http://upload.wikimedia.org/wikipedia/commons/7/74/Button_comment.png', '[in]', '{{scrollbox}}');	
       qualcosa="si";
  }

}
addLoadEvent(ToolbarButton);

// Aggiunge indirizzi nella toolbar personale
// code stolen from [[wikt:en:User:Hippietrail]]

function addTools() {
  var myprefs = document.getElementById('pt-mycontris'); 
  var newpt;
  var newa;

  var username = document.getElementById('pt-userpage').getElementsByTagName('a')[0].innerHTML;

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

if (toLoad.indexOf(" chat ")!=-1)
    addOnloadHook(addTools);

/**** Fine ****/

// 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]]
// <nowiki>
if (toLoad.indexOf(" avan ")!=-1)
    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>

// script "Catwatch" ver. 1.0<br/>
// Vedi [[Utente:Jalo/Catwatch.js]]
// <nowiki>
if (toLoad.indexOf(" cwtch ")!=-1)
    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>

// script "ricerca in Namespace"<br/>
// Vedi [[Utente:Jalo/namespaceSearch.js]], derivato dal tool di [[:en:User:Ilmari Karonen|Ilmari Karonen]]; tradotto ed 

adattato da [[Utente:Jalo|Jalo]]
// <pre><nowiki>
if (toLoad.indexOf(" nms ")!=-1)
    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 "Popup di navigazione"<br/>
// Vedi [[:en:User:Lupin/popups.js]] di [[:en:User:Lupin|Lupin]]
// <pre><nowiki>
if (toLoad.indexOf(" popup ")!=-1)
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 (toLoad.indexOf(" popup ")!=-1)
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 "Command line"<br/>
// Vedi [[Utente:Salvatore_Ingala/commandline.js]] di [[Utente:Salvatore_Ingala]]
// <pre><nowiki>
if (toLoad.indexOf(" cmd ")!=-1)
document.write('<script type="text/javascript" src="' 
    + 'http://it.wikipedia.org/w/index.php?title=Utente:Salvatore_Ingala/commandline.js'