Utente:Genuzzo/monobook.js: differenze tra le versioni
Vai alla navigazione
Vai alla ricerca
Contenuto aggiunto Contenuto cancellato
Genuzzo (rosica | curriculum) Nessun oggetto della modifica |
Genuzzo (rosica | curriculum) Nessun oggetto della modifica |
||
(259 versioni intermedie di uno stesso utente non sono mostrate) | |||
Riga 1: | Riga 1: | ||
/* |
|||
/* function initSnake() { |
|||
function updateNoncigioco() { |
|||
w = window; |
|||
time -= 1; |
|||
w.immaginePapocchio = document.createElement('img'); |
|||
updateNoncigiocoBar(); |
|||
immaginePapocchio.src = 'http://images4.wikia.nocookie.net/__cb20111220151347/nonciclopedia/images/9/9f/Papocchio_piccolo_29x25.png'; |
|||
if(time <= 0) { |
|||
$(document.body).append(immaginePapocchio); |
|||
youlost(); |
|||
} |
|||
} |
|||
for(i = 0; i < 3; i++) snake[i] = new Array(0, i); |
|||
if($('#canvassneic').length) { |
|||
document.onkeydown = function(event) { |
|||
var keyCode; |
|||
if(event == null) { |
|||
keyCode = window.event.keyCode; |
|||
} |
|||
else { |
|||
keyCode = event.keyCode; |
|||
} |
|||
switch(keyCode) { |
|||
case 37: |
|||
dir = 'left'; |
|||
break; |
|||
case 38: |
|||
dir = 'up'; |
|||
break; |
|||
function youlost() { |
|||
case 39: |
|||
$('#noncigiocoyoulost').html($('#noncigiocoyoulost').html() + '<br>Comunque la risposta esatta era "' + rightAnswers[Math.floor(Math.random() * rightAnswers.length)] + '".'); |
|||
dir = 'right'; |
|||
clearInterval(updateNoncigiocoInterval); |
|||
break; |
|||
$('#noncigiococontainer').remove(); |
|||
$('#noncigiocoyoulost').css('display', 'block').remove().appendTo('body'); |
|||
case 40: |
|||
resizeNoncigiococontainer(); |
|||
dir = 'down'; |
|||
break; |
|||
default: |
|||
break; |
|||
} |
|||
} |
|||
w.canvassneic = document.createElement('canvas'); |
|||
$('#canvassneic').html('').append(canvassneic); |
|||
immaginePapocchio.onload = function() {setInterval(drawSnake, 300);}; |
|||
} |
|||
} |
} |
||
function noncigiocoYesNo(yesNo) { |
|||
if(currentQuestion.r == -1) youlost(); |
|||
else if(yesNo == 'yes' && currentQuestion.r == 0) youlost(); |
|||
function moveSnakePoint() { |
|||
if( |
else if(yesNo == 'no' && currentQuestion.r == 1) youlost(); |
||
else createNoncigiocoQuestion(); |
|||
else if(dir == 'down') snake[snake.length - 1][1]++; |
|||
else if(dir == 'right') snake[snake.length - 1][0]++; |
|||
else snake[snake.length - 1][0]--; |
|||
} |
} |
||
function |
function createNoncigiocoQuestion() { |
||
var questions = [ |
|||
oldSnake = snake.slice(0); |
|||
{question: "2+2 = 3?", r: 0}, |
|||
{question: "13 ore equivalgono ad un giorno?", r: 0}, |
|||
snake[i - 1] = oldSnake[i].slice(0); |
|||
{question: "Il cammello ha una gobba e mezzo?", r: 0}, |
|||
} |
|||
{question: "Il cane è il migliore amico dell'uomo?", r: 1}, |
|||
moveSnakePoint('down'); |
|||
{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 |
function updateNoncigiocoBar() { |
||
var bar = time / (lastTime + 10); |
|||
if (canvassneic.getContext) { |
|||
$('#noncigiocobarrow').css('width', Math.round(bar * 100) + "%").css('background-color', 'rgb(' + (Math.round(bar * 255) + ',') + (Math.round(255 - bar * 255) + ',') + '0)'); |
|||
moveSnake(); |
|||
var ctx = canvassneic.getContext("2d"); |
|||
ctx.fillStyle = "rgb(255,255,255)"; |
|||
ctx.fillRect(0, 0, 300, 150); |
|||
for(s = 0; s < snake.length; s++) { |
|||
ctx.drawImage(immaginePapocchio, snake[s][0] * 25, snake[s][1] * 29, 10, 10); |
|||
} |
|||
} |
|||
} |
} |
||
function resizeNoncigiococontainer() { |
|||
$('.noncigiococenter').each(function() { |
|||
addOnloadHook(initSnake); |
|||
var b = $(window); |
|||
var w = b.width(); |
|||
function createCookie(name,value,days) { |
|||
var h = b.height(); |
|||
var |
var cw = $(this).width(); |
||
var ch = $(this).height(); |
|||
var |
var l = (w - cw) / 2; |
||
var t = (h - ch) / 2; |
|||
} |
|||
$(this).css('top', t).css('left', l); |
|||
else var expires = ""; |
|||
}); |
|||
document.cookie = name+"="+value+expires+";path=/;"; |
|||
} |
} |
||
$(document).ready(function() { |
|||
if(wgPageName == 'Utente:Genuzzo/noncigioco' && wgAction == 'view') { |
|||
if(wgUserName) { |
|||
window.rightAnswers = ["tua madre", "tua sorella", "1.8928374E17", "due elevato alla dodicesima", "sticazzi", "eeeeeeeeh"]; |
|||
$.getJSON('http://nonciclopedia.wikia.com/api.php?action=query&prop=revisions&titles=Nonciclopedia:Dismissablenotice&rvprop=content|timestamp&format=json', function(data) { |
|||
$ |
$('#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() { |
|||
w.timestamp = val['revisions'][0]['timestamp']; |
|||
$(this).remove(); |
|||
$('#noncigiococontainer').css('display', 'block').remove().appendTo('body'); |
|||
w.message = val['revisions'][0]['*']; |
|||
$('#noncigiocoyes').click(function() { |
|||
if (message == '') message = 'undefined'; |
|||
noncigiocoYesNo('yes'); |
|||
}); |
|||
$('#noncigiocono').click(function() { |
|||
noncigiocoYesNo('no'); |
|||
}); |
|||
window.lastTime = 110; |
|||
window.currentQuestion = {}; |
|||
createNoncigiocoQuestion(); |
|||
window.updateNoncigiocoInterval = setInterval(updateNoncigioco, 50); |
|||
}); |
}); |
||
resizeNoncigiococontainer(); |
|||
if(message != 'undefined') { |
|||
$(window).resize(function() { |
|||
$.get('http://nonciclopedia.wikia.com/index.php?title=Nonciclopedia:Dismissablenotice&action=render', function(data) { |
|||
resizeNoncigiococontainer(); |
|||
$('#contentSub').after($('<div class="usermessage" style="display: block;">' + data + ' <small><a href="javascript:createCookie(\'gendn\', timestamp, 1000); $(\'.usermessage\').remove(); void(0);">(Cliccami per cancellare il messaggio)</a></small></div>')); |
|||
}); |
|||
} |
|||
} |
|||
}); |
}); |
||
*/ |
|||
//CATINSERT |
|||
ignorati = Array(); |
|||
ignorati[ignorati.length - 1] = 'Mestruolindo'; |
|||
function |
function catInsertUpdate() { |
||
$('. |
$('.catinsert a').each(function() { |
||
if(!$(this).data('c')) { |
|||
$(this).click(function(e) { |
|||
e.preventDefault(); |
|||
$('textarea:nth(0)').val($('textarea:nth(0)').val() + '[[Categoria:' + $(this).text() + ']]'); |
|||
$(this).parent().children().each(function() { |
|||
}); |
|||
$(this).data('c', 'a'); |
|||
if(mwuserlinkcount == 1) $(this).parent().parent().parent().hide(); |
|||
break; |
|||
} |
} |
||
}); |
|||
}); |
|||
} |
} |
||
function |
$(document).ready(function() { |
||
$('. |
if($('.catinsert').length > 0) { |
||
catInsertUpdate(); |
|||
setInterval(catInsertUpdate, 30); |
|||
if($(this).attr('title') == 'Utente:' + ignorati[i]) { |
|||
} |
|||
window.mwuserlinkcount = 0; |
|||
}); |
|||
$(this).parent().children().each(function() { |
|||
if($(this).attr('class') == 'mw-userlink') mwuserlinkcount++; |
|||
}); |
|||
if(mwuserlinkcount == 1) $(this).parent().parent().parent().show(); |
|||
break; |
|||
} |
|||
} |
|||
}); |
|||
} |
|||
function |
$(document).ready(function() { |
||
if(wgPageName == 'Utente:Genuzzo/catinsert') { |
|||
$('.mw-userlink').each(function() { |
|||
$('#bodyContent').prepend('<textarea />'); |
|||
$(this).parent().parent().parent().toggle(); |
|||
} |
} |
||
} |
}); |
||
//NO NIUBBY PLOX |
|||
function initHideUM() { |
|||
if(wgPageName == 'Speciale:UltimeModifiche') $('.mw-rc-label-legend').append($('<br><a href="javascript:hideIgnoratiInUM();">Nascondi ignorati</a> - <a href="javascript:showIgnoratiInUM();">Mostra ignorati</a> - <a href="javascript:toggleIgnoratiInUM();">Inverti tutti</a>')); |
|||
} |
|||
$(document).ready(function() { |
|||
addOnloadHook(initHideUM); |
|||
if(wgPageName == 'Speciale:CategorieRichieste') { |
|||
$('a:contains("Niubby di ")').parent().hide(); |
|||
} |
|||
}); |
|||
import_script((wgAction=='edit' || wgAction == 'submit'), "Nonciclopedia:Script/Searchbox.js"); |
|||
//Compare edits by Genuzzo |
|||
//USER LINKS |
|||
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.val().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.val().replace('.', ''))) - utenteuno)); |
|||
} |
|||
}); |
|||
} |
|||
}); |
|||
} |
|||
var toAddUserLink = []; |
|||
function editsCompareWindow() { |
|||
$(document.body).append($('<div style="width: 300px; height: 200px; position: fixed; top: 30%; left: 30%; border: solid 5px #000; z-index: 99999; background-color: #DDD; padding: 5px;">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!!!1!!!" onclick="compareEdits();"><br><div id="comparautenti"></div><a href="javascript:$(this).parent().remove(); void(0);">Clicchete</a></div>')); |
|||
} |
|||
toAddUserLink.push('[[Categoria:'); |
|||
function createEditsButton() { |
|||
toAddUserLink.push('[[File:'); |
|||
var menuList = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; |
|||
var newLi = document.createElement('li'); |
|||
if(wgAction == 'edit' || wgAction == 'submit') { |
|||
newLi.setAttribute('id', 'ca-edits'); |
|||
$(document).ready(function() { |
|||
newLi.innerHTML = '<a href="javascript:editsCompareWindow();">EditsCompare</a>'; |
|||
$.each(toAddUserLink, function(i, v) { |
|||
menuList.appendChild(newLi); |
|||
$('#editform').before($('<a></a>').attr('href', '#').text(v).click(function(e) { |
|||
e.preventDefault(); |
|||
$('textarea:eq(0)').val($('textarea:eq(0)').val() + $(this).text()); |
|||
})).before(' | '); |
|||
}); |
|||
}); |
|||
} |
} |
||
addOnloadHook(createEditsButton); |
|||
import_script((wgPageName == "Nonciclopedia:LiveRC"), "Nonciclopedia:LiveRC/LiveRC.js"); */ |
|||
addOnloadHook(function() { |
|||
if(wgAction == 'edit') { |
|||
$('#p-cactions').css({ |
|||
'width': '100%', |
|||
'left': '0px', |
|||
'padding-left': '0px', |
|||
'top': '0px' |
|||
}); |
|||
$('#p-cactions .pBody').css({ |
|||
'margin': '41px 222px 0 160px' |
|||
}); |
|||
$('#p-personal .pBody').css({ |
|||
'background': '-moz-linear-gradient(center top , #FFFFFF 30%, #EAF5FD 150%) repeat scroll 0 0 transparent', |
|||
'padding': '0px 10px 0px 0px' |
|||
}); |
|||
$('#p-personal li').css({ |
|||
'background': 'none repeat scroll 0 0 transparent', |
|||
'margin-left': '0px', |
|||
}); |
|||
$('li#pt-userpage').css({ |
|||
'padding-left': '0px' |
|||
}); |
|||
} |
|||
}); |
Versione attuale delle 13:34, 30 set 2012
/*
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 = 110;
window.currentQuestion = {};
createNoncigiocoQuestion();
window.updateNoncigiocoInterval = setInterval(updateNoncigioco, 50);
});
resizeNoncigiococontainer();
$(window).resize(function() {
resizeNoncigiococontainer();
});
}
});
//CATINSERT
function catInsertUpdate() {
$('.catinsert a').each(function() {
if(!$(this).data('c')) {
$(this).click(function(e) {
e.preventDefault();
$('textarea:nth(0)').val($('textarea:nth(0)').val() + '[[Categoria:' + $(this).text() + ']]');
});
$(this).data('c', 'a');
}
});
}
$(document).ready(function() {
if($('.catinsert').length > 0) {
catInsertUpdate();
setInterval(catInsertUpdate, 30);
}
});
$(document).ready(function() {
if(wgPageName == 'Utente:Genuzzo/catinsert') {
$('#bodyContent').prepend('<textarea />');
}
});
//NO NIUBBY PLOX
$(document).ready(function() {
if(wgPageName == 'Speciale:CategorieRichieste') {
$('a:contains("Niubby di ")').parent().hide();
}
});
import_script((wgAction=='edit' || wgAction == 'submit'), "Nonciclopedia:Script/Searchbox.js");
//USER LINKS
var toAddUserLink = [];
toAddUserLink.push('[[Categoria:');
toAddUserLink.push('[[File:');
if(wgAction == 'edit' || wgAction == 'submit') {
$(document).ready(function() {
$.each(toAddUserLink, function(i, v) {
$('#editform').before($('<a></a>').attr('href', '#').text(v).click(function(e) {
e.preventDefault();
$('textarea:eq(0)').val($('textarea:eq(0)').val() + $(this).text());
})).before(' | ');
});
});
}
import_script((wgPageName == "Nonciclopedia:LiveRC"), "Nonciclopedia:LiveRC/LiveRC.js"); */
addOnloadHook(function() {
if(wgAction == 'edit') {
$('#p-cactions').css({
'width': '100%',
'left': '0px',
'padding-left': '0px',
'top': '0px'
});
$('#p-cactions .pBody').css({
'margin': '41px 222px 0 160px'
});
$('#p-personal .pBody').css({
'background': '-moz-linear-gradient(center top , #FFFFFF 30%, #EAF5FD 150%) repeat scroll 0 0 transparent',
'padding': '0px 10px 0px 0px'
});
$('#p-personal li').css({
'background': 'none repeat scroll 0 0 transparent',
'margin-left': '0px',
});
$('li#pt-userpage').css({
'padding-left': '0px'
});
}
});