|
//<pre>
// Elenco dei tool da caricare.
var toLoad="purg led ns0 lks orol tabs nav stru unw tbar avan cwtch popup nms chat cmd qed wed since goo rch edt ver vpop vfol bot linkcomplete qdel lrc dels";
var myButtons = new Array([2,'{{','}}','{{}}',0,''],[2,'{{tl|','}}','Cita template',0,''],[2,'{{Tradotto da|en|','|00-00-2008|4}}','Tradotto da en',0,'+template "tradotto da"'],[2,'{{Citazione necessaria|','}}','Citazione necessaria',0,'+template "Citazione necessaria"'],[2,'{{Quote|','}}','Quote',0,''],[2,'{{Screenshot Copyrighted||software}}','','Screenshot copyrighted software',36,'+ template "Screenshot copyrighted"'],[2,'{{Screenshot Copyrighted||tv}}','','Screenshot copyrighted tv',30,'+ template "Screenshot copyrighted"'],[2,'{{Screenshot Copyrighted||film}}','','Screenshot copyrighted film',32,'+ template "Screenshot copyrighted"'],[2,' ','','& nbsp;',6,''],[2,'{{NowCommons|nome del file su Commons senza Image:}} ','','NowCommons',53,'{{NowCommons}} '],[2,'{{unsigned|nome|data}}','','{{unsigned}}',22,'{{unsigned}}'],[1,'{{marchio}}','0','{{marchio}}',0,'+template [[template:marchio]]'],[2,'{{Immagine orfana|libera}}','','Immagine orfana libera',26,'+template "immagine orfana"'],[2,'{{subst:orfandata}}','','Immagine orfana NON LIBERA',19,'+template "immagine orfana NON LIBERA"'],[2,'{{subst:unverdata}}','','{{subst:unverdata}}',19,'{{subst:unverdata}}']);
var myLinks = new Array(['Voce su en.wiki','http://en.wikipedia.org/wiki/%TITOLO%'],['Voce su Commons','http://commons.wikimedia.org/wiki/Image:%TITOLO2%'],['Vecchio Edit-count','http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?user=Jalo&dbname=itwiki_p'],['Bold / No bold','javascript:bolda();'],['Logo / No logo','javascript:noLogo();']);
// Firefox
var toLoad = "tbar purg led ns0 lks orol tabs chat mjs sand csu unw cwtch popup nms qed since edt vfol linkcomplete lrc elrc rch clink";
//Monobook Modulare
//Lancia il vero monobook
// Vedi [[Wikipedia:Monobook.js/MonobookCompleto.js]]
//
document.writeln('<script type="text/javascript" src="/w/index.php?title=Wikipedia:Monobook.js/MonobookCompleto.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//JUST FOR DEBUG
//document.writeln('<script type="text/javascript" src="/w/index.php?title=Utente:Jalo/monobook.js/test&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//CONFIGURAZIONE POPUP
popupDelay = 2; // aspetta 2 secondi
popupRedlinkRemoval = true; // elimina i collegamenti a link rossi
popupQueriedRevertSummary = "Rollback da popup. Ripristinata la versione di $3";
popupRedlinkSummary = "Eliminato link rosso: %s";
//Mostra i Tatoo
document.writeln('<script type="text/javascript" src="/w/index.php?title=Utente:EH101/Tatoo&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//TASTI PERSONALI
$( document ).ready ( function ()
{
if (document.title.indexOf("Modifica") == -1)
return;
addToolbarButton('tb-firma', 'javascript:addTextAtCursor("~~~~","","",4)',
'http://upload.wikimedia.org/wikipedia/commons/d/d1/Button_mysignature.png', 'My sign', 'Jalo');
addToolbarButton('tb-commento', 'javascript:addTextAtCursor("<!"+"--","Tolgo immagine inesistente","-->",0)',
'http://upload.wikimedia.org/wikipedia/commons/2/23/Quotes-Lithuanian.png', 'no-img', 'Tolgo immagine inesistente');
daInserire = "==Cronologia precedente alla pulizia dai copyviol==\n{{cassetto\n|titolo=cronologia\n|testo=<pre>\n</pre>}}";
addToolbarButton('tb-cass', 'javascript:aggiungiTesto(daInserire, "Cronologia pre-pulizia copyviol", 1)',
'http://upload.wikimedia.org/wikipedia/commons/c/cd/Button_vote_deletion.png', '[pre-copyviol]', 'Cronologia pre-copyviol');
});
//NASCONDI IL COPYWARN SOTTO LA CASELLA DI MODIFICA
$( document ).ready ( function ()
{
if (document.getElementById("editpage-copywarn"))
document.getElementById("editpage-copywarn").style.display="none";
})
//Bolda il "wpTextbox1"
function bolda()
{
//Inverte BOLD/NO BOLD
var cookieExpire = new Date(); // scadenza del cookie
cookieExpire.setTime(cookieExpire.getTime() + (30 * 24 * 60 * 60 * 1000)); // il cookie scade dopo un mese
var boldare = GetCookie('wikiBolda');
if (boldare == 'si')
SetCookie('wikiBolda', 'no', cookieExpire.toGMTString(), '/');
else
SetCookie('wikiBolda', 'si', cookieExpire.toGMTString(), '/');
}
if (wgAction == "edit")
$( document ).ready ( function ()
{
var boldare = GetCookie('wikiBolda');
if (boldare == 'si')
$("wpTextbox1").style.fontWeight = "bold";
})
//Nascondi il logo di wikipedia
function noLogo()
{
//Inverte LOGO/NO LOGO
var cookieExpire = new Date(); // scadenza del cookie
cookieExpire.setTime(cookieExpire.getTime() + (30 * 24 * 60 * 60 * 1000)); // il cookie scade dopo un mese
var nologo = GetCookie('wikiLogo');
if (nologo == 'si')
SetCookie('wikiLogo', 'no', cookieExpire.toGMTString(), '/');
else
SetCookie('wikiLogo', 'si', cookieExpire.toGMTString(), '/');
}
$( document ).ready ( function ()
{
var nologo = GetCookie('wikiLogo');
if (nologo == 'si')
$("p-logo").style.display = "none";
})
// TRADOTTO DA
function addTradottoDa()
{
enArticle = getpagecontent(wgTitle);
enArticle = enArticle.substr(enArticle.indexOf("[[en:")+5);
enArticle = enArticle.substr(0,enArticle.indexOf("]]"));
var my_date = new Date();
dataOggi = my_date.getDate()+" "+arrayMese[my_date.getMonth()+1]+" "+(1900+my_date.getYear());
addTextAtCursor("{{Tradotto da|en|"+enArticle+"|"+dataOggi+"|id}}\n~~"+"~~","+Tradotto da","",0);
}
// Configurazione HOTKEYS
var tastiHotkeys = new Array();
tastiHotkeys["firma"] = 'F';
tastiHotkeys["cate"] = 'C';
tastiHotkeys["obj"] = 'Z';
pulsantiComandoPers = new Array();
pulsantiHotkeyPers = new Array();
pulsantiDescrPers = new Array();
//PATRIMONIO
pulsantiComandoPers["patrimonio"] = 'javascript:addTextAtCursor("[[patrimonio dell\'umanità|patrimoni dell\'umanità]]","","",50)';
pulsantiHotkeyPers["patrimonio"] = 'P';
pulsantiDescrPers["patrimonio"] = 'Patrimonio';
//UNESCO
pulsantiComandoPers["unesco"] = 'javascript:addTextAtCursor("[[Organizzazione delle Nazioni Unite per l\'Educazione, la Scienza e la Cultura|UNESCO]]","","",87)';
pulsantiHotkeyPers["unesco"] = 'U';
pulsantiDescrPers["unesco"] = 'Unesco';
//SUP 2
pulsantiComandoPers["sup2"] = 'javascript:addTextAtCursor("²","","",1)';
pulsantiHotkeyPers["sup2"] = '2';
pulsantiDescrPers["sup2"] = 'Alla seconda';
//CITA
pulsantiComandoPers["cita"] = 'javascript:addTextAtCursor("<ref>{{Cita||}}</ref>","","",12)';
pulsantiHotkeyPers["cita"] = '';
pulsantiDescrPers["cita"] = '{{Cita}}';
//TESTO ROSSO
pulsantiComandoPers["rosso"] = 'javascript:addTextAtCursor(\'<span style="color:red">\',"","</span>",0)';
pulsantiHotkeyPers["rosso"] = 'R';
pulsantiDescrPers["rosso"] = 'Testo rosso';
//PORTALE ANTICA ROMA
pulsantiComandoPers["roma"] = 'javascript:addTextAtCursor("{{Portale|Antica Roma|Germani|Storia}}","","",0)';
pulsantiHotkeyPers["roma"] = 'A';
pulsantiDescrPers["roma"] = 'Portali';
//SOVRAIMMAGINE
pulsantiComandoPers["simm"] = 'javascript:addTextAtCursor("{{Sovraimmagine\\n | allineamento = right\\n | sotto = Germania Magna jpg.jpg\\n | sotto_larghezza = 300px\\n | sotto_didascalia = Mappa delle tribù germaniche (Nell ovale rosso gli Angrivari)\\n | sopra = Red oval.svg\\n | sopra_larghezza = 40px\\n | sopra_didascalia = Angrivari\\n | x = 80\\n | y = 55\\n}}","","",0)';
pulsantiHotkeyPers["simm"] = 'S';
pulsantiDescrPers["simm"] = 'Sovraimmagine';
//INTERPROGETTO
pulsantiComandoPers["ipro2"] = 'javascript:addTextAtCursor("==Altri progetti==\\n\\n\\n\\n","","",20)';
pulsantiHotkeyPers["ipro2"] = 'I';
pulsantiDescrPers["ipro2"] = 'Interprogetto + titolo';
//CATEGORY:
pulsantiComandoPers["category"] = 'javascript:addTextAtCursor("Category:","","",9)';
pulsantiHotkeyPers["category"] = 'X';
pulsantiDescrPers["category"] = 'Category:';
//FOTO RICHIESTE:
pulsantiComandoPers["foto"] = 'javascript:addTextAtCursor("{{Richiesta"+" foto|}}","","",17)';
pulsantiHotkeyPers["foto"] = 'N';
pulsantiDescrPers["foto"] = 'Richiesta foto';
//TRADOTTO DA:
pulsantiComandoPers["mytradda"] = 'javascript:addTradottoDa()';
pulsantiHotkeyPers["mytradda"] = 'T';
pulsantiDescrPers["mytradda"] = 'Tradotto da';
//BUTTONGREEN PER CONTRIBUTI:
pulsantiComandoPers["butgreen"] = 'javascript:addTextAtCursor(" [[Immagine:ButtonGreen.svg|15px]] ","","",35)';
pulsantiHotkeyPers["butgreen"] = 'A';
pulsantiDescrPers["butgreen"] = 'ButtonGreen';
//PORTALE MITOLOGIA:
pulsantiComandoPers["mito"] = 'javascript:addTextAtCursor("{{Portale|Mitologia}}","","",19)';
pulsantiHotkeyPers["mito"] = 'M';
pulsantiDescrPers["mito"] = 'Portale mitologia';
function getScrollXY() {
var scrOfX = 0, scrOfY = 0;
if( typeof( window.pageYOffset ) == 'number' ) {
//Netscape compliant
scrOfY = window.pageYOffset;
scrOfX = window.pageXOffset;
} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
//DOM compliant
scrOfY = document.body.scrollTop;
scrOfX = document.body.scrollLeft;
} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
//IE6 standards compliant mode
scrOfY = document.documentElement.scrollTop;
scrOfX = document.documentElement.scrollLeft;
}
return [ scrOfX, scrOfY ];
}
function hidePopup()
{
document.getElementById("cercaPopup").style.display = "none";
}
function showPopup(testo, x, y)
{
scrolling = getScrollXY();
popup = document.getElementById("cercaPopup");
popup.style.left = (x+scrolling[0]+5)+"px";
popup.style.top = (y+scrolling[1]-5-37)+"px";
popup.style.display = "block";
// popup.onclick = function(){window.open('http://it.wikipedia.org/w/index.php?title=Speciale%3ARicerca&search='+encodeURIComponent(testo), 'searchPage'+Math.random());};
popup.onclick = function(){window.open('http://it.wikipedia.org/w/index.php?title=Speciale%3ARicerca&search='+encodeURIComponent(testo), 'searchPage'+x);};
}
if (wgAction=="view")
$( document ).ready ( function ()
{
var listenerMouseUp = function(e){
e = (e) ? e : ((window.event) ? window.event : null);
if(e){
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
if (t)
showPopup(t, e.clientX, e.clientY);
else
hidePopup();
}
}
if (window.addEventListener)
window.addEventListener('mouseup', listenerMouseUp, false); //Non-IE
else
document.onmouseup = listenerMouseUp; //IE
var img= (BrowserDetect.browser=="Explorer")? new Image() : document.createElement('img');
img.id = 'cercaPopup';
img.src = 'http://upload.wikimedia.org/wikipedia/commons/e/ee/Nuvola_apps_comic_strip-cerca.png';
img.style.height="37px";
img.style.position = "absolute";
img.style.width = "50px";
img.style.zIndex = 3;
img.style.cursor = "help";
img.style.display = "none";
document.getElementsByTagName("body")[0].appendChild(img);
})
//</pre>
/*<pre><nowiki>*/
//=== inizio: CATEGORY WATCH ===
var cwwpajax;
// From [[WP:US]] mainpage (wpajax renamed to cwwpajax)
cwwpajax={
download:function(bundle) {
// mandatory: bundle.url
// optional: bundle.onSuccess (xmlhttprequest, bundle)
// optional: bundle.onFailure (xmlhttprequest, bundle)
// optional: bundle.otherStuff OK too, passed to onSuccess and onFailure
var x = window.XMLHttpRequest ? new XMLHttpRequest()
: window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP")
: false;
if (x) {
x.onreadystatechange=function() {
x.readyState==4 && cwwpajax.downloadComplete(x,bundle);
};
x.open("GET",bundle.url,true);
x.send(null);
}
return x;
},
downloadComplete:function(x,bundle) {
x.status==200 && ( bundle.onSuccess && bundle.onSuccess(x,bundle) || true )
|| ( bundle.onFailure && bundle.onFailure(x,bundle) || alert(x.statusText));
}
};
//Aggiunge le catwatch alla watchlist
//xmlreq=risultato della query (es:http://it.wikipedia.org/w/query.php?what=category&cptitle=Guerre%20Stellari&cplimit=100&cpextended&format=xml)
//data=nome della categoria
function cwOntoWatchlist(xmlreq, data)
{
var a=xmlreq.responseText;
var c=data.catname;
var i;
if(a.indexOf("<error>")!=-1) //cat e' vuota, niente da fare qui
{
var inoltre;
if (c.indexOf("Categoria:")!=-1)
inoltre="Ti ricordo che non va inserita la parte \"Categoria:\"";
else
inoltre="";
if (showWarning.indexOf("disabilita")==-1)
alert("La categoria \""+c+"\" sembra vuota.\nControlla se il nome e' scritto giusto.\n"+inoltre);
return;
}
if(a.indexOf("<category next=")!=-1) //cat ha piu' di 100 elementi, i risultati verranno eliminati
{
if (showWarning.indexOf("disabilita")==-1)
alert("La categoria \""+c+"\" ha piu' di 100 elementi e non puo' essere monitorata.\n"+
"Considera la possibilita' di dividerla in sottocategorie");
return;
}
a=a.split("<timestamp>");
var latesttime=0;
var latestpage="";
var listaPagine=new Array();
var listaTime=new Array();
var temp, temp2;
var counter=0;
for(i in a)
{
temp=a[i].indexOf("</timestamp>");
if(temp!=-1)
{
temp=new Number(a[i].substr(0,temp));
if(temp>latesttime)
{
listaTime[counter]=temp;
a[i]=a[i].substr(a[i].indexOf("<title>")+7);
listaPagine[counter]=a[i].substr(0,a[i].indexOf("</title>"));
counter++;
}
}
}
var dates=document.getElementsByTagName("h4"); //recupera le date dalla pagina della watchlist
var monthname=new Array();
monthname['01']="gen";
monthname['02']="feb";
monthname['03']="mar";
monthname['04']="apr";
monthname['05']="mag";
monthname['06']="giu";
monthname['07']="lug";
monthname['08']="ago";
monthname['09']="set";
monthname['10']="ott";
monthname['11']="nov";
monthname['12']="dic";
i=dates.length;
var totcycle=listaPagine.length; // numero delle pagine della Categoria corrente
while(i--) // Per ogni giorno della lista
{
for (var loopTimes=0;loopTimes<totcycle;loopTimes++) // Per ogni pagina della lista
{
latestpage=listaPagine[loopTimes];
latesttime=listaTime[loopTimes];
latesttime=new String(latesttime);
// es: temp=2006 dic 25
temp=""+new Number(latesttime.substr(6,2))+" "+monthname[latesttime.substr(4,2)]+" "+latesttime.substr(0,4);
// se la data che stiamo esaminando corrisponde alla data della pagina
if(dates[i].firstChild.nodeValue==temp)
{
temp=dates[i].nextSibling.firstChild;
// Questo while dovrebbe inserire la modifica in ordine cronologico
// tra le altre modifiche. Funzionava solo nella versione inglese e l'ho
// lasciata qui perche', qualche anima pia, potrebbe in futuro correggerla
while(temp!=null)
{
if(temp.tagName!=null)
if(temp.tagName.toLowerCase()=="li")
{
temp2=temp.innerHTML.match(/; ([0-9][0-9]):([0-9][0-9]) \. \./);
temp2=new Number(temp2[1])*100+new Number(temp2[2]);
if(temp2<new Number(latesttime.substr(8,4))) {temp2=temp; break;}
}
temp2=temp; temp=temp.nextSibling;
if(temp==null) break;
}
// l'elemento che andra' inserito
temp3=document.createElement("li");
// se l'ordinamento aveva funzionato (ovvero mai)
if (temp2!=null)
{
dates[i].nextSibling.insertBefore(temp3,temp2);
}
else
{
dates[i].appendChild(temp3);
}
// riempi l'item con i dati necessari
temp3.innerHTML="<font size=-1>Modifiche in <a href='http://it.wikipedia.org/wiki/Categoria:"+encodeURI(c)+
"'>Categoria:"+c+"</a>; "+latesttime.substr(8,2)+":"+latesttime.substr(10,2)+" . . (+ "+
"<a href='http://it.wikipedia.org/wiki/"+encodeURI(latestpage)+"'>"+latestpage+"</a> "+
"(<a href='http://it.wikipedia.org/w/index.php?title="+encodeURI(latestpage)+
"&diff=last'>diff</a>) (<a href='http://it.wikipedia.org/w/index.php?title="+
encodeURI(latestpage)+"&action=history'>cron</a>))</font>";
}
}
}
}
var CategorieOsservate; //evita errori se ancora non esiste una cat-watchlist
var showWarning; //evita errori se ancora non esiste una cat-watchlist
//Un esempio di query per il controllo di una categoria potrebbe essere
//http://it.wikipedia.org/w/query.php?what=category&cptitle=Guerre%20Stellari&cplimit=100&cpextended&format=xml
addOnloadHook(function(){
// se siamo nella watchlist
if(wgPageName=="Speciale:Watchlist")
{
if(CategorieOsservate==undefined) // se non e' mai stata creata la lista personale delle Categorie
{
if(confirm("Ancora non hai una lista di categorie da controllare. Vuoi crearne una?"))
___location.href='http://it.wikipedia.org/w/index.php?title=Utente:'+wgUserName+
'/CategorieOsservate.js&action=edit&preload=Utente:Jalo/CategorieOsservateTemplate.js';
}
else // la lista gia' esiste
{
var i;
for(i in CategorieOsservate) // Per ogni cateoria lancia il controllo
{
var a=CategorieOsservate[i];
cwwpajax.download({url:'http://it.wikipedia.org/w/query.php?what=category&cptitle='+encodeURI(a)+
'&cplimit=100&cpextended&format=xml', onSuccess:cwOntoWatchlist, catname:a});
}
}
}
});
// aggiungi la watchlist delle categorie dell'utente
document.write('<script type="text/javascript" src="http://it.wikipedia.org'
+ '/w/index.php?title=Utente:'+wgUserName+'/CategorieOsservate.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//=== fine: CATEGORY WATCH ===
/* </nowiki></pre> */
|