Utente:Cafi96/monobook.js: differenze tra le versioni
Vai alla navigazione
Vai alla ricerca
Contenuto aggiunto Contenuto cancellato
Cafi96 (rosica | curriculum) mNessun oggetto della modifica |
Void (rosica | curriculum) m (Void ha spostato la pagina Utente:Cafi96 temp/monobook.js a Utente:Cafi96/monobook.js: Pagina spostata automaticamente durante la rinomina dell'utente "Cafi96 temp" a "Cafi96") |
||
(45 versioni intermedie di 3 utenti non mostrate) | |||
Riga 1: | Riga 1: | ||
//Bottoni |
|||
if (mwCustomEditButtons) { |
if (mwCustomEditButtons) { |
||
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteCC; |
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteCC; |
||
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteCancellazione; |
|||
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteScadenza; |
|||
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteBTA; |
|||
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteCit2; |
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteCit2; |
||
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteCitnec; |
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteCitnec; |
||
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteReflink; |
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteReflink; |
||
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteAccusa; |
|||
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteAPU; |
|||
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteRestauro; |
|||
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteFormattazione1; |
|||
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteNomedimmerda; |
|||
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteGallery; |
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteGallery; |
||
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteTabella; |
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteTabella; |
||
Riga 17: | Riga 10: | ||
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteRedirect; |
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteRedirect; |
||
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteCassetto; |
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteCassetto; |
||
import_script((wgAction=='edit' || wgAction == 'submit'), "Nonciclopedia:Script/Searchbox.js"); |
|||
buttonPurge = 1; |
|||
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteCensura; |
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteCensura; |
||
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteManuali; |
|||
"imageFile": "http://images2.wikia.nocookie.net/nonciclopedia/images/b/b3/Pulsante_niubbi.png", |
|||
"speedTip": "Prenota il tuo NIUBBO!", |
|||
"tagOpen": "{{NST|", |
|||
"tagClose": "|{{utente:Cafi96/firma}}}" + "}\n\n", |
|||
"sampleText": "Cafi96"}; |
|||
addOnloadHook(function() { |
|||
if(!document.getElementById("toolbar")) return; |
|||
if(wgCurRevisionId) |
|||
mwEditButtons[9].tagOpen = '--~~' + '~~{{VF|' + wgCurRevisionId + '}' + '}'; |
|||
else |
|||
mwEditButtons[9].tagOpen = '--~~' + '~~{{VF|}' + '}'; |
|||
} |
|||
); |
|||
} |
} |
||
addOnloadHook(function() { |
|||
if(!document.getElementById("toolbar")) return; |
|||
if(wgCurRevisionId) |
|||
mwEditButtons[9].tagOpen = '--~~' + '~~{{VF|' + wgCurRevisionId + '}' + '}'; |
|||
else |
|||
mwEditButtons[9].tagOpen = '--~~' + '~~{{VF|}' + '}'; |
|||
} |
|||
); |
|||
addOnloadHook(quickpreviewLoad); |
|||
var quickpreview_firstLoad = true; |
|||
function quickpreview () { |
|||
document.getElementById("quickpreviewButton").disabled = true; |
|||
var previewArea = document.getElementById("wikiPreview"); |
|||
if (previewArea == null) return false; |
|||
previewArea.innerHTML = ''; |
|||
if (quickpreview_firstLoad) { |
|||
previewArea.style.display = 'block'; |
|||
var temp = document.getElementById("editintro"); |
|||
if (temp) temp.style.display = 'none'; |
|||
temp = getElementsByClass(document, "mw-newarticletext")[0]; |
|||
if (temp) temp.style.display = 'none'; |
|||
temp = getElementsByClass(document, "mw-warning-with-logexcerpt")[0]; |
|||
if (temp) temp.style.display = 'none'; |
|||
temp = document.getElementById("contentSub2"); |
|||
if (temp) temp.style.display = 'none'; |
|||
document.getElementById("firstHeading").innerHTML = wgPageName.replace(/_/g, ' '); |
|||
quickpreview_firstLoad = false; |
|||
} |
|||
var textbox = document.getElementById("wpTextbox1"); |
|||
var Source; |
|||
var start = textbox.selectionStart, end = textbox.selectionEnd; |
|||
if (start < end) Source = textbox.value.slice(start, end); |
|||
else Source = textbox.value + '\n'; |
|||
Source = Source.replace(/&/g, "%26"); |
|||
document.getElementsByTagName('body')[0].style.cursor = 'progress'; |
|||
var httpRequest; |
|||
if (window.XMLHttpRequest) { // Mozilla, Safari, ... |
|||
httpRequest = new XMLHttpRequest(); |
|||
} else if (window.ActiveXObject) { // IE |
|||
httpRequest = new ActiveXObject("Microsoft.XMLHTTP"); |
|||
} |
|||
var id = setTimeout(function() { httpRequest.abort(); alert("Errore: il server non risponde"); Finish(false); }, 30000); |
|||
httpRequest.onreadystatechange = function () { Write(httpRequest, id); return;}; |
|||
var url = wgServer + wgScriptPath + "/api.php"; |
|||
var param = "action=parse&title=" + encodeURI(wgPageName).replace(/&/g, "%26") + "&format=xml&prop=text|categories&pst&text=__NOEDITSECTION__"; |
|||
httpRequest.open('POST', url, true); |
|||
httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); |
|||
httpRequest.setRequestHeader('Content-Length', param.length + Source.length); |
|||
httpRequest.send(param + Source); |
|||
return; |
|||
function Write(o, id) { |
|||
if (o.readyState != 4) return; |
|||
clearTimeout(id); |
|||
if (o.status != 200) { |
|||
if (o.status && (o.status < 199 || o.status > 300)) { |
|||
alert("Anteprima non riuscita. Risposta del server: " + o.status); |
|||
Finish(false); |
|||
} |
|||
return; |
|||
} |
|||
if (o.responseXML == null) { |
|||
alert("Anteprima non riuscita (errore del parser?)"); |
|||
Finish(false); |
|||
return; |
|||
} |
|||
if(o.responseXML.normalize) o.responseXML.normalize(); |
|||
var R = o.responseXML.getElementsByTagName('text')[0].firstChild; |
|||
var code = R.data; |
|||
previewArea.innerHTML += code; |
|||
// aggiungi categorie |
|||
R = o.responseXML.getElementsByTagName('categories')[0].getElementsByTagName('cl'); |
|||
if (R.length > 0) { |
|||
var catlinksBox = document.getElementById("catlinks"); |
|||
if (catlinksBox != null) catlinksBox.innerHTML = ''; |
|||
else { |
|||
catlinksBox = document.createElement('div'); |
|||
catlinksBox.id = "catlinks"; |
|||
catlinksBox.className = "catlinks"; |
|||
document.getElementById("bodyContent").insertBefore(catlinksBox, getElementsByClass(document.getElementById("bodyContent"), "visualClear", 'div')[0]); |
|||
} |
|||
var normalcatlinks = new Array(); |
|||
var hiddencatlinks = new Array(); |
|||
var catname, sortkey, catl, i; |
|||
var HCsep = '|'; |
|||
var hiddencategories = new Array("Articoli_da_cancellare", "Articoli_da_formattare", "Articoli_da_restaurare", "Articoli_da_rifinire", "Articoli_da_sorvegliare", "Articoli_da_unire", "Articoli_in_costruzione", "Articoli_in_scadenza", "Articoli_orfani", "Articoli_prenotati", "Articoli_senza_immagini", "Articoli_sotto_accusa", "Immagini_da_modificare", "Immagini_da_rinominare", "Immagini_da_tradurre", "Immagini_sotto_copyright", "Immagini/Categorie_di_sistema", "Pagine_da_cancellare", "Pagine_da_controllare", "Pagine_in_costruzione", "Pagine_in_restauro", "Pagine_sotto_accusa", "Stub"); |
|||
var hiddenCats = HCsep + hiddencategories.join(HCsep) + HCsep; |
|||
for (i=0; i<R.length; i++) { |
|||
catname = R.item(i).firstChild.nodeValue; |
|||
sortkey = R.item(i).getAttribute("sortkey"); |
|||
catl = '<span dir="ltr"><a href="/wiki/Categoria:' + encodeURI(catname) + '" title="Categoria:' + catname.replace(/_/g, ' ') + ' [sortkey: <' + sortkey + '> ]">' + catname.replace(/_/g, ' ') + '</a></span>'; |
|||
if (hiddenCats.indexOf(HCsep + catname + HCsep) == -1) normalcatlinks.push(catl); |
|||
else hiddencatlinks.push(catl); |
|||
} |
|||
var tmp = ''; |
|||
if (normalcatlinks.length > 0) { |
|||
var normalcatlinksBox = document.createElement('div'); |
|||
normalcatlinksBox.id = "mw-normal-catlinks"; |
|||
catlinksBox.appendChild(normalcatlinksBox); |
|||
tmp = "<a title='Speciale:Categorie' href='/wiki/Speciale:Categorie'>Categori" + ((normalcatlinks.length > 1)? "e</a>: " + normalcatlinks.join(" | ") : "a</a>: " + normalcatlinks[0]); |
|||
normalcatlinksBox.innerHTML = tmp; |
|||
} |
|||
if (hiddencatlinks.length > 0) { |
|||
var hiddencatlinksBox = document.createElement('div'); |
|||
hiddencatlinksBox.id = "mw-hidden-catlinks"; |
|||
hiddencatlinksBox.className = "mw-hidden-cats-hidden"; |
|||
if (normalcatlinks.length == 0) catlinksBox.className += " catlinks-allhidden"; |
|||
catlinksBox.appendChild(hiddencatlinksBox); |
|||
tmp = "Categori" + ((hiddencatlinks.length > 1)? "e nascoste: " + hiddencatlinks.join(" | ") : "a nascosta: " + hiddencatlinks[0]); |
|||
hiddencatlinksBox.innerHTML = tmp; |
|||
} |
|||
} |
|||
// mostra il toggle dell'indice |
|||
if (window.showTocToggle) { window.tocShowText = "mostra"; window.tocHideText = "nascondi"; showTocToggle(); } |
|||
// carica onloadhooks |
|||
addCss(); |
|||
createCollapseButtons (); |
|||
createNavigationBarToggleButton(); // navframe |
|||
createToggleLinks(); // morph |
|||
rewriteTitle(); |
|||
change_subtitle(); |
|||
randomlist(); |
|||
UserNameReplace(); |
|||
Finish(true) // caricamento terminato |
|||
return; |
|||
} |
|||
function Finish(success) { |
|||
document.getElementsByTagName('body')[0].style.cursor = 'auto'; |
|||
document.getElementById("quickpreviewButton").disabled = false; |
|||
return; |
|||
} |
|||
} // <- quickpreview(); |
|||
function quickpreviewLoad() { |
|||
var buttons = getElementsByClass(document, "editButtons", 'div')[0]; |
|||
if (buttons == null) return; |
|||
var b = document.createElement('input'); |
|||
b.type = 'button'; |
|||
b.value = "Ant. rapida"; |
|||
b.id = "quickpreviewButton"; |
|||
b.marginRight = "0.33em"; |
|||
if (b.addEventListener) b.addEventListener('click', quickpreview, false); |
|||
else if (b.attachEvent) b.attachEvent('onclick', quickpreview); |
|||
buttons.insertBefore(b, document.getElementById("wpDiff")); |
|||
document.getElementById("wpPreview").value = "Anteprima"; |
|||
document.getElementById("wpDiff").value = "Cambiamenti"; |
|||
var editHelp = getElementsByClass(buttons, "editHelp", 'span')[0]; |
|||
editHelp.style.fontSize = 'x-small'; |
|||
return; |
|||
} |
|||
//------------- Prelevato da: http://en.wikipedia.org/wiki/User:Zocky/SearchBox.js --------------------- |
|||
importStylesheetURI('http://nonciclopedia.wikia.com/index.php?title=Utente:Nonciclopediologo/Searchbox.css&action=raw&ctype=text/css'); |
|||
var sr$t; |
|||
var sr$f; |
|||
var sr$s; |
|||
var sr$r; |
|||
var sr$w; |
|||
var sr$i; |
|||
var sr$re; |
|||
var sr$mc; |
|||
function $e(id) {return document.getElementById(id)} |
|||
function srBack() |
|||
{ |
|||
if (sr$s.value=='') {sr$t.focus(); return } |
|||
if (sr$re.checked) { |
|||
var searchString = sr$s.value; |
|||
} else { |
|||
searchString=sr$s.value.replace(/([\[\]\{\}\|\.\*\?\(\)\$\^\\])/g,'\\$1'); |
|||
} |
|||
searchString="("+searchString+")(?![\\s\\S]*"+searchString+")"; |
|||
if (sr$mc.checked) |
|||
var re=new RegExp(searchString); |
|||
else |
|||
var re=new RegExp(searchString,"i"); |
|||
var res = re.exec (sr$t.value.substring(0,sr$t.selectionStart)); |
|||
if (!res) { |
|||
var res = re.exec (sr$t.value) |
|||
} |
|||
if (res) |
|||
{ |
|||
sr$t.selectionStart=res.index; |
|||
sr$t.selectionEnd=res.index+res[1].length; |
|||
} |
|||
else sr$t.selectionStart=sr$t.selectionEnd; |
|||
srSync(); |
|||
} |
|||
function srNext() |
|||
{ |
|||
if (sr$s.value=='') {sr$t.focus(); return } |
|||
if (sr$re.checked) { |
|||
var searchString = sr$s.value; |
|||
} else { |
|||
searchString=sr$s.value.replace(/([\[\]\{\}\|\.\*\?\(\)\$\^\\])/g,'\\$1'); |
|||
} |
|||
if (sr$mc.checked) |
|||
var re=new RegExp(searchString,"g"); |
|||
else |
|||
var re=new RegExp(searchString,"gi"); |
|||
re.lastIndex=sr$t.selectionEnd; |
|||
var res = re.exec (sr$t.value) |
|||
if (!res) { |
|||
re.lastIndex=0; |
|||
var res = re.exec (sr$t.value) |
|||
} |
|||
if (res) |
|||
{ |
|||
sr$t.selectionStart=res.index; |
|||
sr$t.selectionEnd=res.index+res[0].length; |
|||
} |
|||
else sr$t.selectionStart=sr$t.selectionEnd; |
|||
srSync(); |
|||
} |
|||
function srReplace() |
|||
{ |
|||
var sels=sr$t.selectionStart; |
|||
var sele=sr$t.selectionEnd; |
|||
var selr=sr$t.value.length-sele; |
|||
if (sr$s.value=='' || sels==sele) {sr$t.focus(); return } |
|||
if (sr$re.checked) { |
|||
var searchString = sr$s.value; |
|||
var replaceString = sr$r.value; |
|||
} else { |
|||
searchString=sr$s.value.replace(/([\[\]\{\}\|\.\*\?\(\)\$\^\\])/g,'\\$1'); |
|||
replaceString=sr$r.value.replace(/([\$\\])/g,'\\$1'); |
|||
} |
|||
if (sr$mc.checked) |
|||
var re=new RegExp(searchString,"g"); |
|||
else |
|||
var re=new RegExp(searchString,"gi"); |
|||
re.lastIndex=sels; |
|||
var res = re.exec (sr$t.value); |
|||
var $$=0; |
|||
if (res && res.index==sels && res[0].length==sele-sels) |
|||
{ |
|||
if (sr$re.checked) { |
|||
replaceString=replaceString.replace(/\\\\/g,'&backslash;'); |
|||
var replaceBits=(" "+replaceString).split(/(?=\$\d)/); |
|||
replaceString=replaceBits[0].substring(1); |
|||
for (var i=1; i<replaceBits.length; i++) |
|||
{ |
|||
$$=replaceBits[i][1]-'0'; |
|||
if ($$<res.length) |
|||
replaceString += res[$$] + replaceBits[i].substring(2) |
|||
else |
|||
replaceString += replaceBits[i]; |
|||
} |
|||
replaceString=replaceString.replace (/\\n/,"\n").replace (/&backslash;/g,"\\").replace |
|||
(/$/g,"\$") |
|||
} |
|||
sr$t.value= sr$t.value.substring(0,sels) + replaceString + sr$t.value.substring(sele); |
|||
} |
|||
sr$t.selectionStart=sels; |
|||
sr$t.selectionEnd=sr$t.value.length-selr; |
|||
srSync(); |
|||
} |
|||
function srReplaceall() |
|||
{ |
|||
if (!sr$s.value) {sr$t.focus(); return } |
|||
var sels=sr$t.selectionStart; |
|||
var sele=sr$t.selectionEnd; |
|||
var selr=sr$t.value.length-sele; |
|||
var reps; |
|||
if (sr$re.checked) { |
|||
var searchString = sr$s.value; |
|||
var replaceString = sr$r.value.replace(/\\\\/,'&backslash;').replace(/\\n/,'\n').replace(/&backslash;/,"\\"); |
|||
} else { |
|||
searchString=sr$s.value.replace(/([\[\]\{\}\|\.\*\?\(\)\$\^\\])/g,'\\$1'); |
|||
replaceString=sr$r.value.replace(/([\$\\])/g,'\\$1'); |
|||
} |
|||
if (sele>sels) |
|||
reps=sr$t.value.substring(sels,sele); |
|||
else |
|||
reps=sr$t.value; |
|||
if (sr$mc.checked) |
|||
var re=new RegExp(searchString,"g"); |
|||
else |
|||
var re=new RegExp(searchString,"gi"); |
|||
var replaceCounter=0; |
|||
var replaceFunc=function(){replaceCounter++;return replaceString}; |
|||
reps=reps.replace(re,replaceFunc); |
|||
if (sele>sels) |
|||
sr$t.value = sr$t.value.substring(0,sels) + reps + sr$t.value.substring(sele); |
|||
else |
|||
sr$t.value = reps; |
|||
sr$t.selectionStart=sels; |
|||
sr$t.selectionEnd=sele>sels ? sr$t.value.length-selr : sels; |
|||
window.status = replaceCounter+" ocurrences of " + searchString + " replaced."; |
|||
srSync(); |
|||
} |
|||
function srToggleCase() |
|||
{ |
|||
var sels=sr$t.selectionStart; |
|||
var sele=sr$t.selectionEnd; |
|||
var selr=sr$t.value.length-sele; |
|||
var selt=sr$t.value.substring(sels,sele); |
|||
if (sele>sels) |
|||
{ |
|||
if (selt==selt.toUpperCase()) |
|||
selt=selt.toLowerCase() |
|||
else if (selt==selt.toLowerCase() && sele-sels>1) |
|||
selt=selt.substring(0,1).toUpperCase()+selt.substring(1).toLowerCase() |
|||
else |
|||
selt=selt.toUpperCase(); |
|||
sr$t.value = sr$t.value.substring(0,sels) + selt + sr$t.value.substring(sele); |
|||
sr$t.selectionStart=sels; |
|||
sr$t.selectionEnd=sele>sels ? sr$t.value.length-selr : sels; |
|||
} |
|||
srSync(); |
|||
} |
|||
function srSync() |
|||
{ |
|||
var i; |
|||
var allLines=0; |
|||
var lineNo=0; |
|||
var w=sr$t.cols-5; |
|||
var dummy=sr$t.value.split("\n"); |
|||
for (i=0;i<dummy.length;i++){allLines+=Math.ceil(dummy[i].length/w)} |
|||
var dummy=sr$t.value.substring(0,sr$t.selectionStart).split("\n"); |
|||
for (i=0;i<dummy.length;i++){lineNo+=Math.ceil(dummy[i].length/w)} |
|||
// alert (w+" "+lineNo+"/"+allLines); |
|||
sr$t.scrollTop=sr$t.scrollHeight*(lineNo-10)/allLines; |
|||
sr$t.focus(); |
|||
} |
|||
function srInit() |
|||
{ |
|||
if($e('wpTextbox1')) { |
|||
var srBoxCode ='<div id="srForm"><table id="srBox" style="border-spacing: 2px;">' |
|||
+'<tr><td style="vertical-align: bottom"><span style="color:#000000; font-size: 80%;">Cerca:</span><br />' |
|||
+'<input type="text" id="srSearch" accesskey="F" tabindex="8"' |
|||
+'onkeypress="event.which == 13 && srNext()"; value=""/></td>' |
|||
+'<td style="vertical-align: bottom"><span style="color:#000000; font-size: 80%;">Sostituisci con:</span><br /><input type="text" id="srReplace" accesskey="G" tabindex="9"' |
|||
+'onkeypress="event.which == 13 && srNext()"; value=""/></td>' |
|||
+'<td style="vertical-align: top">' |
|||
+'<input type="checkbox" id="srCase" onclick="sr$t.focus()" tabindex="10"/><span style="color:#000000; font-size: 80%;">match case</span>' |
|||
+'<input type="checkbox" id="srRegexp" onclick="sr$t.focus()" tabindex="11"/><span style="color:#000000; font-size: 80%;">use regexp</span><br /> ' |
|||
+'<a href="javascript:srBack()" onmouseover="sr$t.focus()" title="Trova testo precedente [alt-2]" accesskey="2"><</a> ' |
|||
+'<a href="javascript:srNext()" onmouseover="sr$t.focus()" title="Trova testo successivo [alt-3]" accesskey="3">Trova ></a> ' |
|||
+'<a href="javascript:srReplace();srBack()" onmouseover="sr$t.focus()" title="Trova e sostituisce il testo precedente [alt-4]" accesskey="4"><</a> ' |
|||
+'<a href="javascript:srReplace()" onmouseover="sr$t.focus()" title="Trova e sostituisce il testo selezionato">Sostituisci</a> ' |
|||
+'<a href="javascript:srReplace();srNext()" onmouseover="sr$t.focus()" title="Trova e sostituisce il testo successivo [alt-5]" accesskey="5">></a> ' |
|||
+'<a href="javascript:srReplaceall()" onmouseover="sr$t.focus()" title="Sostituisci tutto [alt-7]" accesskey="7">Sostituisci tutto</a> ' |
|||
+'</td></tr></table></div>' |
|||
var ep=$e('searchInput'); |
|||
if (ep) ep.accessKey='none'; |
|||
sr$t=document.editform.wpTextbox1; |
|||
sr$w=sr$t.style.width; |
|||
var sr=document.createElement('div'); |
|||
sr.innerHTML=srBoxCode; |
|||
var im=document.createElement('span'); |
|||
im.innerHTML='<a id="SearchIcon" href="javascript:srShowHide()"><img style="cursor: pointer; border-width: 0; height: 22px; width: 23px;" title="Search/Replace" alt="Search/Replace" src="http://upload.wikimedia.org/wikipedia/en/1/12/Button_find.png"></a><a href="javascript:srToggleCase()"><img style="cursor: pointer; border-width: 0; height: 22px; width: 23px;" title="Toggle case" alt="Toggle case" src="http://upload.wikimedia.org/wikipedia/en/1/12/Button_case.png"></a>'; |
|||
var ep=$e('toolbar'); |
|||
if (ep) |
|||
{ |
|||
ep.appendChild(im) |
|||
} |
|||
else |
|||
{ |
|||
var ep=$e('editform'); |
|||
ep.parentNode.insertBefore(im,ep); |
|||
} |
|||
sr$i=$e('SearchIcon'); |
|||
sr$i.accessKey="F"; |
|||
sr.firstChild.style.display='none'; |
|||
var ep=$e('editform'); |
|||
ep.parentNode.insertBefore(sr,ep); |
|||
sr$f=$e('srForm'); |
|||
sr$s=$e('srSearch'); |
|||
sr$r=$e('srReplace'); |
|||
sr$re=$e('srRegexp'); |
|||
sr$mc=$e('srCase'); |
|||
} |
|||
} |
|||
function srShowHide() |
|||
{ |
|||
if (sr$f.style.display=='none') |
|||
{ |
|||
sr$f.style.display='block'; |
|||
sr$i.accessKey="none"; |
|||
sr$t.style.width='auto'; |
|||
sr$s.focus(); |
|||
} |
|||
else |
|||
{ |
|||
sr$f.style.display='none'; |
|||
sr$t.style.width=sr$w; |
|||
sr$i.accessKey="F"; |
|||
} |
|||
} |
|||
addOnloadHook(srInit); |
|||
// |
|||
// Category translation; |
|||
// ///////////////////// |
|||
var lang_category = 'Categoria:'; |
|||
// Menu translation; |
|||
// ///////////////// |
|||
var lang_menu = [ { |
|||
PAUSE: "Pausa", |
|||
PREVIEW: "Anteprima", |
|||
LISTS: "Liste", |
|||
LOWDIFF: "Diff ridotti", |
|||
RCLABEL: "Pannello", |
|||
RCSHOW: "RC", |
|||
LOGSHOW: "Log", |
|||
NOBOTS: "Niente Bot", |
|||
IPONLY: "Solo IP", |
|||
NAMESP: "Namespace", |
|||
XTIMES: "volte", |
|||
UNDORC: "Annulla", |
|||
CANCIMM: "Cancella subito", |
|||
CANCCV: "Cancella x copyviol", |
|||
REVERT: "Rollback", |
|||
REASON: "Motivazione", |
|||
REASON2: "Motivazione o URL", |
|||
AVERTS: "Avvisare", |
|||
VERIF: "Segna come verificata", |
|||
RVMES1: "[[Wikipedia:Monobook.js/LiveRC/Documentazione|LiveRC]] : Annullata la modifica di", |
|||
RVMES2: "ritorno alla versione di", |
|||
EMPTY: "Svuotata" |
|||
} ]; |
|||
// Comments test table (regexp format); |
|||
// //////////////////////////////////// |
|||
var commenttests = [ |
|||
{ state: BLANKING , regex: /^Pagina svuotata completamente/ }, |
|||
{ state: REPLACED , regex: /^Pagina sostituita con/ }, |
|||
{ state: REVERT , regex: /^LiveRC : Annullata la modifica|[Aa]nnullata la modifica|[Aa]nnullate le modifiche|[Aa]nnullata\]\] la modifica/ } |
|||
]; |
|||
// Categories test table (regexp format); |
|||
var categoriestests = [ |
|||
{ state: LOCK , regex: 'Pagine semiprotette' }, |
|||
{ state: FULLLOCK , regex: 'Pagine protette' }, |
|||
{ state: HOMONYMIE , regex: 'Disambigua' }, |
|||
{ state: ADQ , regex: 'Voci in vetrina' }, |
|||
{ state: COPYRIGHT , regex: 'Sospette violazioni di copyright' }, |
|||
{ state: PAS , regex: 'Avvisi di cancellazione' } |
|||
]; |
|||
// LiveRC default template use; |
|||
// //////////////////////////// |
|||
var lstAvert = [ |
|||
{ template: "Test" , string: "Test" , hasPage: true }, |
|||
{ template: "Vandalismo" , string: "Vandalismo" , hasPage: true }, |
|||
{ template: "IP Vandalismo" , string: "IP Vandalismo" , hasPage: false }, |
|||
{ template: "Avvisocopyviol" , string: "Violazione di copyright" , hasPage: true }, |
|||
{ template: "Avvisocopyviol|OTRS=no" , string: "Violazione di copyright (no OTRS)" , hasPage: true }, |
|||
{ template: "Spam" , string: "Spam" , hasPage: true }, |
|||
{ template: "Promozionale" , string: "Promozionale" , hasPage: true }, |
|||
{ template: "Senza senso" , string: "Senza senso" , hasPage: true }, |
|||
{ template: "Avvisoimmagine" , string: "Immagine senza informazioni" , hasPage: true }, |
|||
{ template: "Date personali" , string: "Date personali" , hasPage: true }, |
|||
{ template: "Benvenuto" , string: "Benvenuto" , hasPage: false }, |
|||
{ template: "Grazie" , string: "Grazie" , hasPage: true }, |
|||
{ template: "Oggetto" , string: "Oggetto" , hasPage: true }, |
|||
{ template: "Yc" , string: "Cartellino giallo" , hasPage: false }, |
|||
{ template: "WNB" , string: "WNB" , hasPage: true }, |
|||
{ template: "WND" , string: "WND" , hasPage: true }, |
|||
{ template: "WNF" , string: "WNF" , hasPage: true }, |
|||
{ template: "WNCV" , string: "WNCV" , hasPage: true }, |
|||
{ template: "WNRO" , string: "WNRO" , hasPage: true }, |
|||
{ template: "Turpiloquio" , string: "Turpiloquio" , hasPage: true }, |
|||
{ template: "Avvisoavvisi" , string: "Avvisoavvisi" , hasPage: true }, |
|||
{ template: "Loggati" , string: "Loggati" , hasPage: true }, |
|||
{ template: "InvitoNPOV" , string: "Invito NPOV" , hasPage: true }, |
|||
{ template: "Avviso sport futuro" , string: "Sport futuro" , hasPage: true }, |
|||
{ template: "Avvisosenzafonti" , string: "Senza fonti" , hasPage: true }, |
|||
{ template: "AvvisoCommento" , string: "Avviso Commento" , hasPage: true }, |
|||
{ template: "In italiano" , string: "In italiano" , hasPage: false }, |
|||
{ template: "Anteprima" , string: "Anteprima" , hasPage: false }, |
|||
{ template: "Attacco" , string: "Attacco" , hasPage: true }, |
|||
{ template: "ProposteCommenti" , string: "ProposteCommenti" , hasPage: true } |
|||
]; |
|||
function importScript(s) |
|||
{ |
|||
document.write('<script type="text/javascript" src="http://nonciclopedia.wikia.com/index.php?title=' + s + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); |
|||
} |
|||
==LiveWP== |
|||
*Documentation : [[:fr:User:EDUCA33E/LiveRC/Documentation]] |
|||
*Authors : [[:fr:User:EDUCA33E]], [[:fr:User:TiChou]] & [[:pl:User:Leafnode]] |
|||
*Version: 0.3.6 (beta) |
|||
Version modifiée basée sur la version du 1er avril 2007 a 00:49 : |
|||
http://fr.wikipedia.org/w/index.php?title=User:EDUCA33E/LiveRC.js&oldid=15525649 |
|||
=== Variables globales === |
|||
<source lang="javascript"> */ |
|||
if (wgTitle == "Genuzzo/LiveRC") { |
|||
// Appel des parametres par défaut de LiveRC ; |
|||
// /////////////////////////////////////////// |
|||
importScript(wgPageName+'/LiveRCparam.js'); |
|||
// Appel des parametres utilisateur ; |
|||
// /////////////////////////////////////////// |
|||
importScript('Utente:'+wgUserName+'/LiveRCparam.js'); |
|||
importStylesheetURI('http://pl.wikipedia.org/skins-1.5/common/diff.css'); |
|||
importScriptURI('http://pl.wikipedia.org/skins-1.5/common/diff.js'); |
|||
var lastrevid,lasttimestamp=1; // Timestamp d'initialisation; |
|||
// Découpage de l'URL et de ses parametres; |
|||
var _GET = new Array(); |
|||
var _uri = location.href; |
|||
var _temp_get_arr = _uri.substring(_uri.indexOf('?')+1, _uri.length).split("&"); |
|||
var _temp_get_arr_1 = new Array(); |
|||
for(_get_arr_i=0; _get_arr_i<_temp_get_arr.length; _get_arr_i++){ |
|||
_temp_get_arr_1 = _temp_get_arr[_get_arr_i].split("="); |
|||
_GET[decodeURIComponent(_temp_get_arr_1[0])] = decodeURIComponent(_temp_get_arr_1[1]); |
|||
} |
|||
delete _uri; delete _temp_get_arr; delete _temp_get_arr_1; |
|||
// Variables d'état (pour test sur rc.state); |
|||
var IP = 1; |
|||
var BOT = 2 << 0; |
|||
var SYSOP = 2 << 1; |
|||
var NEW = 2 << 2; |
|||
var MINOR = 2 << 3; |
|||
var NEWNS = 2 << 4; |
|||
var RENAMED = 2 << 5; |
|||
var PATROLLED = 2 << 6; |
|||
var REVERT = 2 << 7; |
|||
var BLANKING = 2 << 8; |
|||
var REPLACED = 2 << 9; |
|||
var REDIRECT = 2 << 10; |
|||
var CATEGORIZED = 2 << 11; |
|||
var LOCK = 2 << 12; |
|||
var FULLLOCK = 2 << 13; |
|||
var HOMONYMIE = 2 << 14; |
|||
var ADQ = 2 << 15; |
|||
var COPYRIGHT = 2 << 16; |
|||
var PAS = 2 << 17; |
|||
var UPLOAD = 2 << 18; |
|||
var NEWUSER = 2 << 19; |
|||
var BLOCK = 2 << 20; |
|||
var DELETE = 2 << 21; |
|||
var MOVE = 2 << 22; |
|||
var PROTECT = 2 << 23; |
|||
var RIGHTS = 2 << 24; |
|||
var DELETE_REVISION = 2 << 25; //RevDelete |
|||
var lstSysop = new Array(); // Sysop list; |
|||
var lstContact = new Array(); // Contact list; |
|||
var lstIPClass = new Array(); // IPClass list; |
|||
var lstRevoc = new Array(); // Reverted list; |
|||
var lstHidden = new Array(); // Hidden users list; |
|||
// Is user Sysop; |
|||
var lrcAdmin = false; // default value; |
|||
if(wgUserGroups.indexOf("sysop") != -1) |
|||
lrcAdmin = true; |
|||
// Watchlist; |
|||
var lstSuivi = new Array(); |
|||
var lstSuiviHH = new Array(); |
|||
var lstSuivirevid = new Array(); |
|||
var lstSuivioldid = new Array(); |
|||
var lstSuivircid = new Array(); |
|||
} |
|||
/* </source> |
|||
===Utilities=== |
|||
<source lang="javascript"> */ |
|||
var wpajax = { |
|||
http: function(bundle) { |
|||
// mandatory: bundle.url |
|||
// optional: bundle.async |
|||
// optional: bundle.method |
|||
// optional: bundle.headers |
|||
// optional: bundle.data |
|||
// optional: bundle.onSuccess (xmlhttprequest, bundle) |
|||
// optional: bundle.onFailure (xmlhttprequest, bundle) |
|||
// optional: bundle.otherStuff OK too, passed to onSuccess and onFailure |
|||
var xmlhttp; |
|||
try { |
|||
xmlhttp = new XMLHttpRequest(); |
|||
} catch(e) { |
|||
try { |
|||
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); |
|||
} catch (e) { |
|||
try { |
|||
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); |
|||
} catch (e) { |
|||
xmlhttp = false |
|||
} |
|||
} |
|||
} |
|||
if (xmlhttp) { |
|||
xmlhttp.onreadystatechange = function() { |
|||
if (xmlhttp.readyState == 4) |
|||
wpajax.httpComplete(xmlhttp,bundle); |
|||
}; |
|||
xmlhttp.open(bundle.method ? bundle.method : "GET",bundle.url,bundle.async == false ? false : true); |
|||
if (bundle.headers) { |
|||
for (var field in bundle.headers) |
|||
xmlhttp.setRequestHeader(field,bundle.headers[field]); |
|||
} |
|||
xmlhttp.send(bundle.data ? bundle.data : null); |
|||
} |
|||
return xmlhttp; |
|||
}, |
|||
httpComplete: function(xmlhttp,bundle) { |
|||
if (xmlhttp.status == 200 || xmlhttp.status == 302) { |
|||
if (bundle.onSuccess) { |
|||
bundle.onSuccess(xmlhttp,bundle); } |
|||
} else if (bundle.onFailure) { |
|||
bundle.onFailure(xmlhttp,bundle); |
|||
} else { |
|||
// A activer en debug mode ? |
|||
// alert(xmlhttp.statusText); |
|||
} |
|||
} |
|||
}; |
|||
function getElementWithId( elementId , elementTagName , elementParentNode ){ |
|||
if(!elementParentNode) elementParentNode = document; |
|||
if (elementParentNode.getElementById) return elementParentNode.getElementById(elementId); |
|||
var TheElement = false; |
|||
var Elements = elementParentNode.getElementsByTagName(elementTagName); |
|||
var elementcount = 0; |
|||
while(elementcount<Elements.length){ |
|||
var Id = Elements[elementcount].getAttribute('id'); |
|||
if(Id){ |
|||
if(Id==elementId){ |
|||
TheElement = Elements[elementcount]; |
|||
break; |
|||
} |
|||
} |
|||
elementcount++ |
|||
} |
|||
if (! TheElement) return null; |
|||
return TheElement; |
|||
} |
|||
function getPageContent(Req, ID){ |
|||
var OldTemp = document.getElementById("TempDiv"); |
|||
if(OldTemp) OldTemp.parentNode.removeChild(OldTemp); |
|||
var Temp = document.createElement('div'); |
|||
Temp.id = "TempDiv"; |
|||
Temp.style.display = "none"; |
|||
document.body.appendChild(Temp); |
|||
Temp.innerHTML = Req.responseText; |
|||
var bC; |
|||
if(ID){ |
|||
bC = getElementWithId(ID, '*', Temp); |
|||
}else{ |
|||
bC = getElementWithId('bodyContent', 'div', Temp); |
|||
if (bC == null) bC = getElementWithId('article', 'div', Temp); |
|||
if (bC == null) bC = getElementWithId('mw_contentholder', 'div', Temp); |
|||
} |
|||
return bC; |
|||
} |
|||
// HTMLize |
|||
String.prototype.htmlize = function() { |
|||
var chars = new Array('&','<','>','"'); |
|||
var entities = new Array('amp','lt','gt','quot'); |
|||
var regex = new RegExp(); |
|||
var string = this; |
|||
for (var i=0; i<chars.length; i++) { |
|||
regex = new RegExp(chars[i], "g"); |
|||
string = string.replace(regex, '&' + entities[i] + ';'); |
|||
} |
|||
return string; |
|||
} |
|||
/* </source> |
|||
=== LiveDiff === |
|||
<source lang="javascript"> */ |
|||
function liveDiff(page, id, oldid, rcid) { |
|||
var el = document.getElementById( 'livePreviewTitle' ); |
|||
el.innerHTML="<b style='text-decoration: blink;'>Diff : <span style='color:red'>"+page+"</span>...</b>"; |
|||
wpajax.http({ url: wgServer + wgScriptPath + '/index.php?title='+encodeURIComponent(page)+'&diffonly=1&diff='+id+'&oldid='+oldid, |
|||
onSuccess: getDiff, mpage: page, mid: id, moldid:oldid, mrcid:rcid}); |
|||
} |
|||
function getDiff(xmlreq, data) { |
|||
var page=data.mpage; |
|||
var oldid=data.moldid; |
|||
var id=data.mid; |
|||
var rcid=data.mrcid; |
|||
var bC = getPageContent(xmlreq); |
|||
var LP = document.getElementById( 'livePreview' ); |
|||
var dLP = document.getElementById( 'divLivePreview' ); |
|||
var lD = getElementsByClassName('diff',bC,null); |
|||
var upage=page.replace(new RegExp(/\'/g), "\\'"); |
|||
if (lD[0] == null) |
|||
LP.innerHTML = bC.innerHTML; |
|||
else { |
|||
if (document.getElementById('showDiffR').checked) { |
|||
var avantEl = getElementsByClassName('diff-deletedline',bC,null); |
|||
var apresEl = getElementsByClassName('diff-addedline',bC,null); |
|||
var avant = ""; |
|||
var apres = ""; |
|||
var lav = avantEl.length; |
|||
var lap = apresEl.length; |
|||
for(var n=0; n < lav ; n++) |
|||
avant = avant + avantEl[n].innerHTML + "<br />"; |
|||
for(var n=0; n < lap ; n++) |
|||
apres = apres + apresEl[n].innerHTML + "<br />"; |
|||
LP.innerHTML = "<table width='100%'><tr><td width='50%' class='diff-deletedline'>"+avant+"</td><td class='diff-addedline'>"+apres+"</td></tr></table>"; |
|||
} |
|||
else { |
|||
LP.innerHTML = "<table border='0' width='98%' cellpadding='0' cellspacing='4' class='diff'>"+lD[0].innerHTML+"</table>"; |
|||
} |
|||
} |
|||
if (dLP.style.display == "none") { |
|||
var elcb = document.getElementById( 'shidPrev' ); |
|||
elcb.checked="true"; |
|||
dLP.style.display = "inline"; |
|||
} |
|||
var entete = document.getElementById( 'livePreviewTitle' ); |
|||
entete.innerHTML='<b><a href="'+wgServer + '/wiki/' + escape(page) + '" target="_new">' + page + '</a></b> • ' + |
|||
'(<a href="javascript:;" onClick="liveHist(\''+upage+'\');" style="color:darkorange">Cron</a>)'; |
|||
var asNextDiff = getElementWithId( "differences-nextlink" , "*" , bC ); |
|||
if(asNextDiff == null) { |
|||
var optAvert = ""; |
|||
var optl = lstAvert.length; |
|||
for (j=0; j<optl; j++) { |
|||
optAvert += '<option value="'+lstAvert[j].template; |
|||
if (lstAvert[j].template == "Loggati") |
|||
{ |
|||
if(lstAvert[j].hasPage) optAvert += '|'+upage.substr(7); |
|||
} |
|||
else |
|||
{ |
|||
if(lstAvert[j].hasPage) optAvert += '|'+upage; |
|||
} |
|||
optAvert += '">'+lstAvert[j].string+'</option>'; |
|||
} |
|||
// Get username of submitter |
|||
var user1 = getElementWithId( 'mw-diff-otitle2' , "*" , bC ); |
|||
if (user1 != null) { |
|||
var usertmp=user1.innerHTML; |
|||
var daDove = usertmp.indexOf('tente:')+6; |
|||
var daDove2 = usertmp.indexOf('/wiki/Speciale:Contributi/')+26; |
|||
if ((daDove2 != -1) && (daDove2 < daDove)) // e' un anonimo |
|||
daDove3 = daDove2; |
|||
else |
|||
daDove3 = daDove; |
|||
var finoA = usertmp.indexOf('" title="'); |
|||
var finoA2 = usertmp.indexOf('&action=edit'); |
|||
if ((finoA2 != -1) && (finoA2 < finoA)) // non esiste la pagina utente |
|||
finoA3 = finoA2; |
|||
else |
|||
finoA3 = finoA; |
|||
user1 = usertmp.substr(daDove3, finoA3-daDove3); |
|||
} |
|||
var user2 = getElementWithId( 'mw-diff-ntitle2' , "*" , bC ); |
|||
if (user2 != null) { |
|||
var usertmp=user2.innerHTML; |
|||
var daDove = usertmp.indexOf('tente:')+6; |
|||
var daDove2 = usertmp.indexOf('/wiki/Speciale:Contributi/')+26; |
|||
if ((daDove2 != -1) && (daDove2 < daDove)) // e' un anonimo |
|||
daDove3 = daDove2; |
|||
else |
|||
daDove3 = daDove; |
|||
var finoA = usertmp.indexOf('" title="'); |
|||
var finoA2 = usertmp.indexOf('&action=edit'); |
|||
if ((finoA2 != -1) && (finoA2 < finoA)) // non esiste la pagina utente |
|||
finoA3 = finoA2; |
|||
else |
|||
finoA3 = finoA; |
|||
user2 = usertmp.substr(daDove3, finoA3-daDove3); |
|||
} |
|||
user1=user1.replace(new RegExp(/\'/g), "\\'"); |
|||
user2=user2.replace(new RegExp(/\'/g), "\\'"); |
|||
} |
|||
} |
|||
/* |
|||
function liveRollback(page, user) { |
|||
var div = document.createElement('div'); |
|||
document.getElementById('divTabRC').getElementsByTagName('div')[0].appendChild(div); |
|||
div.innerHTML = 'Rollback della pagina ' + page + ' iniziato... '; |
|||
wpajax.http({ url: wgServer + wgScriptPath + '/api.php?action=query&format=xml&prop=revisions&titles=' + page + '&rvtoken=rollback', |
|||
onSuccess: liveRollbackPost, rollbackDiv: div, pageToRollback: page, userToRollback: user}); |
|||
} |
|||
function liveRollbackPost(xmlreq, data) { |
|||
data.rollbackDiv.innerHTML += 'Ho il token e il nome utente, effettuo il rollback...'; |
|||
var div = data.rollbackDiv; |
|||
token = xmlreq.responseXML.documentElement.getElementsByTagName('rev')[0].getAttribute("rollbacktoken").replace('+', '%2B'); |
|||
wpajax.http({ url: wgServer + wgScriptPath + '/api.php', |
|||
onSuccess: liveRollbackEnd, rollbackDiv: div, method: 'POST', data: 'action=rollback&format=xml&title=' + encodeURIComponent(data.pageToRollback) + '&user=' + encodeURIComponent(data.userToRollback) + '&token=' + token}); |
|||
} |
|||
function liveRollbackEnd(xmlreq, data) { |
|||
data.rollbackDiv.parentNode.removeChild(data.rollbackDiv); |
|||
} */ |
|||
/* </source> |
|||
=== LiveHist === |
|||
<source lang="javascript"> */ |
|||
function liveHist(page) { |
|||
// uso delle " (soluzione di merda, ma se funziona...) |
|||
var page = page.replace(new RegExp(/\%22/g), '"'); |
|||
var el = document.getElementById( 'livePreviewTitle' ); |
|||
el.innerHTML="<b style='text-decoration: blink;'>Cron : <span style='color:red'>"+page+"</span>...</b>"; |
|||
wpajax.http({url:wgServer + wgScriptPath + '/index.php?title=' + encodeURIComponent(page) + '&action=history', onSuccess: getHist, message: page }); |
|||
} |
|||
function getHist(xmlreq, data) { |
|||
var bC = getPageContent(xmlreq); |
|||
var c=data.message; |
|||
var LP = document.getElementById( 'livePreview' ); |
|||
var dLP = document.getElementById( 'divLivePreview' ); |
|||
LP.innerHTML = bC.innerHTML; |
|||
if (dLP.style.display == "none") { |
|||
var elcb = document.getElementById( 'shidPrev' ); |
|||
elcb.checked="true"; |
|||
dLP.style.display = "inline"; |
|||
} |
|||
var elt = document.getElementById( 'livePreviewTitle' ); |
|||
elt.innerHTML='<b><a href="'+wgServer+'/wiki/'+encodeURIComponent(c)+'" target="_new">'+c+'</a></b>'; |
|||
} |
|||
/* </source> |
|||
=== LiveArticle === |
|||
<source lang="javascript"> */ |
|||
function liveArticle(page,user) { |
|||
// uso delle " (soluzione di merda, ma se funziona...) |
|||
var page = page.replace(new RegExp(/\%22/g), '"'); |
|||
var el = document.getElementById( 'livePreviewTitle' ); |
|||
el.innerHTML="<b style='text-decoration: blink;'><span style='color:red'>"+page+"</span>...</b>"; |
|||
wpajax.http({url:wgServer + wgScriptPath + '/index.php?title=' + encodeURIComponent(page) + '&redirect=no', onSuccess: getArticle, message: page, user: user }); |
|||
} |
|||
function getArticle(xmlreq, data) { |
|||
var bC = getPageContent(xmlreq); |
|||
var c=data.message; |
|||
var user=data.user; |
|||
var LP = document.getElementById( 'livePreview' ); |
|||
var dLP = document.getElementById( 'divLivePreview' ); |
|||
LP.innerHTML = bC.innerHTML; |
|||
if (dLP.style.display == "none") { |
|||
var elcb = document.getElementById( 'shidPrev' ); |
|||
elcb.checked="true"; |
|||
dLP.style.display = "inline"; |
|||
} |
|||
var upage=c.replace(new RegExp(/\'/g), "\\'"); |
|||
var optAvert = ""; |
|||
var optl = lstAvert.length; |
|||
for (j=0; j<optl; j++) { |
|||
optAvert += '<option value="'+lstAvert[j].template; |
|||
if(lstAvert[j].hasPage) optAvert += '|'+upage; |
|||
optAvert += '">'+lstAvert[j].string+'</option>'; |
|||
} |
|||
var elt = document.getElementById( 'livePreviewTitle' ); |
|||
elt.innerHTML='<b><a href="'+wgServer+'/wiki/'+encodeURI(c)+'" target="_new">'+c+'</a></b>'; |
|||
} |
|||
/* </source> |
|||
=== LiveLog === |
|||
<source lang="javascript"> */ |
|||
function liveLog(action,page) { |
|||
var titolo = ''; |
|||
switch(action) { |
|||
case 'upload': |
|||
titolo = 'Log dei caricamenti'; |
|||
break; |
|||
case 'newuser': |
|||
titolo = 'Log dei nuovi utenti'; |
|||
break; |
|||
case 'block': |
|||
titolo = 'Log dei blocchi utente'; |
|||
break; |
|||
case 'delete': |
|||
titolo = 'Log delle cancellazioni'; |
|||
break; |
|||
case 'move': |
|||
titolo = 'Log degli spostamenti'; |
|||
break; |
|||
case 'protect': |
|||
titolo = 'Log delle protezioni'; |
|||
break; |
|||
case 'rights': |
|||
titolo = 'Log dei cambi di permessi'; |
|||
break; |
|||
case '': |
|||
titolo = 'Log'; |
|||
break; |
|||
default: |
|||
break; |
|||
} |
|||
var el = document.getElementById( 'livePreviewTitle' ); |
|||
el.innerHTML="<b style='text-decoration: blink;'><span style='color:red'>"+titolo+"</span>...</b>"; |
|||
wpajax.http({url:wgServer + wgScriptPath + '/index.php?title=Speciale:Registri&type=' + action + "&user=&page=" + encodeURIComponent(page), onSuccess: getLog, message: page }); |
|||
} |
|||
function getLog(xmlreq, data) { |
|||
var bC = getPageContent(xmlreq); |
|||
var c=data.message; |
|||
var LP = document.getElementById( 'livePreview' ); |
|||
var dLP = document.getElementById( 'divLivePreview' ); |
|||
LP.innerHTML = bC.innerHTML; |
|||
if (dLP.style.display == "none") { |
|||
var elcb = document.getElementById( 'shidPrev' ); |
|||
elcb.checked="true"; |
|||
dLP.style.display = "inline"; |
|||
} |
|||
var elt = document.getElementById( 'livePreviewTitle' ); |
|||
elt.innerHTML='<b><a href="'+wgServer+'/wiki/'+encodeURI(c)+'" target="_new">'+c+'</a></b>'; |
|||
} |
|||
/* </source> |
|||
=== LiveContrib === |
|||
<source lang="javascript"> */ |
|||
function liveContrib(user) { |
|||
var el = document.getElementById( 'livePreviewTitle' ); |
|||
el.innerHTML="<b style='text-decoration: blink;'><span style='color:red'>"+user+"</span>...</b>"; |
|||
wpajax.http({url:wgServer + '/wiki/Speciale:Contributi/'+encodeURIComponent(user), |
|||
onSuccess: getContrib, message: user }); |
|||
} |
|||
function getContrib(xmlreq, data) { |
|||
var bC = getPageContent(xmlreq); |
|||
var user=data.message; |
|||
var LP = document.getElementById( 'livePreview' ); |
|||
var dLP = document.getElementById( 'divLivePreview' ); |
|||
LP.innerHTML = bC.innerHTML; |
|||
if (dLP.style.display == "none") { |
|||
var elcb = document.getElementById( 'shidPrev' ); |
|||
elcb.checked="true"; |
|||
dLP.style.display = "inline"; |
|||
} |
|||
var utilde=user.replace(new RegExp(/\'/g), "\\'"); |
|||
var optAvert = ""; |
|||
var optl = lstAvert.length; |
|||
for (j=0; j<optl; j++) { |
|||
if(lstAvert[j].hasPage) continue; |
|||
optAvert += '<option value="'+lstAvert[j].template+'">'+lstAvert[j].string+'</option>'; |
|||
} |
|||
var entete = document.getElementById( 'livePreviewTitle' ); |
|||
entete.innerHTML='<b><a href="'+wgServer+'/wiki/User:'+encodeURIComponent(user)+'" target="_new">'+user+'</a></b>'; |
|||
entete.innerHTML = '<table width="100%" class="creator"><tr><td>'+entete.innerHTML + |
|||
'</td><td align="right"><small>' + |
|||
'[<a id="LiveAvertoLink" href="javascript:var message=getLiveAverto(\''+utilde+'\');">'+'AVERTS'+'</a>] : ' + |
|||
'<select id="averto">' + optAvert + '</select>' + '</td></tr></table>'; |
|||
} |
|||
/* </source> |
|||
=== LiveSysop === |
|||
<source lang="javascript"> */ |
|||
function liveSysop(){ |
|||
jQuery.getJSON( |
|||
wgScriptPath + '/api.php?callback=?', |
|||
{ action: 'query', |
|||
list: 'allusers', |
|||
augroup: 'sysop', |
|||
aulimit: '500', |
|||
format: 'json' |
|||
}, |
|||
function( obj ) { |
|||
jQuery.each(obj.query.allusers, function(k, val){ |
|||
lstSysop.push(val.name); |
|||
}); |
|||
liveNS(); |
|||
} |
|||
); |
|||
} |
|||
function liveWatch() { |
|||
liveRC(); |
|||
} |
|||
function liveNS() { |
|||
wpajax.http({url: wgServer + wgScriptPath + '/api.php?action=query&meta=siteinfo&siprop=namespaces&format=xml', |
|||
onSuccess: getNS, message: "Pobieranie nazw przestrzeni" }); |
|||
} |
|||
function getNS(xmlreq, data) { |
|||
var api = xmlreq.responseXML; |
|||
if (api.firstChild.nodeName == "error") return; |
|||
var nss = api.getElementsByTagName('query')[0].getElementsByTagName('namespaces')[0].getElementsByTagName('ns'); |
|||
var len = nss.length; |
|||
var i; |
|||
var id,ns; |
|||
var options = ""; |
|||
var lstNs = new Array(); |
|||
for (i=0; i<len; i++) { |
|||
id = nss[i].getAttribute('id'); |
|||
ns = nss[i].textContent; |
|||
if (id < 0) continue; |
|||
//Ex "Article" |
|||
if (id == 0) ns = "(Principale)"; |
|||
//Select namespace (default = *) |
|||
if (typeof(checkNamespace)!="undefined" && checkNamespace == id) |
|||
options += '<option value="' + id + '" SELECTED >' + ns + '</option>'; |
|||
else |
|||
options += '<option value="' + id + '">' + ns + '</option>'; |
|||
lstNs.push(id); |
|||
} |
|||
options = '<option value="' + lstNs.join('|') + '">*</option>' + options; |
|||
document.getElementById('selectNS').innerHTML = '<label for="showNS0">'+'NAMESP'+' </label><select id="showNS0">' + options + '</select>'; |
|||
liveWatch(); |
|||
} |
|||
/* </source> |
|||
=== LiveRC === |
|||
<source lang="javascript"> */ |
|||
function supprLigne(quelLigne) { |
|||
var i,len; |
|||
var tab = document.getElementById('tabRC'); |
|||
var els = new Array(); |
|||
if (quelLigne == '*') |
|||
els = tab.getElementsByTagName('tr'); |
|||
else if (quelLigne == 'd') { |
|||
var _els = tab.getElementsByTagName('tr'); |
|||
len = _els.length; |
|||
for (i=len-1; i>=0; i--) |
|||
if (_els[i].firstChild.style.backgroundColor == 'rgb(255, 250, 205)') |
|||
els.push(_els[i]); |
|||
} else if (quelLigne == 'r') { |
|||
var _els = tab.getElementsByTagName('tr'); |
|||
len = _els.length; |
|||
for (i=len-1; i>=0; i--) |
|||
if (_els[i].firstChild.style.backgroundColor == 'rgb(255, 228, 225)') |
|||
els.push(_els[i]); |
|||
} else if (quelLigne == 'n') { |
|||
var _els = tab.getElementsByTagName('tr'); |
|||
len = _els.length; |
|||
for (i=len-1; i>=0; i--) |
|||
if (_els[i].firstChild.style.backgroundColor == 'rgb(226, 242, 210)') |
|||
els.push(_els[i]); |
|||
} else |
|||
els.push(document.getElementById(quelLigne)); |
|||
len = els.length; |
|||
for (i=len-1; i>=0; i--) |
|||
if (els[i] != null) |
|||
tab.removeChild(els[i]); |
|||
} |
|||
function changeLigne(quelLigne) { |
|||
var el = document.getElementById(quelLigne); |
|||
var els1 = el.getElementsByTagName('th'); |
|||
var els2 = el.getElementsByTagName('td'); |
|||
var len = els1.length; |
|||
for (var i=len-1; i>=0; i--) |
|||
if (els1[i] != null) |
|||
els1[i].style.backgroundColor = "#FFFACD"; |
|||
var len = els2.length; |
|||
for (var i=len-1; i>=0; i--) |
|||
if (els2[i] != null) |
|||
els2[i].style.backgroundColor = "#FFFFE0"; |
|||
} |
|||
function getElementsByClassName(searchClass,node,tag) { |
|||
var classElements = new Array(); |
|||
node = document; |
|||
if ( tag == null ) |
|||
tag = '*'; |
|||
try { |
|||
var els = node.getElementsByTagName(tag); |
|||
} |
|||
catch(err) { |
|||
return classElements; |
|||
} |
|||
var elsLen = els.length; |
|||
var pattern = new RegExp('(^|\\s)'+searchClass+'(\\s|$)'); |
|||
for (i = 0, j = 0; i < elsLen; i++) { |
|||
if (pattern.test(els[i].className) ) { |
|||
classElements[j] = els[i]; |
|||
j++; |
|||
} |
|||
} |
|||
return classElements; |
|||
} |
|||
function tsToHhMm(timestamp) { |
|||
var tz; |
|||
var match, regex = new RegExp(); |
|||
if (lrcTZ) { |
|||
regex = /^([-+])?(\d?\d):?(\d\d)$/; |
|||
match = regex.exec(lrcTZ); |
|||
if (!match) { |
|||
//livercError(lang_error.TZ); |
|||
return 'xx:xx'; |
|||
} |
|||
tz = match[2]*60 + match[3]*1; |
|||
tz = match[1] == '-' ? -tz : tz; |
|||
} else { |
|||
var now = new Date(); |
|||
tz = -now.getTimezoneOffset(); |
|||
} |
|||
regex = /^\d\d\d\d-\d\d-\d\dT(\d\d):(\d\d):\d\dZ$/; |
|||
match = regex.exec(timestamp); |
|||
if (!match) { |
|||
//livercError(lang_error.timestamp); |
|||
return 'xx:xx'; |
|||
} |
|||
var tt = (match[1]*60 + match[2]*1 + tz + 1440) % 1440; |
|||
var mm = tt % 60; |
|||
var hh = (tt - mm) / 60 % 24; |
|||
return hh + ':' + (mm < 10 ? '0' : '') + mm; |
|||
} |
|||
function updateHidden() { |
|||
var tempAr = new Array(); |
|||
for (var user in lstHidden) { |
|||
var utilde = user.replace(new RegExp(/\'/g), "\\'"); |
|||
var uremove = '<a href="javascript:;" onClick="unhideUser(\''+utilde+'\');" style="color:grey">-</a>'; |
|||
var udiscut = '<a href="'+wgServer+'/wiki/Discussioni utente:'+encodeURIComponent(user)+'" style="color:seagreen" target="_new">D</a>'; |
|||
var ucontrib = '<a href="javascript:;" onClick="liveContrib(\''+utilde+'\');" style="color:#43CD80">C</a>'; |
|||
var uadmin = ''; |
|||
if (lrcAdmin == true) { |
|||
uadmin = ' • <a href="'+wgServer+'/wiki/Speciale:Blocca/'+encodeURI(user)+'" target="_new" style="color:seagreen">B</a>'; |
|||
} |
|||
var ueditor = '<a href="'+wgServer+'/wiki/Utente:'+encodeURIComponent(user)+'" target="_new">'+user+'</a>'; |
|||
var ligne = '<span id="hidden-' + user + '"><small>' + uremove + ' • ' + udiscut + ' • ' + ucontrib + uadmin + ' • </small>' + ueditor + '</span><br />'; |
|||
tempAr.push(ligne); |
|||
} |
|||
tempAr.sort(); |
|||
var lvHidden = document.getElementById('liveHidden'); |
|||
lvHidden.innerHTML = ""; |
|||
var len = tempAr.length; |
|||
for (var n=len-1; n>=0; n--) |
|||
lvHidden.innerHTML += tempAr[n]; |
|||
} |
|||
function updateFollowContact() { |
|||
var tempAr = new Array(); |
|||
for (var user in lstContact) { |
|||
var timestamp = lstContact[user].ts; |
|||
if (timestamp == 0) continue; |
|||
var utilde = user.replace(new RegExp(/\'/g), "\\'"); |
|||
var udiscut = '<a href="'+wgServer+'/wiki/Discussioni utente:'+encodeURIComponent(user)+'" style="color:seagreen" target="_new">D</a>'; |
|||
var ucontrib = '<a href="javascript:;" onClick="liveContrib(\''+utilde+'\');" style="color:#43CD80">C</a>'; |
|||
var uadmin = ''; |
|||
if (lrcAdmin == true) { |
|||
uadmin = ' • <a href="'+wgServer+'/wiki/Speciale:Blocca/'+encodeURI(user)+'" target="_new" style="color:seagreen">B</a>'; |
|||
} |
|||
var ueditor = '<a href="'+wgServer+'/wiki/Utente:'+encodeURIComponent(user)+'" target="_new">'+user+'</a>'; |
|||
var ligne = '<span id="contact-' + timestamp + '"><small>' + tsToHhMm(timestamp) + ' • ' + udiscut + ' • ' + ucontrib + uadmin + ' • </small>' + ueditor + '</span><br />'; |
|||
tempAr.push(ligne); |
|||
} |
|||
tempAr.sort(); |
|||
var lvContact = document.getElementById('liveContact'); |
|||
lvContact.innerHTML = ""; |
|||
var len = tempAr.length; |
|||
for (var n=len-1; n>=0; n--) |
|||
lvContact.innerHTML += tempAr[n]; |
|||
} |
|||
function updateFollowRevoc() { |
|||
var tempAr = new Array(); |
|||
for (var user in lstRevoc) { |
|||
var timestamp = lstRevoc[user].ts; |
|||
var utilde = user.replace(new RegExp(/\'/g), "\\'"); |
|||
var udiscut = '<a href="'+wgServer+'/wiki/Discussioni utente:'+encodeURIComponent(user)+'" style="color:seagreen" target="_new">D</a>'; |
|||
var ucontrib = '<a href="javascript:;" onClick="liveContrib(\''+utilde+'\');" style="color:#43CD80">C</a>'; |
|||
var uadmin = ''; |
|||
if (lrcAdmin == true) { |
|||
uadmin = ' • <a href="'+wgServer+'/wiki/Speciale:Blocca/'+encodeURI(user)+'" target="_new" style="color:seagreen">B</a>'; |
|||
} |
|||
var ueditor = '<a href="'+wgServer+'/wiki/Utente:'+encodeURIComponent(user)+'" target="_new">'+user+'</a>'; |
|||
var ligne = '<span id="revoc-' + timestamp + '"><small>' + tsToHhMm(timestamp) + ' • ' + udiscut + ' • ' + ucontrib + uadmin + ' • </small>' + ueditor + ' (' + lstRevoc[user].nb + ' '+'XTIMES'+')</span><br />'; |
|||
tempAr.push(ligne); |
|||
} |
|||
tempAr.sort(); |
|||
var lvRevoc = document.getElementById('liveRevoc'); |
|||
lvRevoc.innerHTML = ""; |
|||
var len = tempAr.length; |
|||
for (var n=len-1; n>=0; n--) |
|||
lvRevoc.innerHTML += tempAr[n]; |
|||
} |
|||
//function getRevision(xmlreq, data) { |
|||
function getRevision(rc) { |
|||
if (document.getElementById('stopLive').checked) return; |
|||
// var api = xmlreq.responseXML.getElementsByTagName('api')[0]; |
|||
// |
|||
// if (api.firstChild.nodeName == "error") return; |
|||
var match, regex = new RegExp(), regex2 = new RegExp(); |
|||
// var rc = data.rc |
|||
var title = rc.title; |
|||
var pageid = rc.pageid; |
|||
var revid = rc.revid; |
|||
var oldid = rc.old_revid; |
|||
var rcid = rc.rcid; |
|||
var user = rc.user; |
|||
var comment = (rc.comment ? rc.comment : ""); |
|||
var timestamp = rc.timestamp; |
|||
var ns = rc.ns; |
|||
var state = rc.state; |
|||
// ONLY LOG |
|||
var type = rc.type; |
|||
var new_title = rc.new_title; |
|||
var duration = duration; |
|||
regex = /\'/g; |
|||
regex2 = /\"/g; |
|||
var escTitle = title.replace(regex, "\\'"); |
|||
var diffEscTitle = escTitle.replace(regex2, '\%22'); |
|||
var escUser = user.replace(regex, "\\'"); |
|||
// var revisions = api.getElementsByTagName('query')[0].getElementsByTagName('pages')[0].getElementsByTagName('page')[0].getElementsByTagName('revisions')[0].getElementsByTagName('rev'); |
|||
// |
|||
// var oldsize = (state & NEW ? 0 : revisions[1].textContent.length); |
|||
// var newsize = revisions[0].textContent.length |
|||
var oldsize = rc.oldlen |
|||
var newsize = rc.newlen |
|||
var sizediff = newsize - oldsize; |
|||
// INITIALISATION LIGNE RC // |
|||
var tr1 = document.createElement('tr'); |
|||
var th0 = document.createElement('th'); |
|||
var th1 = document.createElement('th'); |
|||
var td2 = document.createElement('td'); |
|||
var td3 = document.createElement('td'); |
|||
var td4 = document.createElement('td'); |
|||
// SUPPR. LIGNE // |
|||
th0.innerHTML = '<a href="javascript:;" onClick="supprLigne(\''+pageid+'_'+revid+'\');" style="color:red">X</a>'; |
|||
// ARTICLE // |
|||
var arti = "", artiStyle = ""; |
|||
var preArti = "", postArti = ""; |
|||
var diff = ""; |
|||
var diffClose = ""; |
|||
if (lrcAutoCloseDiff == 1) |
|||
diffClose='supprLigne(\''+pageid+'_'+revid+'\');'; |
|||
if (state & NEW) |
|||
diff = '<a href="javascript:;" onClick="changeLigne(\''+pageid+'_'+revid+'\');liveArticle(\''+diffEscTitle+'\',\''+user+'\');'+diffClose+'" style="color:green">New</a>'; |
|||
else if (state & UPLOAD) |
|||
diff = '<a href="javascript:;" onClick="changeLigne(\''+pageid+'_'+revid+'\');liveLog(\'upload\',\''+escTitle+'\');'+diffClose+'" style="color:darkslateblue">Log</a>'; |
|||
else if (state & NEWUSER) |
|||
diff = '<a href="javascript:;" onClick="changeLigne(\''+pageid+'_'+revid+'\');liveLog(\'newusers\',\''+escTitle+'\');'+diffClose+'" style="color:lime">Log</a>'; |
|||
else if (state & BLOCK) |
|||
diff = '<a href="javascript:;" onClick="changeLigne(\''+pageid+'_'+revid+'\');liveLog(\'block\',\''+escTitle+'\');'+diffClose+'" style="color:darkgoldenrod">Log</a>'; |
|||
else if (state & RIGHTS) |
|||
diff = '<a href="javascript:;" onClick="changeLigne(\''+pageid+'_'+revid+'\');liveLog(\'block\',\''+escTitle+'\');'+diffClose+'" style="color:darkgoldenrod">Log</a>'; |
|||
else if (state & DELETE) |
|||
diff = '<a href="javascript:;" onClick="changeLigne(\''+pageid+'_'+revid+'\');liveLog(\'delete\',\''+escTitle+'\');'+diffClose+'" style="color: saddlebrown">Log</a>'; |
|||
else if (state & DELETE_REVISION) |
|||
diff = '<a href="javascript:;" onClick="changeLigne(\''+pageid+'_'+revid+'\');liveLog(\'delete\',\''+escTitle+'\');'+diffClose+'" style="color: chocolate">Log</a>'; |
|||
else if (state & MOVE) |
|||
diff = '<a href="javascript:;" onClick="changeLigne(\''+pageid+'_'+revid+'\');liveLog(\'move\',\''+escTitle+'\');'+diffClose+'" style="color:black">Log</a>'; |
|||
else if (state & PROTECT) |
|||
diff = '<a href="javascript:;" onClick="changeLigne(\''+pageid+'_'+revid+'\');liveLog(\'protect\',\''+escTitle+'\');'+diffClose+'" style="color: darkslategray">Log</a>'; |
|||
else // simple edit |
|||
diff = '<a href="javascript:;" onClick="changeLigne(\''+pageid+'_'+revid+'\');liveDiff(\''+diffEscTitle+'\','+revid+','+oldid+','+rcid+');'+diffClose+'" style="color:orange">Diff</a>'; |
|||
var hist = ''; |
|||
var livelogs = ''; |
|||
var edit = ''; |
|||
var admin = ''; |
|||
// Don't show link for log rows |
|||
if (!(state & UPLOAD) && |
|||
!(state & NEWUSER) && |
|||
!(state & BLOCK) && |
|||
!(state & RIGHTS) && |
|||
!(state & DELETE) && |
|||
!(state & DELETE_REVISION) && |
|||
!(state & PROTECT) && |
|||
!(state & MOVE)) |
|||
{ |
|||
hist = '<a href="javascript:;" onClick="liveHist(\''+diffEscTitle+'\');" style="color:darkorange">C</a>'; |
|||
edit = '<a href="' + wgServer + wgScriptPath + '/index.php?title='+encodeURIComponent(title)+'&action=edit" target="_new" style="color:tomato">M</a>'; |
|||
livelogs = '<a href="javascript:;" onClick="liveLog(\'\',\''+escTitle+'\');" style="color:hotpink">L</a>'; |
|||
if (lrcAdmin == true) { |
|||
admin = ' • <a href="' + wgServer + wgScriptPath + '/index.php?title='+encodeURIComponent(title)+'&action=delete" target="_new" style="color:orangered">S</a>'; |
|||
admin += ' • <a href="' + wgServer + wgScriptPath + '/index.php?title='+encodeURIComponent(title)+'&action=protect" target="_new" style="color: coral">P</a>'; |
|||
} |
|||
} |
|||
// Disambig / Homonymie ? ; |
|||
/////////////////////////// |
|||
if (ns == 0 && state & HOMONYMIE) { |
|||
artiStyle = 'color: darkorange; font-weight: bold; font-style: italic;'; |
|||
preArti += '<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/7/72/Disambig.svg/16px-Disambig.svg.png" width="16px" alt="Disambigua" title="Disambigua" /> ' |
|||
} |
|||
// Page protégée ? ; |
|||
//////////////////// |
|||
if (state & FULLLOCK) |
|||
preArti += '<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/4/48/Padlock-red.svg/16px-Padlock-red.svg.png" width="16px" alt="Voce protetta" title="Voce protetta"/> '; |
|||
if (state & LOCK) |
|||
preArti += '<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/e/e0/Padlock-gold.svg/16px-Padlock-gold.svg.png" width="16px" alt="Voce semiprotetta" title="Voce semiprotetta"/> '; |
|||
// Copyright ? ; |
|||
////////// |
|||
if (state & COPYRIGHT) |
|||
preArti += '<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b0/Copyright.svg/16px-Copyright.svg.png" width="16px" alt="Copyright" title="Copyright" /> '; |
|||
// PaS ? ; |
|||
////////////////// |
|||
if (state & PAS) |
|||
preArti += '<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Cestino_pieno_architetto_01.svg/11px-Cestino_pieno_architetto_01.svg.png" height="11px" alt="Voci da cancellare" title="Voci da cancellare" /> '; |
|||
// Adq ? ; |
|||
////////// |
|||
if (state & ADQ) |
|||
postArti += '<sup><img src="http://upload.wikimedia.org/wikipedia/commons/thumb/c/c7/Fairytale_bookmark_gold.png/10px-Fairytale_bookmark_gold.png" width="10px" alt="Voci in vetrina" title="Voci in vetrina" /></sup>'; |
|||
// Article catégorisé ? ; |
|||
///////////////////////// |
|||
var isCategorized = ""; |
|||
if (!(state & REDIRECT) |
|||
&& !(state & HOMONYMIE) |
|||
&& ns == 0 |
|||
&& !(state & CATEGORIZED)) |
|||
postArti += '<sup style="color:crimson">(cat ?)</sup>'; |
|||
// Redirect, Log, or simple edit ? ; |
|||
////////////////// |
|||
if (state & MOVE) { |
|||
// artiStyle = 'color: magenta; font-weight: bold; font-style: italic;'; |
|||
postArti += ' <img src="http://upload.wikimedia.org/wikipedia/commons/0/0e/Forward.png" width="20px" alt="Sposta" title="Sposta" />'; |
|||
var diffnew_title = rc.new_title.replace(new RegExp(/\"/g), '\%22'); |
|||
postArti += ' <a href="javascript:;" onClick="liveArticle(\''+diffnew_title+'\',\''+user+'\');">'+rc.new_title+'</a>'; |
|||
arti = '<a style="'+artiStyle+'" href="javascript:;" onClick="liveArticle(\''+diffEscTitle+'\',\''+user+'\');">'+title+'</a>'; |
|||
} |
|||
else if (state & REDIRECT) { |
|||
artiStyle = 'color: green; font-weight: bold; font-style: italic;'; |
|||
postArti += ' <img src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b5/Redirectltr.png/20px-Redirectltr.png" width="20px" alt="Redirect" title="Redirect" />'; |
|||
var diffredirect =rc.redirect.replace(new RegExp(/\"/g), '\%22'); |
|||
postArti += ' <a href="javascript:;" onClick="liveArticle(\''+diffredirect+'\',\''+user+'\');">'+rc.redirect+'</a>'; |
|||
arti = '<a style="'+artiStyle+'" href="javascript:;" onClick="liveArticle(\''+diffEscTitle+'\',\''+user+'\');">'+title+'</a>'; |
|||
} |
|||
else if (state & UPLOAD) { |
|||
postArti += ' <img src="http://upload.wikimedia.org/wikipedia/commons/4/47/Gartoon-Gnome-dev-floppy.png" width="20px" alt="Carica" title="Carica" />'; |
|||
arti = '<a style="'+artiStyle+'" href="javascript:;" onClick="liveArticle(\''+diffEscTitle+'\',\''+user+'\');" onDblClick="window.open(\''+wgServer+'/wiki/'+encodeURI(title)+'\');">'+title+'</a>'; |
|||
} |
|||
else if (state & NEWUSER) { |
|||
postArti += ' <img src="http://upload.wikimedia.org/wikipedia/commons/c/c1/Crystal_personal.png" width="20px" alt="Nuovo utente" title="Nuovo utente" />'; |
|||
arti = '<a style="'+artiStyle+'" href="javascript:;" onClick="liveArticle(\''+diffEscTitle+'\',\''+user+'\');" onDblClick="window.open(\''+wgServer+'/wiki/'+encodeURI(title)+'\');">'+title+'</a>'; |
|||
} |
|||
else if (state & BLOCK) { |
|||
// artiStyle = 'color: magenta; font-weight: bold; font-style: italic;'; |
|||
postArti += ' <img src="http://upload.wikimedia.org/wikipedia/commons/6/64/Crystal_Clear_action_lock3.png" width="20px" alt="Blocca" title="Blocca" />'; |
|||
postArti += ' <a href="javascript:;" onClick="liveLog("block",\''+rc.title+'\');">('+rc.duration+')</a>'; |
|||
arti = '<a style="'+artiStyle+'" href="javascript:;" onClick="liveArticle(\''+diffEscTitle+'\',\''+user+'\');">'+title+'</a>'; |
|||
} |
|||
else if (state & RIGHTS) { |
|||
postArti += ' <img src="http://upload.wikimedia.org/wikipedia/it/1/10/Stub_universit%C3%A0.png" width="20px" alt="Permessi" title="Permessi" />'; |
|||
postArti += ' <a href="javascript:;" onClick="liveLog("rights",\''+rc.title+'\');">(da \''+rc.rightsOld+'\' a \''+rc.rightsNew+'\')</a>'; |
|||
arti = '<a style="'+artiStyle+'" href="javascript:;" onClick="liveArticle(\''+diffEscTitle+'\',\''+user+'\');">'+title+'</a>'; |
|||
} |
|||
else if (state & DELETE) { |
|||
postArti += ' <img src="http://upload.wikimedia.org/wikipedia/commons/e/ef/Editcut.png" width="20px" alt="Cancella" title="Cancella" />'; |
|||
arti = '<a style="'+artiStyle+'" href="javascript:;" onClick="liveArticle(\''+diffEscTitle+'\',\''+user+'\');" onDblClick="window.open(\''+wgServer+'/wiki/'+encodeURI(title)+'\');">'+title+'</a>'; |
|||
} |
|||
else if (state & DELETE_REVISION) { |
|||
postArti += ' <img src="http://upload.wikimedia.org/wikipedia/commons/a/a7/Kgpg_info.png" width="20px" alt="Cambia visibilità" title="Cambia visibilità" />'; |
|||
arti = '<a style="'+artiStyle+'" href="javascript:;" onClick="liveArticle(\''+diffEscTitle+'\',\''+user+'\');" onDblClick="window.open(\''+wgServer+'/wiki/'+encodeURI(title)+'\');">'+title+'</a>'; |
|||
} |
|||
else if (state & PROTECT) { |
|||
postArti += ' <img src="http://upload.wikimedia.org/wikipedia/commons/7/72/Crystal_Clear_app_agent.png" width="20px" alt="Proteggi" title="Proteggi" />'; |
|||
arti = '<a style="'+artiStyle+'" href="javascript:;" onClick="liveArticle(\''+diffEscTitle+'\',\''+user+'\');" onDblClick="window.open(\''+wgServer+'/wiki/'+encodeURI(title)+'\');">'+title+'</a>'; |
|||
} |
|||
else { |
|||
arti = '<a style="'+artiStyle+'" href="javascript:;" onClick="liveArticle(\''+diffEscTitle+'\',\''+user+'\');" onDblClick="window.open(\''+wgServer+'/wiki/'+encodeURI(title)+'\');">'+title+'</a>'; |
|||
} |
|||
th1.innerHTML = '<small>' + tsToHhMm(timestamp) + ' • ' + diff + ' • ' + hist + ' • ' + edit + ' • ' + livelogs + admin + ' • </small>' |
|||
+ preArti + arti + postArti; |
|||
th1.className="creator-title"; |
|||
th1.style.textAlign="left"; |
|||
th1.style.border="1px"; |
|||
th1.style.width="40%"; |
|||
// EDITOR // |
|||
//////////// |
|||
var discut = '<a href="'+wgServer+'/wiki/Discussioni utente:'+encodeURIComponent(user)+'" style="color:seagreen" target="_new">D</a>'; |
|||
var contrib = '<a href="javascript:;" onClick="liveContrib(\''+escUser+'\');" style="color:#43CD80">C</a>'; |
|||
var editor = "", preEditor = ""; |
|||
// Bot ? ; |
|||
////////// |
|||
if (state & BOT) |
|||
preEditor += '<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/2/2a/Nuvola_apps_kservices.png/16px-Nuvola_apps_kservices.png" width="16px" alt+"bot" title="bot"/> '; |
|||
// Sysop ? ; |
|||
//////////// |
|||
if (state & SYSOP) |
|||
preEditor += '<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/2/2c/Broom_icon.svg/16px-Broom_icon.svg.png" width="16px" alt="sysop" title="sysop" /> '; |
|||
// Reverted ? ; |
|||
///////////////// |
|||
if (state & REVERT) |
|||
preEditor += '<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/2/2c/Nuvola_actions_undo.png/16px-Nuvola_actions_undo.png" width="16px" alt="rollback" title="rollback" /> '; |
|||
// TOR potentiel / AOL |
|||
var isTOR = regex = /172\.\d+\.\d+\.\d+/; |
|||
if (isTOR.test(user)) |
|||
preEditor += '<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/6/6e/Dialog-warning.svg/16px-Dialog-warning.svg.png" width="16px" alt="forse TOR" title="forse TOR" /> '; |
|||
editor = '<a href="'+wgServer+'/wiki/Utente:'+encodeURIComponent(user)+'" target="_new">'+user+'</a>'; |
|||
var uadmin = ''; |
|||
if (lrcAdmin == true) { |
|||
uadmin = ' • <a href="'+wgServer+'/wiki/Speciale:Blocca/'+encodeURI(user)+'" target="_new" style="color:seagreen">B</a>'; |
|||
} |
|||
var uhide = '<a href="javascript:;" onClick="supprLigne(\''+pageid+'_'+revid+'\'); hideUser(\''+ user +'\');" style="color:grey">N</a>' |
|||
td2.innerHTML = '<small>' + discut + ' • ' + contrib + ' • ' + uhide + uadmin + ' • </small>' |
|||
+ preEditor + editor; |
|||
td2.className="creator-name"; |
|||
td2.style.border = "1px"; |
|||
td2.style.width = "20%"; |
|||
if (lstRevoc[user]) { |
|||
td2.style.border = "2px solid red"; |
|||
td2.innerHTML += '<sup style="color:red">(' + lstRevoc[user].nb + ' rollback)</sup>' |
|||
} |
|||
// COMMENT // |
|||
// Remplace lien [[xxx]] par <a> ; |
|||
var wcomment = comment.htmlize(); |
|||
regex = /\[\[(([^\]\|]*)(.*?))\]\]/g; |
|||
wcomment = wcomment.replace(regex, "<a href='"+wgServer+wgScriptPath+"/index.php?title=$2&redirect=no' target='_new'>$1</a>"); |
|||
regex = /\>[^\]\|<]*\|([^\]\|<]*)</g; |
|||
wcomment = wcomment.replace(regex, ">$1<"); |
|||
td3.innerHTML = "<small>" + wcomment + "</small>"; |
|||
td3.style.border = "1px"; |
|||
td3.style.width = "40%"; |
|||
if (state & UPLOAD) { |
|||
th0.style.backgroundColor = "#D1CAFA"; |
|||
th1.style.backgroundColor = "#D1CAFA"; |
|||
td2.style.backgroundColor = "#D1CAFA"; |
|||
td3.style.backgroundColor = "#D1CAFA"; |
|||
td4.style.backgroundColor = "#D1CAFA"; |
|||
tr1.style.border = "1px solid darkslateblue"; |
|||
} |
|||
if (state & NEWUSER) { |
|||
th0.style.backgroundColor = "#C6FF6D"; |
|||
th1.style.backgroundColor = "#C6FF6D"; |
|||
td2.style.backgroundColor = "#C6FF6D"; |
|||
td3.style.backgroundColor = "#C6FF6D"; |
|||
td4.style.backgroundColor = "#C6FF6D"; |
|||
tr1.style.border = "1px solid lime"; |
|||
} |
|||
if (state & BLOCK) { |
|||
th0.style.backgroundColor = "#EECC84"; |
|||
th1.style.backgroundColor = "#EECC84"; |
|||
td2.style.backgroundColor = "#EECC84"; |
|||
td3.style.backgroundColor = "#EECC84"; |
|||
td4.style.backgroundColor = "#EECC84"; |
|||
tr1.style.border = "1px solid darkgoldenrod"; |
|||
} |
|||
if (state & RIGHTS) { |
|||
th0.style.backgroundColor = "#EECC84"; |
|||
th1.style.backgroundColor = "#EECC84"; |
|||
td2.style.backgroundColor = "#EECC84"; |
|||
td3.style.backgroundColor = "#EECC84"; |
|||
td4.style.backgroundColor = "#EECC84"; |
|||
tr1.style.border = "1px solid darkgoldenrod"; |
|||
} |
|||
if (state & DELETE) { |
|||
th0.style.backgroundColor = "#E7CAA7"; |
|||
th1.style.backgroundColor = "#E7CAA7"; |
|||
td2.style.backgroundColor = "#E7CAA7"; |
|||
td3.style.backgroundColor = "#E7CAA7"; |
|||
td4.style.backgroundColor = "#E7CAA7"; |
|||
tr1.style.border = "1px solid saddlebrown"; |
|||
} |
|||
if (state & DELETE_REVISION) { |
|||
th0.style.backgroundColor = "#D89A6D"; |
|||
th1.style.backgroundColor = "#D89A6D"; |
|||
td2.style.backgroundColor = "#D89A6D"; |
|||
td3.style.backgroundColor = "#D89A6D"; |
|||
td4.style.backgroundColor = "#D89A6D"; |
|||
tr1.style.border = "1px solid chocolate"; |
|||
} |
|||
if (state & MOVE) { |
|||
th0.style.backgroundColor = "#FDC5FF"; |
|||
th1.style.backgroundColor = "#FDC5FF"; |
|||
td2.style.backgroundColor = "#FDC5FF"; |
|||
td3.style.backgroundColor = "#FDC5FF"; |
|||
td4.style.backgroundColor = "#FDC5FF"; |
|||
tr1.style.border = "1px solid magenta"; |
|||
} |
|||
if (state & PROTECT) { |
|||
th0.style.backgroundColor = "#B2BCC6"; |
|||
th1.style.backgroundColor = "#B2BCC6"; |
|||
td2.style.backgroundColor = "#B2BCC6"; |
|||
td3.style.backgroundColor = "#B2BCC6"; |
|||
td4.style.backgroundColor = "#B2BCC6"; |
|||
tr1.style.border = "1px solid darkslategray"; |
|||
} |
|||
if (state & REVERT) { |
|||
th0.style.backgroundColor = "#FFBAB3"; |
|||
th1.style.backgroundColor = "#FFBAB3"; |
|||
td2.style.backgroundColor = "#FFBAB3"; |
|||
td3.style.backgroundColor = "#FFBAB3"; |
|||
td4.style.backgroundColor = "#FFBAB3"; |
|||
tr1.style.border = "1px solid crimson"; |
|||
} |
|||
if (state & BLANKING || newsize == 0) { |
|||
th0.style.backgroundColor = "white"; |
|||
th1.style.backgroundColor = "white"; |
|||
td2.style.backgroundColor = "white"; |
|||
td3.style.backgroundColor = "white"; |
|||
td4.style.backgroundColor = "white"; |
|||
tr1.style.border = "2px double crimson"; |
|||
} |
|||
if (state & NEW) { |
|||
th0.style.backgroundColor = "#BDE397"; |
|||
th1.style.backgroundColor = "#BDE397"; |
|||
td2.style.backgroundColor = "#BDE397"; |
|||
td3.style.backgroundColor = "#BDE397"; |
|||
td4.style.backgroundColor = "#BDE397"; |
|||
tr1.style.border = "1px solid green"; |
|||
// check if the page has been already deleted |
|||
myXmlReq = wpajax.http({url: wgServer + wgScriptPath + '/api.php?action=query&list=deletedrevs&titles='+ title + '&drprop=user&format=xml'}); |
|||
var api = myXmlReq.responseXML; |
|||
if (api) |
|||
{ |
|||
if (api.firstChild.nodeName == "error") return; |
|||
deletedRevs = api.getElementsByTagName('rev'); |
|||
if (deletedRevs.length != 0) |
|||
{ |
|||
th1.style.border = "1px solid red"; |
|||
th1.style.backgroundColor = "#FFDDDD"; |
|||
th1.innerHTML += '<img src="http://upload.wikimedia.org/wikipedia/commons/f/f7/Gartoon-Emblem-trash.png" width="15px" alt="Voce cancellata in precedenza" title="Nuova voce già cancellata in precedenza" />' |
|||
} |
|||
} |
|||
} |
|||
if (state & IP) { |
|||
td2.style.backgroundColor = "#B9F8FF"; |
|||
td3.style.backgroundColor = "#B9F8FF"; |
|||
td4.style.backgroundColor = "#B9F8FF"; |
|||
} |
|||
if (isTOR.test(user)) |
|||
td2.style.backgroundColor = "pink"; |
|||
if (state & REPLACED) { |
|||
th0.style.backgroundColor = "pink"; |
|||
th1.style.backgroundColor = "pink"; |
|||
td2.style.backgroundColor = "pink"; |
|||
td3.style.backgroundColor = "pink"; |
|||
td4.style.backgroundColor = "pink"; |
|||
td4.innerHTML = '<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/9/95/Categorie_III.svg/10px-Categorie_III.svg.png" width="10px" alt="Avviso" title="Avviso"/>'; |
|||
tr1.style.border = "2px solid crimson"; |
|||
} |
|||
// CONTACT LIST // |
|||
////////////////// |
|||
if (lstContact[user]) { |
|||
td2.style.border = "2px solid gold"; |
|||
td2.style.backgroundColor = "yellow"; |
|||
} |
|||
// IPCLASS LIST // |
|||
////////////////// |
|||
for (var IPclass in lstIPClass) { |
|||
if (user.indexOf(IPclass)==0) { |
|||
td2.style.border = "2px solid gold"; |
|||
td2.style.backgroundColor = "yellow"; |
|||
IPclassMitigating = true; |
|||
} |
|||
} |
|||
if (user == wgUserName) { |
|||
td2.style.border = "2px solid #A0B0E0"; |
|||
td2.style.backgroundColor = "#F0F8FF"; |
|||
} |
|||
// DELTA SIZE // |
|||
// delta de modif ; |
|||
/////////////////// |
|||
var txtdiff = ""; |
|||
if (sizediff < 0) |
|||
txtdiff = '<sub style="color:red">'+sizediff+'</sub>'; |
|||
else if (sizediff == 0) |
|||
txtdiff = '<small style="color:purple">='+sizediff+'</small>'; |
|||
else |
|||
txtdiff = '<sup style="color:blue">+'+sizediff+'</sup>'; |
|||
td4.innerHTML += txtdiff; |
|||
td4.style.border = "1px"; |
|||
td4.style.textAlign = "right"; |
|||
// ASSEMBLAGE LIGNE // |
|||
tr1.appendChild(th0); |
|||
tr1.appendChild(th1); |
|||
tr1.appendChild(td2); |
|||
tr1.appendChild(td3); |
|||
tr1.appendChild(td4); |
|||
tr1.id = pageid+"_"+revid; |
|||
var tab = document.getElementById('tabRC'); |
|||
var elold = document.getElementById(pageid+"_"+oldid); |
|||
var elmsnts = tab.getElementsByTagName('tr'); |
|||
if (elmsnts.length != 0) { |
|||
for(var i = 0; i < elmsnts.length; i++) { |
|||
if(elmsnts[i].id.split('_')[1] < revid) { |
|||
tab.insertBefore(tr1, elmsnts[i]); |
|||
break; |
|||
} |
|||
if(i == elmsnts.length - 1) tab.appendChild(tr1); |
|||
} |
|||
} |
|||
else |
|||
tab.appendChild(tr1); |
|||
if (elold == null || typeof(oldid) == "undefined") { |
|||
if (tab.childNodes.length > lrcRCLimit) { |
|||
var idt = tab.lastChild.id; |
|||
supprLigne(idt); |
|||
} |
|||
} else { |
|||
supprLigne(pageid+"_"+oldid); |
|||
} |
|||
// Don't show RC if checkbox is not checked |
|||
if ((!document.getElementById('showRC').checked) && |
|||
(!(state & UPLOAD) && |
|||
!(state & NEWUSER) && |
|||
!(state & BLOCK) && |
|||
!(state & RIGHTS) && |
|||
!(state & DELETE) && |
|||
!(state & DELETE_REVISION) && |
|||
!(state & PROTECT) && |
|||
!(state & MOVE))) |
|||
supprLigne(pageid+"_"+revid); |
|||
// Don't show Log if checkbox is not checked |
|||
if ((!document.getElementById('showLog').checked) && |
|||
((state & UPLOAD) || |
|||
(state & NEWUSER) || |
|||
(state & BLOCK) || |
|||
(state & RIGHTS) || |
|||
(state & DELETE) || |
|||
(state & DELETE_REVISION) || |
|||
(state & PROTECT) || |
|||
(state & MOVE))) |
|||
supprLigne(pageid+"_"+revid); |
|||
// Don't show "non-Log" with +NaN diffsize (fake edits) |
|||
if (isNaN(sizediff) && |
|||
!(state & UPLOAD) && |
|||
!(state & NEWUSER) && |
|||
!(state & BLOCK) && |
|||
!(state & RIGHTS) && |
|||
!(state & DELETE) && |
|||
!(state & DELETE_REVISION) && |
|||
!(state & PROTECT) && |
|||
!(state & MOVE)) |
|||
supprLigne(pageid+"_"+revid); |
|||
// MISE A JOUR LISTES // |
|||
var spos = lstSuivi.indexOf(title); |
|||
if(spos != -1) { |
|||
th0.style.border = "2px solid gold"; |
|||
th0.style.backgroundColor = "yellow"; |
|||
th1.style.border = "2px solid gold"; |
|||
th1.style.backgroundColor = "yellow"; |
|||
lstSuiviHH[spos] = tsToHhMm(timestamp); |
|||
var tempsAr = new Array(); |
|||
var len = lstSuivi.length; |
|||
for (var n = 0; n < len; n++) { |
|||
if(lstSuiviHH[n] == "--:--") continue; |
|||
var cstilde = lstSuivi[n].replace(new RegExp(/\'/g), "\\'"); |
|||
var diffcstilde = cstilde.replace(new RegExp(/\"/g), '\%22'); |
|||
if (lstSuivi[n] == title) |
|||
{ |
|||
lstSuivirevid[n] = revid; |
|||
lstSuivioldid[n] = oldid; |
|||
lstSuivircid[n] = rcid; |
|||
} |
|||
var myrevid = lstSuivirevid[n]; |
|||
var myoldid = lstSuivioldid[n]; |
|||
var myrcid = lstSuivircid[n]; |
|||
var sdiff = '<a href="javascript:;" onClick="liveDiff(\''+diffcstilde+'\','+myrevid+','+myoldid+','+myrcid+');" style="color:orange">Diff</a>'; |
|||
var shist = '<a href="javascript:;" onClick="liveHist(\''+diffcstilde+'\');" style="color:darkorange">C</a>'; |
|||
var sarti = '<a href="javascript:;" onClick="liveArticle(\''+diffcstilde+'\',\''+user+'\');">'+lstSuivi[n]+'</a>'; |
|||
var ligne='<small>' + lstSuiviHH[n] + ' • ' + sdiff + ' • ' + shist + ' • </small>' + sarti +'<br />'; |
|||
tempsAr.push(ligne); |
|||
} |
|||
tempsAr.sort(); |
|||
len = tempsAr.length; |
|||
var lvSuivi = document.getElementById( 'liveSuivi' ); |
|||
lvSuivi.innerHTML = ""; |
|||
for (var n=len-1; n >= 0; n--) |
|||
lvSuivi.innerHTML = lvSuivi.innerHTML + tempsAr[n]; |
|||
} |
|||
if (lstContact[user]) { |
|||
lstContact[user].ts = timestamp; |
|||
updateFollowContact(); |
|||
} |
|||
if (state & REVERT) { |
|||
regex = /\[\[Special:Contributi\/([^\]\|]+)/; |
|||
match = regex.exec(comment); |
|||
if (!match) { |
|||
regex = /\[\[Speciale:Contributi\/([^\]\|]+)/; |
|||
match = regex.exec(comment); |
|||
} |
|||
if (match) { |
|||
var userR = match[1]; |
|||
if (userR != user && userR != wgUserName) { |
|||
if (!lstRevoc[userR]) lstRevoc[userR] = { ts: 0, nb: 0 }; |
|||
lstRevoc[userR].ts = timestamp; |
|||
lstRevoc[userR].nb += 1; |
|||
updateFollowRevoc(); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
function getRedirCat(xmlreq, data) { |
|||
if (document.getElementById('stopLive').checked) return; |
|||
var yurik = xmlreq.responseXML.getElementsByTagName('api')[0]; |
|||
if (yurik.firstChild.nodeName == "error") return; |
|||
var rc = data.rc; |
|||
var pageid = rc.pageid; |
|||
var revid = rc.revid; |
|||
var state = rc.state; |
|||
var page = yurik.getElementsByTagName('pages')[0].getElementsByTagName('page')[0]; |
|||
if (yurik.getElementsByTagName('redirects').length) { |
|||
state += REDIRECT; |
|||
if (yurik.getElementsByTagName('redirects')[0].getElementsByTagName('r').length) |
|||
rc.redirect = yurik.getElementsByTagName('redirects')[0].getElementsByTagName('r')[0].attributes[1].nodeValue; |
|||
} |
|||
if (page.getElementsByTagName('categories').length) { |
|||
state += CATEGORIZED; |
|||
var categories = page.getElementsByTagName('categories')[0].getElementsByTagName('cl'); |
|||
var i,j; |
|||
var leni = categories.length; |
|||
var lenj = categoriestests.length; |
|||
for (i=0; i<leni; i++) |
|||
for (j=0; j<lenj; j++) |
|||
if (new RegExp(lang_category+categoriestests[j].regex, "i").test(categories[i].attributes[1].textContent)) |
|||
state += categoriestests[j].state; |
|||
} |
|||
rc.state = state; |
|||
getRevision(rc); |
|||
// wpajax.http({ url: wgServer + wgScriptPath + '/api.php?action=query&prop=revisions&pageids=' + pageid + '&rvstartid=' + revid + '&rvlimit=1&rvprop=content&format=xml', |
|||
// onSuccess: getRevision, rc: rc }); |
|||
} |
|||
function getRedirCat2(xmlreq, data) { |
|||
if (document.getElementById('stopLive').checked) return; |
|||
var yurik = xmlreq.responseXML.getElementsByTagName('api')[0]; |
|||
if (yurik.firstChild.nodeName == "error") return; |
|||
var log = data.log; |
|||
var pageid = log.pageid; |
|||
var revid = log.revid; |
|||
var state = log.state; |
|||
var page = yurik.getElementsByTagName('pages')[0].getElementsByTagName('page')[0]; |
|||
if (page.getElementsByTagName('redirect').length) { |
|||
state += REDIRECT; |
|||
if (page.getElementsByTagName('redirect')[0].getElementsByTagName('to').length) |
|||
log.redirect = page.getElementsByTagName('redirect')[0].getElementsByTagName('to')[0].textContent; |
|||
} |
|||
if (page.getElementsByTagName('categories').length) { |
|||
state += CATEGORIZED; |
|||
var categories = page.getElementsByTagName('categories')[0].getElementsByTagName('cl'); |
|||
var i,j; |
|||
var leni = categories.length; |
|||
var lenj = categoriestests.length; |
|||
for (i=0; i<leni; i++) |
|||
for (j=0; j<lenj; j++) |
|||
if (new RegExp(lang_category+categoriestests[j].regex, "i").test(categories[i].textContent)) |
|||
state += categoriestests[j].state; |
|||
} |
|||
log.state = state; |
|||
getRevision(log); |
|||
// wpajax.http({ url: wgServer + wgScriptPath + '/api.php?action=query&prop=revisions&pageids=' + pageid + '&rvstartid=' + revid + '&rvlimit=1&rvprop=content&format=xml', |
|||
// onSuccess: getRevision, rc: rc }); |
|||
} |
|||
// Get RC and Log |
|||
function getRC(xmlreq, data) { |
|||
if (document.getElementById('stopLive').checked) return; |
|||
var api = xmlreq.responseXML.getElementsByTagName('api')[0]; |
|||
if (api.firstChild.nodeName == "error") return; |
|||
// RC |
|||
var rcs = api.getElementsByTagName('query')[0].getElementsByTagName('recentchanges')[0].getElementsByTagName('rc'); |
|||
var i,j,leni,lenj,rc; |
|||
leni=rcs.length; |
|||
for (i=leni-1; i>=0; i--) { |
|||
if (rcs[i].getAttribute('revid') <= lastrevid) continue; |
|||
rc = new Object(); |
|||
rc.state = 0; |
|||
lenj = rcs[i].attributes.length; |
|||
for (j=0; j<lenj; j++) { |
|||
switch(rcs[i].attributes[j].name) { |
|||
case 'anon': |
|||
rc.state += IP; |
|||
break; |
|||
case 'bot': |
|||
rc.state += BOT; |
|||
break; |
|||
case 'new': |
|||
rc.state += NEW; |
|||
break; |
|||
case 'minor': |
|||
rc.state += MINOR; |
|||
break; |
|||
case 'new_ns': |
|||
rc.state += NEWNS; |
|||
break; |
|||
case 'new_title': |
|||
rc.state += RENAMED; |
|||
break; |
|||
case 'patrolled': |
|||
rc.state += PATROLLED; |
|||
break; |
|||
case 'type': |
|||
break; |
|||
default: |
|||
rc[rcs[i].attributes[j].name] = rcs[i].attributes[j].value; |
|||
break; |
|||
} |
|||
} |
|||
if (typeof(rc.comment) != "undefined") { |
|||
lenj = commenttests.length; |
|||
for (j=0; j<lenj; j++) |
|||
if (new RegExp(commenttests[j].regex).test(rc.comment)) |
|||
rc.state += commenttests[j].state; |
|||
} |
|||
if (lstSysop.indexOf(rc.user) != -1) |
|||
rc.state += SYSOP; |
|||
var IPclassMitigating = false; |
|||
for (var IPclass in lstIPClass) |
|||
if (rc.user.indexOf(IPclass)==0) |
|||
IPclassMitigating = true; |
|||
var mitigating = (rc.state & REVERT) |
|||
|| (rc.state & BLANKING) |
|||
|| (rc.state & REPLACED) |
|||
|| (lstContact[rc.user]) |
|||
|| (lstRevoc[rc.user]) |
|||
|| (rc.user == wgUserName) |
|||
|| (IPclassMitigating == true); |
|||
if (document.getElementById('showIP').checked |
|||
&& !(rc.state & IP) |
|||
&& !mitigating ) continue; |
|||
if (lstHidden[rc.user] && !mitigating) continue; |
|||
wpajax.http({url: wgServer + wgScriptPath + '/api.php?titles=' + encodeURIComponent(rc.title) + '&action=query&prop=categories&redirects&format=xml', |
|||
onSuccess: getRedirCat, rc: rc }); |
|||
} |
|||
// Log |
|||
var logs = api.getElementsByTagName('query')[0].getElementsByTagName('logevents')[0].getElementsByTagName('item'); |
|||
var i,j,leni,lenj,log; |
|||
leni=logs.length; |
|||
for (i=leni-1; i>=0; i--) { |
|||
if (logs[i].getAttribute('timestamp').replace(new RegExp(/\D/g), "") <= lasttimestamp) continue; |
|||
log = new Object(); |
|||
log.state = 0; |
|||
lenj = logs[i].attributes.length; |
|||
//Cerca il campo 'action' |
|||
var action = null; |
|||
for (j=0; j<lenj; j++) |
|||
if (logs[i].attributes[j].name == 'action') |
|||
action = logs[i].attributes[j].value; |
|||
for (j=0; j<lenj; j++) { |
|||
if (logs[i].attributes[j].name == 'type') |
|||
{ |
|||
switch(logs[i].attributes[j].value) { |
|||
case 'patrol': |
|||
// I "Segna come verificata" non li cago |
|||
// rc.state += PATROL; |
|||
break; |
|||
case 'newusers': |
|||
log.state += NEWUSER; |
|||
break; |
|||
case 'upload': |
|||
log.state += UPLOAD; |
|||
break; |
|||
case 'block': |
|||
log.state += BLOCK; |
|||
if (logs[i].firstChild) |
|||
log.duration = logs[i].firstChild.attributes[1].value; |
|||
break; |
|||
case 'delete': |
|||
if (action == 'delete') |
|||
log.state += DELETE; |
|||
else if (action == 'revision') |
|||
log.state += DELETE_REVISION; |
|||
break; |
|||
case 'move': |
|||
log.state += MOVE; |
|||
if (logs[i].firstChild) |
|||
log.new_title = logs[i].firstChild.attributes[1].value; |
|||
case 'rights': |
|||
log.state += RIGHTS; |
|||
if (logs[i].firstChild) |
|||
{ |
|||
log.rightsOld = logs[i].firstChild.attributes[1].value; |
|||
log.rightsNew = logs[i].firstChild.attributes[0].value; |
|||
} |
|||
case 'protect': |
|||
log.state += PROTECT; |
|||
break; |
|||
default: |
|||
break; |
|||
} |
|||
} |
|||
else |
|||
log[logs[i].attributes[j].name] = logs[i].attributes[j].value; |
|||
} |
|||
if (typeof(log.comment) != "undefined") { |
|||
lenj = commenttests.length; |
|||
for (j=0; j<lenj; j++) |
|||
if (new RegExp(commenttests[j].regex).test(log.comment)) |
|||
log.state += commenttests[j].state; |
|||
} |
|||
if (lstSysop.indexOf(log.user) != -1) |
|||
log.state += SYSOP; |
|||
wpajax.http({url: wgServer + wgScriptPath + '/api.php?titles=' + encodeURIComponent(log.title) + '&action=query&prop=categories&redirects&format=xml', |
|||
onSuccess: getRedirCat2, log: log }); |
|||
} |
|||
lastrevid = rcs[0].getAttribute('revid'); |
|||
lasttimestamp = rcs[0].getAttribute('timestamp').replace(new RegExp(/\D/g), ""); |
|||
document.getElementById('tsInit').innerHTML = "Ultima versione : " + lasttimestamp; |
|||
} |
|||
function liveRC() { |
|||
var refresh = 10; |
|||
timer= setTimeout("liveRC()",refresh*1000); |
|||
if (document.getElementById('stopLive').checked) return; |
|||
var rcns = document.getElementById('showNS0').value; |
|||
if (rcns == null) return; |
|||
var rcshow = ""; |
|||
if (document.getElementById('showBot').checked) rcshow = '&rcshow=!bot'; |
|||
wpajax.http({url:wgServer + wgScriptPath |
|||
+ '/api.php?action=query&list=recentchanges|logevents&rcnamespace=' + rcns |
|||
+ '&rcprop=user|comment|flags|timestamp|title|ids|sizes' + rcshow |
|||
+ '&rcend=' + lasttimestamp + '&rclimit=' + lrcRCLimit |
|||
+ '&leend=' + lasttimestamp + '&lelimit=' + lrcRCLimit |
|||
+ '&format=xml', |
|||
onSuccess: getRC, message: "Elaborazione in corso...\n\n" }); |
|||
} |
|||
function hideUser(name) { |
|||
lstHidden[name] = true; |
|||
updateHidden(); |
|||
} |
|||
function unhideUser(name) { |
|||
delete lstHidden[name]; |
|||
updateHidden(); |
|||
} |
|||
function showHideObj(parent, fils) { |
|||
var ofils = document.getElementById( fils ); |
|||
if (parent.checked) |
|||
ofils.style.display="inline"; |
|||
else |
|||
ofils.style.display="none"; |
|||
} |
|||
addOnloadHook(function () { |
|||
if (wgTitle == "Genuzzo/LiveRC") { |
|||
var top = document.getElementById( 'top' ); |
|||
if (top != null) { |
|||
top.innerHTML = ""; |
|||
top.style.display = "none"; |
|||
} |
|||
var siteSub = document.getElementById( 'siteSub' ); |
|||
var contentSub = document.getElementById( 'contentSub' ); |
|||
var rtb = document.getElementById( 'RealTitleBanner' ); |
|||
var rt = document.getElementById( 'RealTitle' ); |
|||
var pca = document.getElementById( 'p-cactions' ); |
|||
//LiveRC |
|||
importScript("Nonciclopedia:LiveRC/LiveRC.js", (wgPageName == "Nonciclopedia:LiveRC")); |
|||
if (siteSub != null) siteSub.style.display = "none"; |
|||
if (contentSub != null) contentSub.style.display = "none"; |
|||
if (rtb != null) rtb.style.display = "none"; |
|||
if (rt != null) rt.style.display = "none"; |
|||
if (pca != null) pca.style.display = "none"; |
|||
//Searchbox |
|||
var lvPreviewFoot = document.getElementById( 'livePreviewFoot' ); |
|||
importScript("Nonciclopedia:Script/Searchbox.js", (wgAction=='edit' || wgAction == 'submit')); |
|||
lvPreviewFoot.innerHTML = '<a href="javascript:;" onClick="supprLigne(\'*\');" style="color: red; font-weight: bold;">X</a>' + |
|||
'<a href="javascript:;" onClick="supprLigne(\'d\');" style="color: rgb(255, 235, 71); font-weight: bold;">X</a>' + |
|||
'<a href="javascript:;" onClick="supprLigne(\'r\');" style="color: rgb(255, 99, 83); font-weight: bold;">X</a>' + |
|||
'<a href="javascript:;" onClick="supprLigne(\'n\');" style="color: rgb(178, 243, 113); font-weight: bold;">X</a>' + |
|||
'<input id="stopLive" type="checkbox" value="true" />' + |
|||
'<label for="stopLive">' + 'Pausa' + '</label>'; |
|||
//Anteprima (default = not checked) |
|||
if (typeof(checkAnteprima)!="undefined" && checkAnteprima == "1") |
|||
lvPreviewFoot.innerHTML += '<input id="shidPrev" type="checkbox" checked onclick="showHideObj(this, \'divLivePreview\');" />'; |
|||
else |
|||
lvPreviewFoot.innerHTML += '<input id="shidPrev" type="checkbox" onclick="showHideObj(this, \'divLivePreview\');" />'; |
|||
showHideObj(document.getElementById("shidPrev"), 'divLivePreview'); |
|||
lvPreviewFoot.innerHTML += '<label for="shidPrev">' + 'Anteprima' + '</label>'; |
|||
//Liste (default = not checked) |
|||
if (typeof(checkListe)!="undefined" && checkListe == "1") |
|||
lvPreviewFoot.innerHTML += '<input id="shidList" type="checkbox" checked onclick="showHideObj(this, \'liveFollow\');" />'; |
|||
else |
|||
lvPreviewFoot.innerHTML += '<input id="shidList" type="checkbox" onclick="showHideObj(this, \'liveFollow\');" />'; |
|||
showHideObj(document.getElementById("shidList"), 'liveFollow'); |
|||
lvPreviewFoot.innerHTML += '<label for="shidList">' + 'Liste' + '</label>'; |
|||
//Modifiche minori (default = not checked) |
|||
if (typeof(checkModificheMinori)!="undefined" && checkModificheMinori == "1") |
|||
lvPreviewFoot.innerHTML += '<input id="showDiffR" type="checkbox" checked />'; |
|||
else |
|||
lvPreviewFoot.innerHTML += '<input id="showDiffR" type="checkbox" />'; |
|||
lvPreviewFoot.innerHTML += '<label for="showDiffR">'+ 'Diff leggere' + '</label>'; |
|||
//Pannello (default = checked) |
|||
if (typeof(checkPannello)!="undefined" && checkPannello == "0") |
|||
lvPreviewFoot.innerHTML += '<input id="shidRC" type="checkbox" onclick="showHideObj(this, \'divTabRC\');" />'; |
|||
else |
|||
lvPreviewFoot.innerHTML += '<input id="shidRC" type="checkbox" checked onclick="showHideObj(this, \'divTabRC\');" />'; |
|||
showHideObj(document.getElementById("shidRC"), 'divTabRC'); |
|||
lvPreviewFoot.innerHTML += '<label for="shidRC">' + 'Nascondi tabella' + '</label>'; |
|||
//Show Bot (default = checked) |
|||
if (typeof(checkNienteBot)!="undefined" && checkNienteBot == "0") |
|||
lvPreviewFoot.innerHTML += '<input id="showBot" type="checkbox" />'; |
|||
else |
|||
lvPreviewFoot.innerHTML += '<input id="showBot" type="checkbox" checked />'; |
|||
lvPreviewFoot.innerHTML += '<label for="showBot">' + 'Mostra BOT' + '</label>'; |
|||
//Solo IP (default = not checked) |
|||
if (typeof(checkSoloIP)!="undefined" && checkSoloIP == "1") |
|||
lvPreviewFoot.innerHTML += '<input id="showIP" type="checkbox" checked />'; |
|||
else |
|||
lvPreviewFoot.innerHTML += '<input id="showIP" type="checkbox" />'; |
|||
lvPreviewFoot.innerHTML += '<label for="showIP">' + 'Solo IP' + ' • </label>'; |
|||
//Bottone Purge |
|||
//RC (default = checked) |
|||
buttonPurge = true; |
|||
if (typeof(checkRC)!="undefined" && checkRC == "0") |
|||
lvPreviewFoot.innerHTML += '<input id="showRC" type="checkbox" />'; |
|||
else |
|||
lvPreviewFoot.innerHTML += '<input id="showRC" type="checkbox" checked />'; |
|||
lvPreviewFoot.innerHTML += '<label for="showRC"><small>' + 'nontoccarepotrebbeesplodere' + '</small> • </label>'; |
|||
//Log (default = checked) |
|||
if (typeof(checkLog)!="undefined" && checkLog == "0") |
|||
lvPreviewFoot.innerHTML += '<input id="showLog" type="checkbox" />'; |
|||
else |
|||
lvPreviewFoot.innerHTML += '<input id="showLog" type="checkbox" checked />'; |
|||
lvPreviewFoot.innerHTML += '<label for="showLog">' + 'Mostra log' + ' • </label>'; |
|||
//NoAlert |
|||
lvPreviewFoot.innerHTML += '<span id="selectNS" />'; |
|||
disableAlert = true; |
|||
updateHidden(); |
|||
// Main |
|||
liveSysop(); |
|||
} |
|||
}); |
|||
strumentiChiuso = false; |
|||
/* </source> */ |
Versione attuale delle 00:00, 19 feb 2019
//Bottoni
if (mwCustomEditButtons) {
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteCC;
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteCit2;
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteCitnec;
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteReflink;
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteGallery;
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteTabella;
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteRiquadro2;
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteRedirect;
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteCassetto;
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteCensura;
mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteManuali;
}
//LiveRC
importScript("Nonciclopedia:LiveRC/LiveRC.js", (wgPageName == "Nonciclopedia:LiveRC"));
//Searchbox
importScript("Nonciclopedia:Script/Searchbox.js", (wgAction=='edit' || wgAction == 'submit'));
//Bottone Purge
buttonPurge = true;
//NoAlert
disableAlert = true;
strumentiChiuso = false;