Utente:Nonciclopediologo/funzioni.js
Questa pagina definisce alcuni parametri di aspetto e comportamento generale di tutte le pagine. Per personalizzarli vedi Aiuto:Stile utente.
Nota: dopo aver salvato è necessario pulire la cache del proprio browser per vedere i cambiamenti, e comunque qualche minuto di preghiera non guasta. Per Mozilla / Firefox / Safari: fare clic su Ricarica tenendo premuto il tasto delle maiuscole, oppure premere Ctrl-F5 o Ctrl-R (Command-R su Mac); per Chrome premere Ctrl-Shift-R (Command-Shift-R su un Mac); per Konqueror: premere il pulsante Ricarica o il tasto F5; per Opera può essere necessario svuotare completamente la cache dal menu Strumenti → Preferenze; per Internet Explorer: mantenere premuto il tasto Ctrl mentre si preme il pulsante Aggiorna o premere Ctrl-F5.
@@@@@@@ @@@ @@@@@@@@@@ @@@ @@@@@@@ @@@@@@@@ @@@@@@@ @@@@@@
@@@@@@@@ @@@ @@@@@@@@@@@ @@@ @@@@@@@ @@@@@@@@ @@@@@@@@ @@@@@@@@
!@@ @@! @@! @@! @@! @@! @@! @@! @@! @@@ @@! @@@
!@! !@! !@! !@! !@! !@! !@! !@! !@! @!@ !@! @!@
!@! !!@ @!! !!@ @!@ !!@ @!! @!!!:! @!@!!@! @!@ !@!
!!! !!! !@! ! !@! !!! !!! !!!!!: !!@!@! !@! !!!
:!! !!: !!: !!: !!: !!: !!: !!: :!! !!: !!!
:!: :!: :!: :!: :!: :!: :!: :!: !:! :!: !:!
::: ::: :: ::: :: :: :: :: :::: :: ::: ::::: ::
:: :: : : : : : : : :: :: : : : : : :
/* **************** Funzioni disattivate nel mono **************** */
/* Live preview */
/* addOnloadHook(function() { import_script((wgAction == 'edit'|| wgAction == 'submit'), "Nonciclopedia:Script/Anteprima.js");})*/
/* **************** Link in basso **************** */
/* Modifiche correlate al DPL Restauro ------------------- NON ATTIVO -------------------------------- */
/*function createRestlink() {
var menuList = document.getElementById('p-personal').getElementsByTagName('ul')[0];
var newLi = document.createElement('li');
newLi.setAttribute('id', 'pt-Restlink');
newLi.innerHTML = '<a href="http://nonciclopedia.wikia.com/index.php?title=Speciale:ModificheCorrelate&target=Utente:Nonciclopediologo/DPLModRest&hideminor=0&hidebots=1&limit=1000" title="Modifiche correlate al DPL restauro [alt-shift-4]" accesskey="1">Mod Rest</a>';
menuList.appendChild(newLi);
}
addOnloadHook(createRestlink); */
/* Ultime immagini caricate ------------------- NON ATTIVO -------------------------------- */
/*function createImglink() {
var menuList = document.getElementById('p-personal').getElementsByTagName('ul')[0];
var newLi = document.createElement('li');
newLi.setAttribute('id', 'pt-Imglink');
newLi.innerHTML = '<a href="http://nonciclopedia.wikia.com/wiki/Speciale:ImmaginiRecenti" title="Ultime immagini caricate [alt-shift-5]" accesskey="1">Nuovi file</a>';
menuList.appendChild(newLi);
}
addOnloadHook(createImglink); */
/* Modifica della sezione 0 *** Prelevato da Wikipedia ------------------- NON ATTIVO -------------------------------- */
/*
function addEditSection0(){
if(!$('ca-history'))
return;
var newLink = wgServer + wgScript + '?title=' + wgPageName + '&action=edit§ion=0';
addPortletLink('p-cactions', newLink, 'Sez. 0', 'ca-edit-0', 'Modifica la sezione 0');
}
addLoadEvent(addEditSection0); */
/* Funzione per la barra di modifica */
/*
function FastOpen() {
var Box = document.getElementById("searchBody");
if (!Box) return;
var form = document.createElement("form");
Box.appendChild(form);
form.action = "/index.php";
form.target = "_blank";
var c = document.createElement("input");
form.appendChild(c);
c.type = "text";
c.setAttribute('name', "title");
c.size = "18";
var menu = document.createElement("select");
form.appendChild(menu);
menu.setAttribute('name', "action");
menu.options[menu.length] = new Option("Modifica", "edit", true);
menu.options[menu.length] = new Option("Crono", "history");
var p = document.createElement("input");
p.type = "submit";
p.value = "Vai";
form.appendChild(p);
return;
}
addOnloadHook(FastOpen);
*/
/* Modifica nell'intestazione - Implementato da Sanji*/
/* function modificaIntro() {
if (wgAction != "edit" && wgAction != "submit" && wgNamespaceNumber != -1 && wgRestrictionEdit[0] != "sysop") {
var bodyContent = document.getElementById('bodyContent').innerHTML;
document.getElementById('bodyContent').innerHTML='<span class="editsection">[<a rel="nofollow" title="Modifica la sezione introduttiva" href="http://nonciclopedia.wikia.com/index.php?title=' + wgPageName +'&action=edit&section=0&editintro=MediaWiki:Editintro">modifica</a>]</span>' + bodyContent;
}
}
addOnloadHook(modificaIntro);
*/
/* Aggiunta searchbox mia versione*/
/* document.write('<script type="text/javascript" src="'
+ 'http://nonciclopedia.wikia.com/index.php?title=Utente:Nonciclopediologo/Searchbox.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); */
/* Aggiunta Lupin --- Rompe le scatole*/
/*
document.write('<script type="text/javascript" src="'
+ 'http://nonciclopedia.wikia.com/index.php?title=nonciclopedia:Monobook.js/strings-it.js'
+ '&action=raw&ctype=text/javascript"></script>');
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
*/
/* Modifiche alla pagina --- Controllare il funzionamento */
/* document.write('<script type="text/javascript" src="'
+ 'http://nonciclopedia.wikia.com/index.php?title=Utente:Nonciclopediologo/Modifiche.js'
+ '&action=raw&ctype=text/javascript"></script>'); */
/* NS Search */
/*
document.write('<script type="text/javascript" src="'
+ 'http://nonciclopedia.wikia.com/index.php?title=Utente:Nonciclopediologo/NamespaceSearch.js'
+ '&action=raw&ctype=text/javascript"></script>'); */
* WHOIS */
/*function whoisip() {
if(!document.getElementById) return;
var searchForm = document.getElementById("searchform");
var whoisForm=document.createElement('form');
whoisForm.action = 'http://www.dnsstuff.com/tools/whois.ch';
whoisForm.method - 'GET';
whoisForm.innerHTML = '<input accesskey="1" TYPE=text NAME=ip SIZE=16 class="std"><input TYPE=submit VALUE="WHOIS" class="send-btn">';
searchForm.appendChild(whoisForm);
};
addOnloadHook(whoisip);*/
/* Funzione per ritornare alle UM dopo un rollback */
/*
function rb2um() {
u = location.href;
if (u.indexOf("action=rollback")!=-1) {
location.href = "http://nonciclopedia.wikia.com/wiki/Speciale:UltimeModifiche";
}
}
addOnloadHook(rb2um); */
/* Segnala ad un Admin - Genuzzo */
/* function segnalaAdmin() {
var msg = prompt("Segnala ad un admin una cosa urgente, come un vandalo da bannare o nonciclopedia mezza distrutta da wikia. IMPORTANTE! NON USARLO PER FUTILITÀ, PEZZO DI MERDA.", "Banna tizio");
var pwd = prompt("Inserire la password.");
pic = new Image(1, 1);
pic.src = "http://genuzzu.altervista.org/ticket/segnala.php?msg=" + msg + "&pwd=" + pwd;
document.getElementById('bodyContent').addChild(pic);
}
function addSegnala() {
var ptsegnala = document.createElement('li');
ptsegnala.id = 'pt-segnala';
ptsegnala.innerHTML = '<a href="javascript:segnalaAdmin();">segnala</a>';
a = document.getElementById('p-personal').getElementsByTagName('ul')[0];
a.insertBefore(ptsegnala, a.firstChild);
}
addOnloadHook(addSegnala);
*/
//NO NIUBBY PLOX
/*
$(document).ready(function() {
if(wgPageName == 'Speciale:CategorieRichieste') {
$('a:contains("Niubby di ")').parent().hide();
}
}); */
/* Funzione per far nevicare su Nonci - Genuzzo */
/* 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);});
*/
/* Funzione CompareEdits - Genuzzo */
/*
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);
*/
/* NonciGioco - Genuzzo (mai finito) */
/*
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();
});
}
});
*/
/* 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;
}
*/
/* --- 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();
}
}
});
}
}
});
*/
/************** Funzione per il conteggio voti NonNotizie Flash ********************/
/*
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);} );
});
*/