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 |
||
(238 versioni intermedie di uno stesso utente non sono mostrate) | |||
Riga 1: | Riga 1: | ||
/* |
|||
function getTextNodesIn(node) { |
|||
function updateNoncigioco() { |
|||
var textNodes = [] |
|||
time -= 1; |
|||
updateNoncigiocoBar(); |
|||
if(time <= 0) { |
|||
youlost(); |
|||
} |
|||
} |
|||
function getTextNodes(node) { |
|||
function youlost() { |
|||
if (node.nodeType == 3) { |
|||
$('#noncigiocoyoulost').html($('#noncigiocoyoulost').html() + '<br>Comunque la risposta esatta era "' + rightAnswers[Math.floor(Math.random() * rightAnswers.length)] + '".'); |
|||
textNodes.push(node); |
|||
clearInterval(updateNoncigiocoInterval); |
|||
} else { |
|||
$('#noncigiococontainer').remove(); |
|||
for (var i = 0, len = node.childNodes.length; i < len; ++i) { |
|||
$('#noncigiocoyoulost').css('display', 'block').remove().appendTo('body'); |
|||
getTextNodes(node.childNodes[i]); |
|||
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 |
|||
getTextNodes(node); |
|||
return textNodes; |
|||
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() { |
$(document).ready(function() { |
||
if(wgPageName == 'Utente:Genuzzo/catinsert') { |
|||
$(getTextNodesIn(document.getElementById("body"))).each(function() { |
|||
$ |
$('#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' |
|||
}); |
|||
} |
|||
}); |
}); |
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'
});
}
});