Utente:Nonciclopediologo/monobook.js: differenze tra le versioni

Vai alla navigazione Vai alla ricerca
Contenuto aggiunto Contenuto cancellato
Nessun oggetto della modifica
(Pulizia di inizio autunno...)
Riga 791: Riga 791:
}
}
});
});

/* function progressNeve() {
$('.papocchioneve').each(function() {
t = $(this);
if(t.css("top").replace('px', '') < w.height() - 25) {
t.css("top", parseInt(t.css("top").replace('px', '')) + 5 + 'px');
}
else t.css("top", w.height() - 25);
})
for(i = -1; i < w.width(); i++) {
if(Math.floor(Math.random() * 32000) == 50) {
$(document.body).append($(document.createElement('img')).attr('class', 'papocchioneve').attr('src', arrNeveCadente[Math.floor(Math.random()*arrNeveCadente.length)]).attr('style', 'top: -25px; left: ' + i + 'px; z-index: ' + lastZIndex + ';'));
lastZIndex++;
}
}
if($('.papocchioneve').lenght > 100) $('.papocchioneve:first').remove();
}
addOnloadHook(function() {
window.w = $(window);
window.lastZIndex = 10000;
window.arrNeveCadente = new Array('http://images4.wikia.nocookie.net/__cb20111220155233/nonciclopedia/images/1/1b/Cucchiaio_di_legno_immagine_piccola.png', 'http://images1.wikia.nocookie.net/__cb20111220154715/nonciclopedia/images/a/a7/Fiocco_di_neve_piccolo.png', 'http://images4.wikia.nocookie.net/__cb20111220151347/nonciclopedia/images/9/9f/Papocchio_piccolo_29x25.png');
})
addOnloadHook(function(){setInterval(progressNeve, 37);});
*/

function compareEdits() {
$.get('/wiki/Speciale:Editcount/' + $('#utenteuno').val(), function(data) {
var div = $(data.split(' skin-monobook without-adsense">')[1].split('</body>')[0]);
editcol = $('.TablePager > tbody > tr > .ecrowright:nth(2)', div);
if(editcol.length != 1) $('#comparautenti').html('Utente 1 non valido!');
else {
$('#comparautenti').html($('#utenteuno').val() + ': ' + editcol.html());
window.utenteuno = parseInt(editcol.html().replace('.', ''));
$.get('/wiki/Speciale:Editcount/' + $('#utentedue').val(), function(data) {
var div = $(data.split(' skin-monobook without-adsense">')[1].split('</body>')[0]);
editcol = $('.TablePager > tbody > tr > .ecrowright:nth(2)', div);
if(editcol.length != 1) $('#comparautenti').html('Utente 2 non valido!');
else {
$('#comparautenti').html($('#comparautenti').html() + '<br>' + $('#utentedue').val() + ': ' + editcol.html() + '<br>' + 'Differenza di contributi: ' + Math.abs((parseInt(editcol.html().replace('.', ''))) - utenteuno));
}
});
}
});
}
function editsCompareWindow() {
$(document.body).append($('<div class="BG_nerotrasp_corto rad" style="width: 200px; height: 140px; position: fixed; top: 50%; left: 50%; border: solid 2px #00122B; z-index: 99999; background-color: #CED9FF; padding: 5px; text-align:center;">Quali utenti vuoi confrontare?<br />Utente 1: <input type="text" id="utenteuno"></input><br>Utente 2: <input type="text" id="utentedue"></input><br /><input type="button" value="Compara" onclick="compareEdits();"><br /><div id="comparautenti"></div><a href="javascript:void(0);" onclick="javascript:$(this).parent().remove();">Clicca per chiudere</a></div>'));
}
function createEditsButton() {
var menuList = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
var newLi = document.createElement('li');
newLi.setAttribute('id', 'ca-edits');
newLi.innerHTML = '<a href="javascript:editsCompareWindow();">Compara</a>';
menuList.appendChild(newLi);
}
addOnloadHook(createEditsButton);


// FUNZIONI PER INGRANDIRE/RIMPICCIOLIRE IL CARATTERE DEI TESTI
// FUNZIONI PER INGRANDIRE/RIMPICCIOLIRE IL CARATTERE DEI TESTI
Riga 879: Riga 820:
}
}
}, 'xml');
}, 'xml');
}
});

/* ---------------- NonciGioco --------------------- */

function updateNoncigioco() {
time -= 1;
updateNoncigiocoBar();
if(time <= 0) {
youlost();
}
}
function youlost() {
$('#noncigiocoyoulost').html($('#noncigiocoyoulost').html() + '<br>Comunque la risposta esatta era "' + rightAnswers[Math.floor(Math.random() * rightAnswers.length)] + '".');
clearInterval(updateNoncigiocoInterval);
$('#noncigiococontainer').remove();
$('#noncigiocoyoulost').css('display', 'block').remove().appendTo('body');
resizeNoncigiococontainer();
}
function noncigiocoYesNo(yesNo) {
if(currentQuestion.r == -1) youlost();
else if(yesNo == 'yes' && currentQuestion.r == 0) youlost();
else if(yesNo == 'no' && currentQuestion.r == 1) youlost();
else createNoncigiocoQuestion();
}
function createNoncigiocoQuestion() {
var questions = [
{question: "2+2 = 3?", r: 0},
{question: "13 ore equivalgono ad un giorno?", r: 0},
{question: "Il cammello ha una gobba e mezzo?", r: 0},
{question: "Il cane è il migliore amico dell'uomo?", r: 1},
{question: "Gli esseri umani hanno sette occhi?", r: 0},
{question: "Dio esiste?", r: -1},
{question: "La matita è un tipo di penna?", r: 0},
{question: "Il freddo è il contrario del caldo?", r: 1},
{question: "Dopo la 'm' viene la 'n'?", r: 1},
{question: "Il sole è una stella?", r: 1}
];
time = lastTime * 0.85;
lastTime = time;
window.currentQuestion = questions[Math.floor(Math.random() * questions.length)];
$('#noncigiocoquestionrow').html(currentQuestion.question);
updateNoncigiocoBar();
}
function updateNoncigiocoBar() {
var bar = time / (lastTime + 10);
$('#noncigiocobarrow').css('width', Math.round(bar * 100) + "%").css('background-color', 'rgb(' + (Math.round(bar * 255) + ',') + (Math.round(255 - bar * 255) + ',') + '0)');
}
function resizeNoncigiococontainer() {
$('.noncigiococenter').each(function() {
var b = $(window);
var w = b.width();
var h = b.height();
var cw = $(this).width();
var ch = $(this).height();
var l = (w - cw) / 2;
var t = (h - ch) / 2;
$(this).css('top', t).css('left', l);
});
}
$(document).ready(function() {
if(wgPageName == 'Utente:Genuzzo/noncigioco' && wgAction == 'view') {
window.rightAnswers = ["tua madre", "tua sorella", "1.8928374E17", "due elevato alla dodicesima", "sticazzi", "eeeeeeeeh"];
$('#globalWrapper').css('display', 'none');
$('#noncigiocopreview').remove().appendTo($('body').css('background-color', '#fff')).css('width', 100).css('height', 100).css('position', 'fixed').css('background-color', '#AAA').html('Quando sei pronto, cliccami e ti dimostrerò che sei un idiota con una serie di domande.').addClass('noncigiococenter').click(function() {
$(this).remove();
$('#noncigiococontainer').css('display', 'block').remove().appendTo('body');
$('#noncigiocoyes').click(function() {
noncigiocoYesNo('yes');
});
$('#noncigiocono').click(function() {
noncigiocoYesNo('no');
});
window.lastTime = 2500000000000;
window.currentQuestion = {};
createNoncigiocoQuestion();
window.updateNoncigiocoInterval = setInterval(updateNoncigioco, 50);
});
resizeNoncigiococontainer();
$(window).resize(function() {
resizeNoncigiococontainer();
});
}
}
});
});
Riga 993: Riga 843:
addOnloadHook(autosort);
addOnloadHook(autosort);


/* --- Popup per l'inserimento della firma
/* --- Popup per l'inserimento della firma - Prelevato da http://runescape.wikia.com/wiki/User:Tyilo/signature.js --- */
Prelevato da http://runescape.wikia.com/wiki/User:Tyilo/signature.js --- */
addOnloadHook(function()
addOnloadHook(function()
{
{

Versione delle 16:40, 27 set 2013

disableAlert = true;
disableHideEdit = true;
buttonPurge = true;
var noNavSlide = false; 
var noMorphSFX = false;
/* mona = true; - Funzione storica durante la battaglia con Wikia */


/********* Nuovo Stile discussioni e indentazione - da inserire prima o poi, dopo controllo di MFH :asd: *********/
    function GenuzzuIndentStyle(parent) {
             var html = parent.html();
             var matches = html.split(/(?:(<dl>|<\/dl>|<dd>|<\/dd>)| (?:AND|OR) )/);
             var separators = html.match(/(?:(<dl>|<\/dl>|<dd>|<\/dd>)| (?:AND|OR) )/g);
             var pos = html.search(/(<dl>|<\/dl>|<dd>|<\/dd>)/);
             if(separators != null) {
                for (var i=0; i<separators.length; ++i) {
                   if(pos == 0) matches[i * 2 + 1] = separators[i];
                   else matches[i * 2] = separators[i];
                }
             }
             html = '';
             for(var match in matches) {
                if(matches[match] != '<dl>' && matches[match] != '</dl>' && matches[match] != '<dd>' && matches[match] != '</dd>' && matches[match] != '' && matches[match] != '\n') {
                   html += '<div class="IndentStyle">' + matches[match] + '</div>';
                }
                else {
                   html += matches[match];
                }
             }
             $(parent).html(html);
    }

    function oc(a)
    {
      var o = {};
      for(var i=0;i<a.length;i++)
      {
        o[a[i]]='';
      }
      return o;
    }

    $(document).ready(function() {
       if(wgNamespaceNumber in oc([1, 13, 15, 7, 119, 129, 9, 5, 121, 123, 117, 113, 131, 11, 125, 3, 401])) {
          $('#bodyContent dl, #bodyContent p, #bodyContent ul, #bodyContent li, #bodyContent ol').each(function() {if($(this).html().search(/\(CES?T\)/) != -1) GenuzzuIndentStyle($(this))});
       }
    });

/************ Import script ************/
/* Votazione id */
importScript('Nonciclopedia:Script/Votazione.js', true);
/* Searchbox approvato */
importScript('Nonciclopedia:Script/Searchbox.js', (wgAction=='edit' || wgAction == 'submit'));
/* LiveRC */
importScript("Nonciclopedia:LiveRC/LiveRC.js", (wgPageName == "Nonciclopedia:LiveRC"));
/************ Import script ************/

/************ Posizionamento edit **********/
/* if(wgAction == 'edit') $(function() {location.hash = 'wpTextbox1';}); */
if(wgAction == 'edit') $(function() {location.hash = 'toolbar';});

/************ Pulsanti edit ************/
if (mwCustomEditButtons) {

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images4.wikia.nocookie.net/nonciclopedia/images/6/6f/Button_cit2.png",
     "speedTip": "Citazione 2",
     "tagOpen": "{{Cit2|",
     "tagClose": "}}\n",
     "sampleText": "Inserire qui la citazione"};

 mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images.wikia.com/nonciclopedia/images/0/0c/Button_Chuck.png",
     "speedTip": "Cancellazione immediata (USARE CON CAUTELA!)",
     "tagOpen": "{{Cancellazione|motivo=",
     "tagClose": "|firma=~~" + "~~}" + "}\n\n",
     "sampleText": "Inserire qui il motivo"};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images.wikia.com/nonciclopedia/images/3/34/Button_MrX.png",
     "speedTip": "Battute tra amici",
     "tagOpen": "{{Cancellazione|motivo=BTA|firma=--~~" + "~~}" + "}\n\n",
     "tagClose": "",
     "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images.wikia.com/nonciclopedia/images/b/bf/Bottone_fantasia.png",
     "speedTip": "Fantasia personale",
     "tagOpen": "{{Cancellazione|motivo=fantasia|firma=--~~" + "~~}" + "}\n\n",
     "tagClose": "",
     "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images.wikia.com/nonciclopedia/images/a/a5/Button_Samara.png",
     "speedTip": "Articolo in scadenza",
     "tagOpen": "{{scadenza|{{subst:7g}" + "}|note=",
     "tagClose": "|firma=~~" + "~~}" + "}\n\n",
     "sampleText": "Note"};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images.wikia.com/nonciclopedia/images/9/93/Button_Jessica.png",
     "speedTip": "Articolo in dubbio",
     "tagOpen": "{{Accusa|accusa=",
     "tagClose": "|firma=~~" + "~~}" + "}\n\n",
     "sampleText": "Inserire qui l'accusa"};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/b/bd/Button_recherche_ip.png",
     "speedTip": "Accusa",
     "tagOpen": "{{Accusa|accusa=",
     "tagClose": "|firma=~~" + "~~}" + "}\n\n",
     "sampleText": "Inserire qui il motivo"};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images.wikia.com/nonciclopedia/images/0/0a/Button_sad.png",
     "speedTip": "Poco umoristico",
     "tagOpen": "{{Accusa|accusa=APU|firma=~~" + "~~}" + "}\n\n",
     "tagClose": "",
     "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images.wikia.com/nonciclopedia/images/9/92/Iconcina_Attenzione.png",
     "speedTip": "Avvertimento",
     "tagOpen": "{{",
     "tagClose": "}}",
     "sampleText": "avvertimento"};
 
mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images.wikia.com/nonciclopedia/images/2/2d/Iconcina_Accesso_negato.png",
     "speedTip": "Vandalo",
     "tagOpen": "{{Vandalo",
     "tagClose": "}}",
     "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images.wikia.com/nonciclopedia/images/d/d6/E'fiamme.png",
     "speedTip": "Formattazione",
     "tagOpen": "{{Restauro|motivo=formattazione",
     "tagClose": "|firma=--~~" + "~~}" + "}\n\n",
     "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images1.wikia.nocookie.net/__cb20071214202706/nonciclopedia/images/e/e1/E%27mat.png",
     "speedTip": "Restauro generico",
     "tagOpen": "{{Restauro|motivo=",
     "tagClose": "|firma=--~~" + "~~}" + "}\n\n",
     "sampleText": "Inserire il motivo"};
 
mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images1.wikia.nocookie.net/nonciclopedia/images/4/48/Button_McGyver.png",
     "speedTip": "No immagini",
     "tagOpen": "{{restauro|motivo=noimmagini",
     "tagClose": "|firma=--~~" + "~~}" + "}\n\n",
     "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images3.wikia.nocookie.net/nonciclopedia/images/3/3c/Button_Casadiroccata.png",
     "speedTip": "Utilizzato",
     "tagOpen": "{{Utilizzato|",
     "tagClose": "}" + "}",
     "sampleText": "Inserisci qui la pagina"};

mwCustomEditButtons[mwCustomEditButtons.length] = {
      "imageFile": "http://images.wikia.com/nonciclopedia/images/3/33/Sguardone.png",
      "speedTip": "Immagine da rinominare ",
      "tagOpen": "{{Nomedimmerda|{{subst:7g}" + "}|motivo=",
      "tagClose": "|firma=~~" + "~~}" + "}\n\n",
      "sampleText": ""};

 mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images.wikia.com/nonciclopedia/images/f/f9/Button_box.png",
     "speedTip": "Box vecchio stile",
     "tagOpen": '{| style="width:100%; margin:.5em auto; background: #FFFFFF; color: #000000; border: 1px solid #000000; text-align: left; margin-bottom: 0px; margin-top: 0px;"\n| style="padding-right: 4px; padding-left: 4px;" |\n',
     "tagClose": "\n|}\n",
     "sampleText": "Inserire qui il testo interno"};

mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteRiquadro2;

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images.wikia.com/central/images/1/12/Button_gallery.png",
     "speedTip": "Galleria di immagini",
     "tagOpen": "\n<gallery>\n",
     "tagClose": "\n</gallery>",
     "sampleText": "Immagine:Example.jpg|Caption1\nImmagine:Example.jpg|Caption2"};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/0/0c/Button_P_template.png",
     "speedTip": "stub",
     "tagOpen": "{{Template|",
     "tagClose": "}" + "}",
     "sampleText": "Nome template"};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images3.wikia.nocookie.net/nonciclopedia/images/6/6c/Button_restauro.png",
     "speedTip": "Restaurant",
     "tagOpen": "{{",
     "tagClose": "}" + "}",
     "sampleText": "Utente:Nonciclopediologo/Restauro"};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images2.wikia.nocookie.net/nonciclopedia/images/5/5b/Button_inrestauro.png",
     "speedTip": "Fotomontaggio in Restauro",
     "tagOpen": "{{inrestauro",
     "tagClose": "|utente=" + "Nonciclopediologo}" + "}\n\n",
     "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images2.wikia.nocookie.net/nonciclopedia/images/0/04/Button_Creative_Commons.png",
     "speedTip": "Creative Commons",
     "tagOpen": "{{Creative Commons|by=y|nc=y|sa=y|versione=3.0|Attribuzione={{Utente:Nonciclopediologo/firma}}",
     "tagClose": "}" + "}\n",
     "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://img13.imageshack.us/img13/6416/purge.png",
     "speedTip": "Purge",
     "tagOpen": "[{{fullurl:{{FULLPAGENAME}}",
     "tagClose": "|action=purge" + "}" + "} Aggiorna all'ultima versione!]\n\n",
     "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/7/7d/Mifirma.jpg",
     "speedTip": "Firma Gay Pride",
     "tagOpen": "--{{Utente:Nonciclopediologo/firma2",
     "tagClose": "" + "}" + "} ~~" + "~~" + "~\n\n",
     "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images4.wikia.nocookie.net/nonciclopedia/images/2/21/OcchioPNG_pirata.png",
     "speedTip": "Firma Pirata",
     "tagOpen": "--{{Utente:Nonciclopediologo/firma3",
     "tagClose": "" + "}" + "} ~~" + "~~" + "~\n\n",
     "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images2.wikia.nocookie.net/nonciclopedia/images/thumb/5/5d/Papocchio_Socchiuso.png/24px-Papocchio_Socchiuso.png",
     "speedTip": "Firma 10000",
     "tagOpen": "--{{Utente:Nonciclopediologo/firma6",
     "tagClose": "" + "}" + "} ~~" + "~~" + "~\n\n",
     "sampleText": ""};
 
mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images2.wikia.nocookie.net/nonciclopedia/images/thumb/6/62/Roccia.png/35px-Roccia.png",
     "speedTip": "Firma Nonciclopecoso",
     "tagOpen": " --{{Utente:I Fantamici 4/firma/Nonciclopecoso",
     "tagClose": "" + "}" + "} ~~" + "~~" + "~\n\n",
     "sampleText": ""}; 

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/en/c/c9/Button_strike.png",
     "speedTip": "Barrato",
     "tagOpen": "{{S|",
     "tagClose": "}}",
     "sampleText": "Barrato"};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images4.wikia.nocookie.net/nonciclopedia/images/f/fd/Button_underline.png",
     "speedTip": "Sottolineato",
     "tagOpen": "{{U|",
     "tagClose": "}}",
     "sampleText": "Sottolineato"};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/en/8/80/Button_upper_letter.png",
     "speedTip": "Apice",
     "tagOpen": "<sup>",
     "tagClose": "</sup>",
     "sampleText": "Apice"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/en/7/70/Button_lower_letter.png",
     "speedTip": "Pedice",
     "tagOpen": "<sub>",
     "tagClose": "</sub>",
     "sampleText": "Pedice"};
 
mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images.wikia.com/nonciclopedia/images/5/58/Button_small.png",
     "speedTip": "Piccolo",
     "tagOpen": "{{Dimensione|80%|",
     "tagClose": "}}",
     "sampleText": "Piccolo"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images.wikia.com/nonciclopedia/images/5/56/Button_big.png",
     "speedTip": "Grande",
     "tagOpen": "{{Dimensione|125%|",
     "tagClose": "}}",
     "sampleText": "Grande"};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images4.wikia.nocookie.net/__cb20100806112820/nonciclopedia/images/e/ea/Button_align_left.png",
     "speedTip": "Align left",
     "tagOpen": '{{Allinea|left|',
     "tagClose": "}}",
     "sampleText": "Testo allineato a sinistra"};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images1.wikia.nocookie.net/__cb20100806112819/nonciclopedia/images/f/f7/Button_align_center.png",
     "speedTip": "Align center",
     "tagOpen": "{{Allinea|center|",
     "tagClose": "}}",
     "sampleText": "Testo centrato"};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images1.wikia.nocookie.net/__cb20100806112825/nonciclopedia/images/a/a5/Button_align_right.png",
     "speedTip": "Align right",
     "tagOpen": '{{Allinea|right|',
     "tagClose": "}}",
     "sampleText": "Testo allineato a destra"};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images3.wikia.nocookie.net/__cb20100806112827/nonciclopedia/images/1/15/Button_colonne.png",
     "speedTip": "Testo in colonne",
     "tagOpen": "{{Colonne|col=2|",
     "tagClose": "}}\n",
     "sampleText": "Inserire qui il testo per le colonne"};

   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://img829.imageshack.us/img829/5043/buttonnoninclude.png",
     "speedTip": "<noinclude>",
     "tagOpen": "<noinclude>",
     "tagClose": "</noinclude>",
     "sampleText": "Non includere"};

 mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://img9.imageshack.us/img9/7229/buttonincludeonly.png",
     "speedTip": "<includeonly>",
     "tagOpen": "<includeonly>",
     "tagClose": "</includeonly>",
     "sampleText": "Includi solo qui"};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images1.wikia.nocookie.net/nonciclopedia/images/f/f6/Button_Citnec.png",
     "speedTip": "Citazione necessaria",
     "tagOpen": "{{Citnec|",
     "tagClose": "}}",
     "sampleText": "Inserire qui la citazione"};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images4.wikia.nocookie.net/nonciclopedia/images/4/4a/Bottone_curiosità.png",
     "speedTip": "Curiosità",
     "tagOpen": "{" + "{Curiosità}}",
     "tagClose": "",
     "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/en/6/60/Button_insert_table.png",
     "speedTip": "Tabella",
     "tagOpen": '{| class="wikitable"\n|-\n',
     "tagClose": "\n|}",
     "sampleText": "! header 1\n! header 2\n! header 3\n|-\n| row 1, cell 1\n| row 1, cell 2\n| row 1, cell 3\n|-\n| row 2, cell 1\n| row 2, cell 2\n| row 2, cell 3"};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images4.wikia.nocookie.net/nonciclopedia/images/2/20/Button_censura2.png",
     "speedTip": "Censura",
     "tagOpen": "{{Censura|",
     "tagClose": "}}",
     "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/e/e8/Pulsante_unverified.png",
     "speedTip": "Colore",
     "tagOpen": "{{Colore|#Codice esadecimale|",
     "tagClose": "}}",
     "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/a/aa/Button_question.png",
     "speedTip": "Carattere",
     "tagOpen": "{{Carattere|Tipo di carattere|dim%|",
     "tagClose": "}}",
     "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/5/56/Button_big.png",
     "speedTip": "Dimensione",
     "tagOpen": "{{Dimensione|dim%|",
     "tagClose": "}}",
     "sampleText": "Testo"};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/en/c/c8/Button_redirect.png",
     "speedTip": "Redirect",
     "tagOpen": "#REDIRECT [[",
     "tagClose": "]]",
     "sampleText": "Nome pagina"};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images1.wikia.nocookie.net/__cb20100806112828/nonciclopedia/images/7/75/Button_ok.png",
     "speedTip": "OK",
     "tagOpen": "{" + "{OK}}",
     "tagClose": "",
     "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images2.wikia.nocookie.net/__cb20100806112827/nonciclopedia/images/f/f7/Button_ko.png",
     "speedTip": "KO",
     "tagOpen": "{" + "{KO}}",
     "tagClose": "",
     "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/7/74/Button_comment.png",
     "speedTip": "Commento",
     "tagOpen": "<!-- ",
     "tagClose": " -->",
     "sampleText": "Inserisci qui il testo"};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://images4.wikia.nocookie.net/__cb20100806112826/nonciclopedia/images/2/23/Button_code.png",
     "speedTip": "Inserisci il codice",
     "tagOpen": "<code>",
     "tagClose": "</code>",
     "sampleText": "Inserisci qui il codice"};

mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/7/79/Button_reflink.png",
     "speedTip": "Inserisci la nota nel testo",
     "tagOpen": "<ref>",
     "tagClose": "</ref>",
     "sampleText": "Inserisci qui il testo della nota"};

mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteCassetto;

mwCustomEditButtons[mwCustomEditButtons.length] = pulsanteManuali;
}

/* Verifica firma - Nuova versione */
function VF() {
	if(!$('#toolbar').length) {
		return;
	}
	if(wgCurRevisionId) {
		mwEditButtons[9].tagOpen = '--~~' + '~~{{VF|' + wgCurRevisionId + '}' + '}';
	}
	else {
		mwEditButtons[9].tagOpen = '--~~' + '~~{{VF|}' + '}';
	}
}
hooksCustom.push([VF, []]);

/* FakeMSN */
addOnloadHook (function () {
	if (wgAction != 'view' || wgPageName != "Utente:Zazjlops/sandbox") return false;
	var httpRequest;
	if (window.XMLHttpRequest) { // Mozilla, Safari, ...
	    httpRequest = new XMLHttpRequest();
	} else if (window.ActiveXObject) { // IE
	    httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
	}
	httpRequest.onreadystatechange = function () { FakeMSN(httpRequest); };
	httpRequest.open('GET', "http://nonciclopedia.wikia.com/api.php?action=parse&page=Utente:Zazjlops/FakeMSN&prop=text&format=xml", true);
	httpRequest.send('');
	return;
});

function FakeMSN(o) {
	if (o.readyState != 4) return;
	if (o.status < 199 || o.status > 300) return false;
	var box = document.createElement('div');
	box.id = "FakeMSN";
	box.innerHTML = o.responseXML.getElementsByTagName('text').item(0).firstChild.data;
	box.style.position = 'fixed';
	box.style.right = "0px";
	document.getElementById("bodyContent").appendChild(box);
	const dT = 7; /* ritardo tra due scatti */
	const Scatti = 10; /* numero di scatti */
	const Intervallo = 10000; /* tempo tra un popup e l'altro */
	const Durata = 6000; /* tempo di apertura di un popup */
	box.style.display = 'block';
	height = box.scrollHeight;
	box.style.bottom = '-' + height + 'px';
	function slide_up() {
		Slide(box, 2, height, Scatti, dT, 0 - height, false);
		return;
		}
	function slide_down() {
		Slide(box, 2, height, Scatti, dT, 0, true);
		return;
		}
	slide_up();
	setTimeout(slide_down, Durata);
	setInterval(slide_up, Intervallo);
	setTimeout(function() {setInterval(slide_down, Intervallo); return;}, Durata);
	return;
}

/* ------------------------------------------ Link in basso ------------------------------------------ */
/* Link al DPL Restauro */
function createDPLlink() {
  var menuList = document.getElementById('p-personal').getElementsByTagName('ul')[0];
  var newLi = document.createElement('li');
  newLi.setAttribute('id', 'pt-DPLlink');
  newLi.innerHTML = '<a href="http://nonciclopedia.wikia.com/wiki/Nonciclopedia:Progetto_Restauro/DPLMonitor/CFTemplate" title="Controlla il lavoro ancora da fare! [alt-shift-1]" accesskey="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>';
  menuList.appendChild(newLi);
}
addOnloadHook(createDPLlink);

/* Link al Memo */
function createMemolink() {
  var menuList = document.getElementById('p-personal').getElementsByTagName('ul')[0];
  var newLi = document.createElement('li');
  newLi.setAttribute('id', 'pt-Memolink');
  newLi.innerHTML = '<a href="http://nonciclopedia.wikia.com/wiki/Utente:Nonciclopediologo/Memo" title="Guarda i memo! [alt-shift-2]" accesskey="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>';
  menuList.appendChild(newLi);
}
addOnloadHook(createMemolink);

/* Link al numero di EDIT */
function createEDITlink() {
  var menuList = document.getElementById('p-personal').getElementsByTagName('ul')[0];
  var newLi = document.createElement('li');
  newLi.setAttribute('id', 'pt-EDITlink');
  newLi.innerHTML = '<a href="http://nonciclopedia.wikia.com/wiki/Speciale:Editcount/Nonciclopediologo" title="Numero di cazzate inserite su Nonciclopedia! [alt-shift-3]" accesskey="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>';
  menuList.appendChild(newLi);
}
addOnloadHook(createEDITlink);

/* Link alla pagina BAN */
function createBanlink() {
  var menuList = document.getElementById('p-personal').getElementsByTagName('ul')[0];
  var newLi = document.createElement('li');
  newLi.setAttribute('id', 'pt-Banlink');
  newLi.innerHTML = '<a href="http://nonciclopedia.wikia.com/wiki/Nonciclopedia:Vandali_da_bannare" title="Banna il vandalo [alt-shift-4]" accesskey="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>';
  menuList.appendChild(newLi);
}
addOnloadHook(createBanlink);
/* ------------------------------------------ Link in basso ------------------------------------------ */


/*Funzione addLoadEvent  ----------------------- Prelevati da Wikipedia -------------------- */
function addLoadEvent( f) { addOnloadHook( f); return; }

/* Tab Ultima modifica *** Prelevato da Wikipedia*/
function lastEdit(){
    if(!$('ca-history'))
        return;
    var newLink = wgServer + wgScript + '?title=' + wgPageName + '&diff=0';
    addPortletLink('p-cactions', newLink, 'Mod 0', 'ca-ledit', 'Ultima modifica', 'u');
}
addLoadEvent(lastEdit);

/* Cassetto caratteri modifica aperto */
addOnloadHook(function () {
	if (wgAction != 'edit') return;
	collapseTable(0);
	return;
});


/* Aggiunta advancededit */
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'
+ '&action=raw&ctype=text/javascript"></' + 'script>');

/* To Top */
function ToTop(){

var scrolltotop={
	//startline: Integer. Number of pixels from top of doc scrollbar is scrolled before showing control
	//scrollto: Keyword (Integer, or "Scroll_to_Element_ID"). How far to scroll document up when control is clicked on (0=top).
	setting: {startline:100, scrollto: 0, scrollduration:1000, fadeduration:[500, 100]},
	controlHTML: '<img src="http://img31.imageshack.us/img31/7153/arrowv.png" style="width:20px; height:20px;" />', //HTML for control, which is auto wrapped in DIV w/ ID="topcontrol"
	controlattrs: {offsetx:1325, offsety:28}, //offset of control relative to right/ bottom of window corner
	anchorkeyword: '#top', //Enter href value of HTML anchors on the page that should also act as "Scroll Up" links

	state: {isvisible:false, shouldvisible:false},

	scrollup:function(){
		if (!this.cssfixedsupport) //if control is positioned using JavaScript
			this.$control.css({opacity:0}) //hide control immediately after clicking it
		var dest=isNaN(this.setting.scrollto)? this.setting.scrollto : parseInt(this.setting.scrollto)
		if (typeof dest=="string" && jQuery('#'+dest).length==1) //check element set by string exists
			dest=jQuery('#'+dest).offset().top
		else
			dest=0
		this.$body.animate({scrollTop: dest}, this.setting.scrollduration);
	},

	keepfixed:function(){
		var $window=jQuery(window)
		var controlx=$window.scrollLeft() + $window.width() - this.$control.width() - this.controlattrs.offsetx
		var controly=$window.scrollTop() + $window.height() - this.$control.height() - this.controlattrs.offsety
		this.$control.css({left:controlx+'px', top:controly+'px'})
	},

	togglecontrol:function(){
		var scrolltop=jQuery(window).scrollTop()
		if (!this.cssfixedsupport)
			this.keepfixed()
		this.state.shouldvisible=(scrolltop>=this.setting.startline)? true : false
		if (this.state.shouldvisible && !this.state.isvisible){
			this.$control.stop().animate({opacity:1}, this.setting.fadeduration[0])
			this.state.isvisible=true
		}
		else if (this.state.shouldvisible==false && this.state.isvisible){
			this.$control.stop().animate({opacity:0}, this.setting.fadeduration[1])
			this.state.isvisible=false
		}
	},
	
	init:function(){
		jQuery(document).ready(function($){
			var mainobj=scrolltotop
			var iebrws=document.all
			mainobj.cssfixedsupport=!iebrws || iebrws && document.compatMode=="CSS1Compat" && window.XMLHttpRequest //not IE or IE7+ browsers in standards mode
			mainobj.$body=(window.opera)? (document.compatMode=="CSS1Compat"? $('html') : $('body')) : $('html,body')
			mainobj.$control=$('<div id="topcontrol">'+mainobj.controlHTML+'</div>')
				.css({position:mainobj.cssfixedsupport? 'fixed' : 'absolute', bottom:mainobj.controlattrs.offsety, right:mainobj.controlattrs.offsetx, opacity:0, cursor:'pointer'})
				.attr({title:'Torna a inizio pagina'})
				.click(function(){mainobj.scrollup(); return false})
				.appendTo('body')
			if (document.all && !window.XMLHttpRequest && mainobj.$control.text()!='') //loose check for IE6 and below, plus whether control contains any text
				mainobj.$control.css({width:mainobj.$control.width()}) //IE6- seems to require an explicit width on a DIV containing text
			mainobj.togglecontrol()
			$('a[href="' + mainobj.anchorkeyword +'"]').click(function(){
				mainobj.scrollup()
				return false
			})
			$(window).bind('scroll resize', function(e){
				mainobj.togglecontrol()
			})
		})
	}
}

scrolltotop.init()
}
addOnloadHook(ToTop);


// ================================================================================
// START Automated deletion button script system
// ================================================================================
// Adds customizable one-click deletion buttons to any deletable page.
if(wgNamespaceNumber != -1) addOnloadHook(addDeleteButtons)
function addDeleteButtons() {
  if(!document.getElementById('ca-delete')) return
  var url=document.getElementById('ca-delete').firstChild.href
  if(document.getElementById('content').innerHTML.indexOf('submitdelete')!=-1) {
    /* alert('Attenzione: È stato trovato un link &submitdelete. Attento a dove clicchi!'); */
  }
  if(wgNamespaceNumber == 6) addPortletLink('p-cactions', url + '&submitdelete=true&wpReason=' + encodeURIComponent('Cancellazione veloce') ,'elimina veloce','ca-delete1');
}

addOnloadHook(checkdelete);
function checkdelete() {
  if(queryString('submitdelete')=='true') { 
    var btn = (document.getElementById('mw-filedelete-submit')) ? document.getElementById('mw-filedelete-submit') : document.getElementById('wpConfirmB')
    btn.click();
  }
}

function queryString(p) {
  var re = RegExp('[&?]' + p + '=([^&]*)');
  var matches;
  if (matches = re.exec(document.location)) {
    try { 
      return decodeURI(matches[1]);
    } catch (e) {
    }
  }
  return null;
}
// ================================================================================
// END Automated deletion button script system
// ================================================================================

// ==UserScript==
// @name           nonciclopedia
// @namespace      Genuzzo
// @include        http://nonciclopedia.wikia.com/*
// ==/UserScript==
function clockInit() {
  my_div = document.getElementById("searchform");
  my_div.innerHTML = '<div id="orologio" style="color:darkblue; font-weight:bold; position:relative; right:3px; top:2px;"></div>' + my_div.innerHTML;
  window.orologio=document.getElementById('orologio');
  setInterval(benv, 1000);
}
 
function benv() {
  var now = new Date();
  h=now.getHours();
  m=now.getMinutes();
  s=now.getSeconds();
  if(s<=9) s="0"+s;
  if(m<=9) m="0"+m;
  if(h<=9) h="0"+h;
  time=h+":"+m+":"+s;
  orologio.innerHTML = time;
}

addOnloadHook(clockInit);


/* Funzione add or remove to Sidebar */
function ModifySidebar(action, section, name, link) {
    try {
        switch (section) {
          case "languages":
            var target = "p-lang";
            break;
          case "toolbox":
            var target = "p-tb";
            break;
          case "navigation":
            var target = "p-navigation";
            break;
          default:
            var target = "p-" + section;
            break;
        }
 
        if (action == "add") {
            var node = document.getElementById(target)
                               .getElementsByTagName('div')[0]
                               .getElementsByTagName('ul')[0];
 
            var aNode = document.createElement('a');
            var liNode = document.createElement('li');
 
            aNode.appendChild(document.createTextNode(name));
            aNode.setAttribute('href', link);
            liNode.appendChild(aNode);
            liNode.className='plainlinks';
            node.appendChild(liNode);
        }
 
        if (action == "remove") {
            var list = document.getElementById(target)
                               .getElementsByTagName('div')[0]
                               .getElementsByTagName('ul')[0];
 
            var listelements = list.getElementsByTagName('li');
 
            for (var i = 0; i < listelements.length; i++) {
                if (listelements[i].getElementsByTagName('a')[0].innerHTML == name ||
                    listelements[i].getElementsByTagName('a')[0].href == link) {
 
                    list.removeChild(listelements[i]);
                }
            }
        }
 
    } catch(e) {
      // lets just ignore what's happened
      return;
    }
}
 
function CustomizeModificationsOfSidebar() {
    //adds [[Speciale:Blocca]] from toolbox
    ModifySidebar("add", "toolbox", "Pannello di controllo", "http://nonciclopedia.wikia.com/index.php?title=Speciale:AdminDashboard&tab=advanced");
    //adds from toolbox
    ModifySidebar("add", "navigation", "LiveRC", "http://nonciclopedia.wikia.com/wiki/Nonciclopedia:LiveRC");
    ModifySidebar("add", "navigation", "Monobook CSS", "http://nonciclopedia.wikia.com/wiki/Utente:Nonciclopediologo/monobook.css");
    //adds from toolbox
    ModifySidebar("add", "navigation", "Monobook JS", "http://nonciclopedia.wikia.com/wiki/Utente:Nonciclopediologo/monobook.js");
    //adds from toolbox
    ModifySidebar("add", "navigation", "Wikipedia IT",  "http://it.wikipedia.org/wiki/" + wgPageName);
    ModifySidebar("add", "navigation", "Wikipedia EN", "http://en.wikipedia.org/wiki/" + wgPageName);
    ModifySidebar("add", "navigation", "Uncyclopedia", "http://uncyclopedia.wikia.com/wiki/" + wgPageName);
    ModifySidebar("add", "navigation", "PDF Web2PDF", "http://www.web2pdfconvert.com/convert.aspx");
    ModifySidebar("add", "navigation", "PDF Printfreindly", "http://www.printfriendly.com/print?url=http://nonciclopedia.wikia.com/wiki/" + wgPageName);


    //removes [[Special:Upload]] from toolbox
    //ModifySidebar("remove", "toolbox", "Upload file", "http://en.wikipedia.org/wiki/Special:Upload");

}
 
addOnloadHook(CustomizeModificationsOfSidebar);


/* Add label User pages */

addOnloadHook(function() {
  if (wgTitle.indexOf("/") != -1 || document.title.indexOf("- History -") != -1)  //no subpages or history
     return;
  if (wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk") {
     var username = encodeURIComponent( wgTitle );
     addPortletLink("p-cactions", wgServer + "/wiki/Special:Contributions/" + username, "Contri", "ca-contrib", "Contributi utente");
     addPortletLink("p-cactions", wgServer + "/wiki/Special:Editcount/" + username, "Edit", "ca-editcount", "Numero di contributi divisi per Namespace");
     addPortletLink("p-cactions", wgServer + "/index.php?title=Special:Log&type=move&user=" + username, "Moves", "ca-pagemoves", "Pagine spostate dall'utente");
     addPortletLink("p-cactions", wgServer + "/index.php?title=Special:Log&type=block&page=User:" + username, "Ban", "ca-blog", "Ban ricevuti dall'utente");
     addPortletLink("p-cactions", wgServer + "/index.php?title=Special:Prefixindex&from=" + username + "&namespace=2", "SP", "", "Lista delle pagine in questo Userspace");
     /* addPortletLink("p-cactions", wgServer + "/index.php?title=Special:Log&type=block&user=" + username, "Blocks given", "", "Blocks by this user");
     addPortletLink("p-cactions", wgServer + "/index.php?title=Special:Log&type=protect&user=" + username, "Protections", "", "Protections by this user");
     addPortletLink("p-cactions", wgServer + "/index.php?title=Special:Log&type=delete&user=" + username, "Deletions", "", "Deletions by this user"); */
  }
});

// FUNZIONI PER INGRANDIRE/RIMPICCIOLIRE IL CARATTERE DEI TESTI
//dimensione di default 100%
var dimensioneCarattere = 100;
 
function ingrandisciCarattere() {
  if (dimensioneCarattere < 400) dimensioneCarattere += 10;
  $("#bodyContent").css("font-size", dimensioneCarattere+"%");
}
 
function riduciCarattere() {
  if (dimensioneCarattere > 30) dimensioneCarattere -= 10;
  $("#bodyContent").css("font-size", dimensioneCarattere+"%");
}
 
 $(document).ready( function() {
  var d = '<div class="noprint" style="position:fixed; bottom:25px; right:0px; z-index:200"><a href="javascript:ingrandisciCarattere()"><img src="http://images1.wikia.nocookie.net/nonciclopedia/images/6/6f/Lente_di_ingrandimento_-_Zoom_in.png" title="Ingrandisci carattere" alt="Ingrandisci carattere" /></a> <a href="javascript:riduciCarattere()"><img src="http://images1.wikia.nocookie.net/nonciclopedia/images/b/b8/Lente_di_ingrandimento_-_Zoom_out.png" title="Riduci carattere" alt="Riduci carattere" /></a></div>';
  $("#jump-to-nav").before(d);
 });

/* *************** Nonciclopedia:Toolbar *************** */
/* Funzione preferiti */
$(document).ready(function() {
    if(wgUserName) {
        $.get('/api.php?action=parse&page=Utente:' + wgUserName + '%2FPreferiti&format=xml', function(data) {
            if($(data).find('parse').attr('revid') != '0') {
                $('#toolbarpreferiti').html($(data).find('parse').find('text').text());
            }
        }, 'xml');
    }
});

/* Laboratorio prove */


/* --- Autosort --- */
function autosort()
{
	$('table.sortable[class*="autosort="]').each(function() {
		var $this = $(this);
		var matched = /(?:^| )autosort=([0-9]+),(a|d)(?: |$)/.exec($this.attr('class'));
		$this.tablesorter({
			sortList: [[matched[1] - 1, ((matched[2] === 'd')? 1: 0)]],
		});
		/*var row = $this.find('.sortheader').get(matched[1] - 1);
		for(var i = 0; i < ((matched[2] === 'd')? 2: 1); i++) {
			ts_resortTable(row);
		}*/
	});
}
addOnloadHook(autosort);

/* --- Popup per l'inserimento della firma - Prelevato da http://runescape.wikia.com/wiki/User:Tyilo/signature.js --- */
addOnloadHook(function()
{
    if(wgAction == 'edit' || wgAction == 'submit')
    {
        if(wgPageName.match(/^[^:]*Discussioni:/i) || wgPageName.match(/^Discussioni_utente:/))
    	{
    	    $('#wpSave').click(function(e)
    	    {
    	    	if(typeof enforceSign === 'undefined')
    	    	{
    	    	    enforceSign = true;
    	    	}
 	 	var text = $('#cke_wpTextbox1 iframe').contents().find('#bodyContent').text() || $('#wpTextbox1').val();
    	    	if(enforceSign && !$('#wpMinoredit').is(':checked') && !text.replace(/(<nowiki>.*?<\/nowiki>)/g, '').match('~~~') && !window.location.search.match(/(?:\?|&)undo=/))
    	        {
    	            if(!confirm('A quanto pare ti sei dimenticato di cliccare il tasto per la firma, niubbo!\nSei sicuro di voler continuare?\nMeglio se firmi altrimenti non sappiamo dove mandare la Polpost'))
    	            {
    	                e.preventDefault();
    	            }
    	    	}
    	    });
    	}
    }
});

/* Tooltip references */
window.pg || $(document).ready( function($) {

    // Make sure we are in article, project, or help namespace
    if ( wgCanonicalNamespace === '' || wgCanonicalNamespace === 'Project' || wgCanonicalNamespace === 'Help' ) {
        function toggleRT(o){
            mw.loader.using("jquery.cookie",function(){
                    $.cookie("RTsettings",o+"|"+ settings[1] + "|" + settings[2], {path:"/",expires:90});
                    location.reload();
            })
        }
        var settings = document.cookie.split("RTsettings=")[1];
        settings = settings ? settings.split(";")[0].split("%7C") : [1, 200, +("ontouchstart" in document.documentElement)];
        if( settings[0] == 0 ) {
            var footer = $("#footer-places, #f-list");
            if( footer.length === 0 ) {
                    footer = $("#footer li").parent();
            }
            footer.append($("<li>").append($("<a>").text("Abilita i tooltip").attr("href","javascript:(function(){})()").click(function(){toggleRT(1)})));
            return;
        }
        var isTouchscreen = +settings[2],
            timerLength = isTouchscreen ? 0 : +settings[1],
            settingsMenu;
        $(".reference").each( function() {
            var tooltipNode, hideTimer, showTimer, checkFlip = false;
            function findRef( h ){
                    h = h.firstChild.getAttribute("href"); h = h && h.split("#"); h = h && h[1];
                    h = h && document.getElementById( h );
                    h = h && h.nodeName == "LI" && h;
                    return h;
            }
            function hide( refLink ){
                    if( tooltipNode && tooltipNode.parentNode == document.body ) {
                            hideTimer = setTimeout( function() {
                                    $(tooltipNode).animate({opacity: 0}, 100, function(){ document.body.removeChild( tooltipNode ) })
                            }, isTouchscreen ? 16 : 100)
                    } else {
                            var h = findRef( refLink );
                            h && (h.style.border = "");
                    }
            }
            function show(){
                    if( !tooltipNode.parentNode || tooltipNode.parentNode.nodeType === 11 ){
                            document.body.appendChild( tooltipNode );
                            checkFlip = true;
                    }
                    $(tooltipNode).stop().animate({opacity: 1}, 100)
                    clearTimeout( hideTimer );
            }
            function openSettingsMenu(){
                    if( settingsMenu ) {
                            settingsMenu.dialog( "open" );
                    } else {
                            settingsMenu = $("<form>").append(
                                    $("<button>").css("width","100%").text("Disabilita i tooltip").button().click(function(){toggleRT(0)}),
                                    $("<br>"),
                                    $("<small>").text("Una volta disabilitati, i tooltip delle note possono venire riabilitati grazie ad un link posto in fondo ad ogni pagina."),
                                    $("<hr>"),
                                    $("<label>").text("Tempo prima dell'apparizione del tooltip (in millisecondi): ").append($("<input>").attr({"type":"number","value":settings[1],step:50,min:0,max:5000})),
                                    $("<br>"),
                                    $("<span>").text("I tooltip vengono attivati tramite:"),
                                    $("<label>").append(
                                            $("<input>").attr({"type":"radio", "name":"RTActivate", "checked":settings[2]==0&&"checked", "disabled":"ontouchstart" in document.documentElement&&"disabled"}),
                                            "sosta del cursore sulla nota"
                                    ),
                                    $("<label>").append(
                                            $("<input>").attr({"type":"radio", "name":"RTActivate", "checked":settings[2]==1&&"checked"}),
                                            "click sulla nota"
                                    )
                            ).submit(function(e){e.preventDefault()}).dialog({modal:true,width:500,title:"Preferenze",buttons:{"Salva le preferenze":function(){
                                    var a = this.getElementsByTagName("input"),
                                            b = +a[0].value;
                                    $.cookie("RTsettings","1|"+ (b > -1 && b < 5001 ? b : settings[1]) + (a[1].checked ? "|0" : "|1"), {path:"/",expires:90});
                                    location.reload();
                            }}});
                    }
            }
            $(this)[ isTouchscreen ? 'click' : 'hover' ](function( e ){
                    var _this = this;
                    if( isTouchscreen ) {
                            e.preventDefault();
                            (tooltipNode && tooltipNode.parentNode == document.body) || setTimeout( function(){
                                    $( document.body ).on("click touchstart", function( e ) {
                                            e = e || event;
                                            e = e.target || e.srcElement;
                                            for( ; e && !$( e ).hasClass( "referencetooltip" ) ; )
                                                    e = e.parentNode;
                                            if( !e ){
                                                    clearTimeout( showTimer );
                                                    hide( _this );
                                                    $(document.body).off("click touchstart", arguments.callee)
                                            }
                                    })
                            }, 0);
                    }
                    showTimer && clearTimeout( showTimer );
                    showTimer = setTimeout( function() {
                            var h = findRef( _this );
                            if( !h ){return};
                            if( !isTouchscreen && ( window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0 ) + $(window).height() > $( h ).offset().top + h.offsetHeight ) {
                                    h.style.border = "#080086 2px solid";
                                    return;
                            }
                            if(!tooltipNode){
                                    tooltipNode = document.createElement("ul");
                                    tooltipNode.className = "referencetooltip";
                                    var c = tooltipNode.appendChild( h.cloneNode( true ) );
                                    try {
                                            if( c.firstChild.nodeName != "A" ) {
                                                    while( c.childNodes[1].nodeName == "A" && c.childNodes[1].getAttribute( "href" ).indexOf("#cite_ref-") !== -1 ) {
                                                            do { c.removeChild( c.childNodes[1] ) } while ( c.childNodes[1].nodeValue == " " );
                                                    }
                                            }
                                    } catch (e) { mw.log(e) }
                                    c.removeChild( c.firstChild );
                                    $( tooltipNode.firstChild.insertBefore( document.createElement( "span" ), tooltipNode.firstChild.firstChild ) ).addClass("RTsettings").attr("title", "Preferenze").click(function(){
                                            mw.loader.using(["jquery.cookie","jquery.ui.dialog"], openSettingsMenu);
                                    })
                                    tooltipNode.appendChild( document.createElement( "li" ) );
                                    isTouchscreen || $(tooltipNode).hover(show, hide);
                            }
                            show();
                            var o = $(_this).offset(), oH = tooltipNode.offsetHeight;
                            $(tooltipNode).css({top: o.top - oH, left: o.left - 7 });
                            if( tooltipNode.offsetHeight > oH ) { // is it squished against the right side of the page?
                                    $(tooltipNode).css({left:'auto',right:0});
                                    tooltipNode.lastChild.style.marginLeft = (o.left - tooltipNode.offsetLeft) + "px";
                            }
                            if( checkFlip ) {
                                    if( o.top < tooltipNode.offsetHeight + ( window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0 ) ) { // is part of it above the top of the screen?
                                            $(tooltipNode).addClass("RTflipped").css({top: o.top + 12});
                                    } else if( tooltipNode.className === "referencetooltip RTflipped" ) { // cancel previous
                                            $(tooltipNode).removeClass("RTflipped");
                                    }
                                    checkFlip = false;
                            }
                    }, timerLength);
            }, isTouchscreen ? undefined : function(){clearTimeout(showTimer); hide(this); } )
 
        } );
        
    }

} );



if(wgPageName == 'Nonciclopedia:Walk_of_Shame/NonNotizie/Votazioni2012/Votazioni_Flash') $(function() {
  window.voteTable = {length: 0};
  $('.VotingTable').each(function() {
    voteTable[voteTable.length++] = { //quick hack: contatore direttamente nell'oggetto
      text: $(this).find('tbody > tr:nth(0) > td > b').html(),
      vote: (function($_this) {
        var vote = 0;
        var voteLis = $_this.find('tbody > tr:nth(3) > td > ul > li');
        voteLis.each(function() {
          vote += parseInt($(this).html().split('+')[1].split('-')[0]);
        });
        return vote / parseFloat(voteLis.length); //per farlo float uso parseFloat sul divisore
      })($(this))
    }
  });
  voteTable = $.makeArray(voteTable); //che cazzo sto facendo???
  voteTable.sort(function(a,b) {return (a.vote > b.vote) ? 1 : ((b.vote > a.vote) ? -1 : 0);} );
});