Cimitero:MediaWiki:Common.js: differenze tra le versioni
Vai alla navigazione
Vai alla ricerca
Contenuto aggiunto Contenuto cancellato
Nessun oggetto della modifica |
Wedhro (rosica | curriculum) m (Wedhro ha spostato la pagina MediaWiki:Common.js a Cimitero:MediaWiki:Common.js senza lasciare redirect: è talmente pieno di cose che non funzionano o del tutto obsolete che faccio prima a ripartire da 0) |
||
(52 versioni intermedie di 8 utenti non mostrate) | |||
Riga 14: | Riga 14: | ||
var fadeDelay = 400; |
var fadeDelay = 400; |
||
var navigationBarShowDefault = 0; // Usato per cassetto |
var navigationBarShowDefault = 0; // Usato per cassetto |
||
importArticles({ |
|||
type: 'script', |
|||
articles: [ |
|||
// AbuseFilter in RC |
|||
'MediaWiki:Common.js/afTable.js', |
|||
] |
|||
}); |
|||
importArticle({ |
|||
type: "style", |
|||
article: "MediaWiki:Common.css/Infobox.css" |
|||
}); |
|||
// END Importazioni |
|||
//Riporterò tutto a posto quando avrò finito. |
|||
/*************** Variabili di regolazione degli effetti ***************/ |
/*************** Variabili di regolazione degli effetti ***************/ |
||
var disableHideEdit = false; // Disabilita la funzione hideEditPatch() |
var disableHideEdit = false; // Disabilita la funzione hideEditPatch() |
||
var disableTargetBlank = false; // Disabilita la funzione targetBlank() |
|||
var disableUsernameReplace = false; // Disabilita la funzione usernameReplace() |
var disableUsernameReplace = false; // Disabilita la funzione usernameReplace() |
||
var disableAlert = false; // Disabilita le funzioni alertLink() e alertLoad() |
// var disableAlert = false; // Disabilita le funzioni alertLink() e alertLoad() |
||
var disableRefTooltip = false; // Disabilita la funzione refTooltip() |
var disableRefTooltip = false; // Disabilita la funzione refTooltip() |
||
var buttonPurge = false; // Abilita la funzione createPurgeButton() |
var buttonPurge = false; // Abilita la funzione createPurgeButton() |
||
Riga 56: | Riga 38: | ||
/*************** Caricamento della pagina ***************/ |
/*************** Caricamento della pagina ***************/ |
||
mw.hook('nonciclopedia.ready').add(function() { |
|||
// Funzione che stabilisce quando una pagina si è caricata (sostituisce addOnloadHook, che si avvia troppo tardi) |
|||
$(document).ready(function() { |
|||
if(skin == 'wikiamobile') { |
|||
setTimeout('hooksMobile();', 800); |
|||
} |
|||
else { |
|||
setTimeout('hooksCommon();', 800); |
|||
} |
|||
return; |
|||
}); |
|||
// Funzioni da avviare unicamente al caricamento della pagina |
|||
function hooksCommon() { |
|||
// Patch |
// Patch |
||
uncyPtPatch(); |
uncyPtPatch(); |
||
Riga 81: | Riga 51: | ||
if(wgPageName == 'Speciale:Chat') chatPatch(); |
if(wgPageName == 'Speciale:Chat') chatPatch(); |
||
if(wgPageName == 'Speciale:Entra') registrationPatch(); |
if(wgPageName == 'Speciale:Entra') registrationPatch(); |
||
if(wgPageName == 'Speciale:AdminDashboard') dashboardPatch(); |
|||
oasisCheck() |
|||
// Skin |
// Skin |
||
startAjaxWatch(); |
startAjaxWatch(); |
||
hidingToolBox(); |
|||
toolbarCookieHide(); |
toolbarCookieHide(); |
||
linkAdQ(); |
linkAdQ(); |
||
if(wgUserName) dismissableNotice(); |
|||
if(wgAction == 'edit' || wgAction == 'submit') quickEditor(); |
if(wgAction == 'edit' || wgAction == 'submit') quickEditor(); |
||
if(buttonPurge && wgCanonicalNamespace != 'Special') createPurgeButton(); |
if(buttonPurge && wgCanonicalNamespace != 'Special') createPurgeButton(); |
||
Riga 93: | Riga 63: | ||
// Inclusioni |
// Inclusioni |
||
// Sintassi: importScript(script, condizione); |
// Sintassi: importScript(script, condizione); |
||
importScript('MediaWiki:Pesce_aprile_2009.js', wgPageName == 'Nonciclopedia:Storia/Pagine_commemorative/Pesci_d\'aprile/3'); |
|||
importScript('Nonciclopedia:Script/MD5.js', true); |
|||
importScript('MediaWiki:Pesce_aprile_2010.js', wgPageName == 'Nonciclopedia:Storia/Pagine_commemorative/Pesci_d\'aprile/4'); |
|||
importScript('Nonciclopedia:Script/flipCounter.js', true); |
|||
importScript(' |
importScript('MediaWiki:Pesce_aprile_2011.js', wgPageName == 'Nonciclopedia:Storia/Pagine_commemorative/Pesci_d\'aprile/5'); |
||
importScript('Nonciclopedia:Script/Pesce_aprile_2009.js', wgPageName == 'Nonciclopedia:Storia/Pagine_commemorative/Pesci_d\'aprile/3'); |
|||
importScript('Nonciclopedia:Script/Pesce_aprile_2010.js', wgPageName == 'Nonciclopedia:Storia/Pagine_commemorative/Pesci_d\'aprile/4'); |
|||
importScript('Nonciclopedia:Script/Pesce_aprile_2011.js', wgPageName == 'Nonciclopedia:Storia/Pagine_commemorative/Pesci_d\'aprile/5'); |
|||
//Funzioni dell'anteprima |
//Funzioni dell'anteprima |
||
Riga 116: | Riga 83: | ||
} |
} |
||
} |
} |
||
}); |
|||
return; |
|||
} |
|||
// Funzioni da avviare al caricamento della pagina e dell'anteprima |
// Funzioni da avviare al caricamento della pagina e dell'anteprima |
||
Riga 143: | Riga 109: | ||
if(!disableTargetBlank) targetBlank(); |
if(!disableTargetBlank) targetBlank(); |
||
if(!disableUsernameReplace) usernameReplace(); |
if(!disableUsernameReplace) usernameReplace(); |
||
if(!disableAlert) { |
|||
alertLink(); |
|||
setTimeout(alertLoad, 1); |
|||
} |
|||
if(!disableRefTooltip) refTooltip(); |
if(!disableRefTooltip) refTooltip(); |
||
if(!navBarDebug) createNavigationBarToggleButton(); |
if(!navBarDebug) createNavigationBarToggleButton(); |
||
Riga 218: | Riga 180: | ||
} |
} |
||
/*************** Patch ***************/ |
|||
// Corregge i link alla uncy portoghese |
|||
function uncyPtPatch() { |
|||
var href = $('li.interwiki-pt>a[lang=pt]').attr('href'); |
|||
if(href) { |
|||
$('li.interwiki-pt>a[lang=pt]').attr('href', href.replace('desciclopedia.ws', 'desciclopédia.org')); |
|||
} |
|||
} |
|||
function toolbarPatch() { |
|||
var toolbar = $('#HidebarToggle').remove(); |
|||
$('#footer').append(toolbar); |
|||
toolbar.css({ |
|||
'text-align': 'left', |
|||
'font-size': '12px' |
|||
}); |
|||
} |
|||
// Sistema un problema di accento nella barra laterale |
|||
function communityPatch() { |
|||
$('#p-community h5').text('comunità'); |
|||
return; |
|||
} |
|||
// Testo di default della casella di ricerca |
|||
// Autore: Nachteule |
|||
function searchBoxPatch() { |
|||
$('#searchInput').val('Ricerca').css('color', '#888888').focus(function(event) { |
|||
$('#searchInput').val('').css('color', ''); |
|||
}).blur(function(event) { |
|||
if ($('#searchInput').val() === '') { |
|||
$('#searchInput').val('Ricerca').css('color', '#888888'); |
|||
} |
|||
}); |
|||
return; |
|||
} |
|||
// Perfeziona i link di condivisione nella sidebar |
|||
function shareLinksPatch() { |
|||
$('#p-condividi a').attr('target', '_blank'); |
|||
return; |
|||
} |
|||
// Funzione per il caricamento categorie con il <charinsert> |
|||
// Autore: Genuzzo |
|||
function catInsertPatch() { |
|||
$('.catinsert a').each(function() { |
|||
if(!$(this).data('c')) { |
|||
$(this).click(function(e) { |
|||
e.preventDefault(); |
|||
$('textarea:first').val($('textarea:first').val() + '[[Categoria:' + $(this).text() + ']]'); |
|||
}); |
|||
$(this).data('c', 'a'); |
|||
} |
|||
}); |
|||
return; |
|||
} |
|||
// Link alla chat corretto con la skin giusta |
|||
function chatPatch() { |
|||
window.location.href = '/wiki/Speciale:Chat?useskin=wikia'; |
|||
return; |
|||
} |
|||
// Fix per pagina registrazione |
|||
function registrationPatch() { |
|||
$('.get-account').html('Non hai un account? <a href="http://nonciclopedia.wikia.com/wiki/Special:UserSignup">Registrati!</a>'); |
|||
return; |
|||
} |
|||
// Visualizza i video di youtube direttamente nella pagina |
|||
function youtubePatch() { |
|||
$('.youtube').each(function() { |
|||
var contents = $(this).html().split('|'); |
|||
if(contents[0] == 'ERROR') { |
|||
return; |
|||
} |
|||
var iframe = $('<iframe></iframe>').attr('src', 'http://www.youtube.com/embed/' + contents[0]).css({ |
|||
'height': contents[1], |
|||
'width': contents[2] |
|||
}); |
|||
$(this).html('').append(iframe).show(); |
|||
}); |
|||
$('.original-link').hide(); |
|||
return; |
|||
} |
|||
// Funzione per eliminare quel fottuto trattino nelle pagine dei file |
|||
// Autore: MFH |
|||
function filePatch() { |
|||
var title = $('h1#firstHeading'); |
|||
title.html(title.html().replace('File: - ', 'File:')); |
|||
return; |
|||
} |
|||
//Patch per far funzionare i categorytree non inseriti direttamente nelle pagine (wikiammerda) |
|||
function catTreePatch() { |
|||
var scriptElem = document.createElement('script'); |
|||
scriptElem.type = 'text/javascript'; |
|||
scriptElem.language = 'javascript'; |
|||
scriptElem.src = '/load.php?debug=false&lang=it&modules=ext.categoryTree&skin=monobook&version=20120817T181907Z&*'; |
|||
document.getElementsByTagName('head')[0].appendChild(scriptElem); |
|||
var linkElem = document.createElement('link'); |
|||
linkElem.rel = 'stylesheet'; |
|||
linkElem.href = 'http://slot2.wikia.com/load.php?debug=false&lang=it&modules=ext.categoryTree.css%7Cext.wikihiero%7Cmediawiki.legacy.commonPrint%2Cshared%7Cskins.monobook%7Cwikia.monobook&only=styles&skin=monobook&*'; |
|||
document.getElementsByTagName('head')[0].appendChild(linkElem); |
|||
return; |
|||
} |
|||
// Visualizza correttamente le categorie nascoste in IE |
|||
function hiddenCatsExplorerPatch() { |
|||
var div = $('#mw-hidden-catlinks'); |
|||
if(!div.length) { |
|||
return; |
|||
} |
|||
var span = $('<span></span>'); |
|||
span.attr('id', 'mw-hidden-catlinks-switch'); |
|||
span.text('>>'); |
|||
div.prepend(span); |
|||
div.show(); |
|||
return; |
|||
} |
|||
// Fa scomparire il tasto modifica negli articoli da cancellare |
|||
function hideEditPatch() { |
|||
$('#ca-edit a:first').attr('href', '#').css('color', 'gray').text('X'); |
|||
return; |
|||
} |
|||
//ATTENZIONE |
|||
//FUNZIONE TEMPORANEA, HO PERSO IL CONTO DELLE PATCH VARIE |
|||
//NON HO TROVATO LA CAUSA DEL PROBLEMA, QUESTA è UNA FIX TEMPORANEA |
|||
//QUALCUN ALTRO (LEGGASI MFH) DOVREBBE POI TROVARE UNA FIX DEFINITIVA |
|||
//CODICE BRUTTO, NON ME NE ASSUMO LA RESPONSABILITà |
|||
//FA SCHIFO, LO SO IO, LO SAPETE ANCHE VOI |
|||
//FIRMATO: TOTALLY NOT GENUZZO |
|||
function imgMobilePatch() { |
|||
var stupidImagesToFix = $("#NonNotizie").next().find("img"); |
|||
stupidImagesToFix.each(function() { |
|||
$(this).attr('src', $(this).attr('data-src')); |
|||
}); |
|||
} |
|||
/*************** Skin ***************/ |
|||
// Ajax Watch - Permette di aggiungere e togliere una pagina dai preferiti senza passare per la pagina di conferma |
|||
var ajaxWatch = new Object(); |
|||
function startAjaxWatch() { |
|||
ajaxWatch = { |
|||
watchMsg: 'Taco', |
|||
unwatchMsg: 'Detaco', |
|||
watchingMsg: 'Tacoing...', |
|||
unwatchMsg: 'Detacoing...', |
|||
tooltipWatchMsg: 'Aggiungi questa pagina alla tua lista degli Osservati Speciali', |
|||
tooltipUnwatchMsg: 'Elimina questa pagina dalla tua lista degli Osservati Speciali', |
|||
supported: true, |
|||
watching: false, |
|||
inprogress: false, |
|||
timeoutID: null, |
|||
watchLinks: [], |
|||
imgBasePath: '' |
|||
}; |
|||
ajaxWatch.setLinkText = function(newText) { |
|||
for(var i = 0; i < ajaxWatch.watchLinks.length; i++) { |
|||
var watchLink = $(ajaxWatch.watchLinks[i]); |
|||
watchLink.text(''); |
|||
if(newText == ajaxWatch.watchMsg || newText == ajaxWatch.unwatchMsg) { |
|||
if(!$('#watch-star').length && !$('#unwatch-star').length) { |
|||
var innerLink = $('<img />').attr({ |
|||
'src': 'http://images4.wikia.nocookie.net/__cb20060516011831/uncyclopedia/images/5/52/Spacer.gif', |
|||
'id': 'watch-star' |
|||
}).css({ |
|||
'width': '17px', |
|||
'height': '17px' |
|||
}); |
|||
watchLink.append(innerLink); |
|||
} |
|||
else if($('#watch-star').length) { |
|||
var innerLink = $('#watch-star'); |
|||
} |
|||
else { |
|||
var innerLink = $('#unwatch-star'); |
|||
} |
|||
var keyCommand = watchLink.attr('title').match(/\[.*?\]$/) ? watchLink.attr('title').match(/\[.*?\]$/)[0] : ''; |
|||
watchLink.attr('title', (newText == ajaxWatch.watchMsg ? ajaxWatch.tooltipWatchMsg : ajaxWatch.tooltipUnwatchMsg) + ' ' + keyCommand); |
|||
} |
|||
} |
|||
}; |
|||
ajaxWatch.setLinkID = function(newID) { |
|||
$(ajaxWatch.watchLinks[0]).parent().attr('id', newID); |
|||
}; |
|||
ajaxWatch.setHref = function(string) { |
|||
for(var i = 0; i < ajaxWatch.watchLinks.length; i++) { |
|||
var watchLink = $(ajaxWatch.watchLinks[i]); |
|||
if(string == 'watch') { |
|||
watchLink.attr('href', watchLink.attr('href').replace(/&action=unwatch/, '&action=watch')); |
|||
} |
|||
else if(string == 'unwatch') { |
|||
watchLink.attr('href', watchLink.attr('href').replace(/&action=watch/, '&action=unwatch')); |
|||
} |
|||
} |
|||
}; |
|||
ajaxWatch.ajaxCall = function(event) { |
|||
event.preventDefault(); |
|||
if(!ajaxWatch.supported) { |
|||
return true; |
|||
} |
|||
else if(ajaxWatch.inprogress) { |
|||
return false; |
|||
} |
|||
if(!wfSupportsAjax()) { |
|||
ajaxWatch.supported = false; |
|||
return true; |
|||
} |
|||
ajaxWatch.inprogress = true; |
|||
ajaxWatch.setLinkText(ajaxWatch.watching ? ajaxWatch.unwatchingMsg : ajaxWatch.watchingMsg); |
|||
var old_sajax_request_type = sajax_request_type; |
|||
sajax_request_type = 'POST'; |
|||
sajax_do_call('wfAjaxWatch', [wgPageName, ajaxWatch.watching ? 'u' : 'w'], ajaxWatch.processResult); |
|||
sajax_request_type = old_sajax_request_type; |
|||
ajaxWatch.timeoutID = setTimeout(function() {ajaxWatch.inprogress = false;}, 10000); |
|||
return false; |
|||
}; |
|||
ajaxWatch.processResult = function(request) { |
|||
if(!ajaxWatch.supported) { |
|||
return; |
|||
} |
|||
var response = request.responseText; |
|||
if(response.match(/^<w#>/)) { |
|||
ajaxWatch.watching = true; |
|||
ajaxWatch.setLinkText(ajaxWatch.unwatchMsg); |
|||
ajaxWatch.setLinkID('ca.unwatch'); |
|||
ajaxWatch.setHref('unwatch'); |
|||
} |
|||
else if(response.match(/^<u#>/)) { |
|||
ajaxWatch.watching = false; |
|||
ajaxWatch.setLinkText(ajaxWatch.watchMsg); |
|||
ajaxWatch.setLinkID('ca-watch'); |
|||
ajaxWatch.setHref('watch'); |
|||
} |
|||
else { |
|||
window.location.href = $(ajaxWatch.watchLinks[0]).attr('href'); |
|||
return; |
|||
} |
|||
if(typeof wgEnableWikiaFollowdPages === 'undefined' || !wgEnableWikiaFollowedPages) { |
|||
jsMsg(response.substr(4), 'watch'); |
|||
} |
|||
ajaxWatch.inprogress = false; |
|||
if(ajaxWatch.timeoutID) { |
|||
clearTimeout(ajaxWatch.timeoutID); |
|||
} |
|||
var watchThis = $('#wpWatchthis'); |
|||
if(watchThis.length && response.match(/^<[uw]#>/)) { |
|||
watchThis.attr('checked', (response.match(/^<w#>/) ? 'checked' : '')); |
|||
} |
|||
}; |
|||
ajaxWatch.onLoad = function() { |
|||
var el1 = $('#ca-unwatch'); |
|||
var el2 = null; |
|||
if(!el1.length) { |
|||
el1 = $('#mw-unwatch-link1'); |
|||
el2 = $('#mw-unwatch-link2'); |
|||
} |
|||
if(el1.length) { |
|||
ajaxWatch.watching = true; |
|||
} |
|||
else { |
|||
ajaxWatch.watching = false; |
|||
el1 = $('#ca-watch'); |
|||
if(!el1.length) { |
|||
el1 = $('#mw-watch-link1'); |
|||
el2 = $('#mw-watch-link2'); |
|||
} |
|||
if(!el1.length) { |
|||
ajaxWatch.supported = false; |
|||
return; |
|||
} |
|||
} |
|||
ajaxWatch.watchLinks.push(el1.prop('tagName').toLowerCase() == 'a' ? el1 : $(':first-child', el1)); |
|||
if(el2 && el2.length) { |
|||
ajaxWatch.watchLinks.push(el2); |
|||
} |
|||
for(var i = 0; i < ajaxWatch.watchLinks.length; i++) { |
|||
$(ajaxWatch.watchLinks[i]).click(ajaxWatch.ajaxCall); |
|||
if(ajaxWatch.watching) { |
|||
ajaxWatch.setLinkText(ajaxWatch.unwatchMsg); |
|||
} |
|||
else { |
|||
ajaxWatch.setLinkText(ajaxWatch.watchMsg); |
|||
} |
|||
} |
|||
return; |
|||
}; |
|||
ajaxWatch.onLoad(); |
|||
return; |
|||
} |
|||
// Funzione per mostrare o nascondere i riquadri nella barra laterale |
|||
// Autore: Silent Penguin |
|||
var condividiChiuso = false; |
|||
var progettiChiuso = false; |
|||
var comunitaChiuso = true; |
|||
var strumentiChiuso = true; |
|||
var lingueChiuso = false; |
|||
var editorsChiuso = false; |
|||
// var wikiaChiuso = false; - se lo riaggiungi ricordati di mettere ", wikiaChiuso" alla funzione - |
|||
function hidingToolBox() { |
|||
$.fn.hidingToolbox = function(options) { |
|||
var settings = { |
|||
'initClosed': true, |
|||
'duration': 200, |
|||
'contentSelector': '.pBody', |
|||
'handleSelector': 'h5', |
|||
'slide': function(element, visible) { |
|||
if(visible) { |
|||
element.parent().addClass('hidden').removeClass('visible'); |
|||
} |
|||
else { |
|||
element.parent().addClass('visible').removeClass('hidden'); |
|||
} |
|||
} |
|||
}; |
|||
// Dove avviene la magia |
|||
var handleClick = function() { |
|||
var handle = $(settings['contentSelector'], $(this).parent()); |
|||
var visible = handle.parent().hasClass('visible'); |
|||
handle.slideToggle(settings['duration'], settings['slide']($(this), visible)); |
|||
} |
|||
var handleHoverIn = function() { |
|||
$(this).addClass('hover'); |
|||
} |
|||
var handleHoverOut = function () { |
|||
$(this).removeClass('hover'); |
|||
} |
|||
var length = this.length; |
|||
// Se l'opzione esiste ed è del giusto tipo, la si unisce alle impostazioni di default |
|||
if(typeof(options) == typeof(Object())) { |
|||
$.extend(settings, options); |
|||
} |
|||
// se initClosed è un array vuoto, viene reimpostato al valore di defualt |
|||
if(typeof(settings['initClosed']) == typeof(Array()) && !settings['initClosed'].length) { |
|||
settings['initClosed'] = true; |
|||
} |
|||
return $(this).each(function(key) { |
|||
$(settings['handleSelector'], this).hover(handleHoverIn, handleHoverOut).click(handleClick); |
|||
var initClosed = typeof(settings['initClosed']) == typeof(Array()) ? settings['initClosed'][Math.min(key, length - 1)] : settings['initClosed']; |
|||
if(initClosed) { |
|||
$(settings['contentSelector'], this).hide().parent().addClass('hidden'); |
|||
} |
|||
else { |
|||
$(settings['contentSelector'], this).show().parent().addClass('visible'); |
|||
} |
|||
}); |
|||
}; |
|||
var blocks = $('.generated-sidebar:not(#p-navigation), #p-condividi, #p-progetti, #p-community, #p-editors, #p-tb, #p-lang'); |
|||
if(blocks.length == 5) { |
|||
blocks.hidingToolbox({'initClosed': [condividiChiuso, progettiChiuso, comunitaChiuso, editorsChiuso, strumentiChiuso, lingueChiuso]}) |
|||
} |
|||
else if(blocks.length == 6) { |
|||
blocks.hidingToolbox({'initClosed': [condividiChiuso, progettiChiuso, comunitaChiuso, editorsChiuso, strumentiChiuso, lingueChiuso]}) |
|||
} |
|||
$('#column-one').addClass('collapsible_pile'); |
|||
return; |
|||
} |
|||
// Nascondi toolbar con i cookie |
|||
// Autore: Genuzzo |
|||
function toolbarCookieHide() { |
|||
var cookie = getCookie('tlb'); |
|||
if(cookie == 'yes') { |
|||
$('#HidebarToggleInitialState').html('0'); |
|||
} |
|||
$('#HidebarToggleLink').click(function() { |
|||
var today = new Date(); |
|||
var expire = new Date(); |
|||
expire.setTime(today.getTime() + 3600000 * 24 * 356); |
|||
document.cookie = 'tlb=' + (cookie == 'yes' ? 'no' : 'yes') + ';expires=' + expire.toGMTString(); |
|||
}); |
|||
return; |
|||
} |
|||
// Funzione per inserire le stellette vicino agli interwiki |
|||
function linkAdQ() { |
|||
s = $('#p-lang li').each(function() { |
|||
var t = $(this); |
|||
if($('#' + t.attr('class') + '-fa').length) { |
|||
t.addClass('FA'); |
|||
t.attr('title', 'La voce è in vetrina in questa lingua.'); |
|||
} |
|||
else if($('#' + t.attr('class') + '-ga').length) { |
|||
t.addClass('GA'); |
|||
t.attr('title', 'La voce è di qualità in questa lingua.'); |
|||
} |
|||
}); |
|||
return; |
|||
} |
|||
// Funzioni (2) del dismissable notice |
|||
// Per inserire il messaggio modificare Nonciclopedia:Dismissablenotice |
|||
// Autore: Genuzzo |
|||
// Parametri: |
|||
// name: Nome della variabile da memorizzare nel cookie |
|||
// value: Valore della variabile |
|||
// days: Numero di giorni durante i quali la variabile è valida |
|||
function createCookie(name, value, days) { |
|||
if(days) { |
|||
var date = new Date(); |
|||
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); |
|||
var expires = '; expires=' + date.toGMTString(); |
|||
} |
|||
else { |
|||
var expires = ''; |
|||
} |
|||
document.cookie = name + '=' + value + expires + ';path=/;'; |
|||
return; |
|||
} |
|||
var timestamp, message; |
|||
function dismissableNotice() { |
|||
var urll = '/api.php?action=query&prop=revisions&titles=Nonciclopedia:Dismissablenotice'; |
|||
var params = '&rvprop=content|timestamp&format=json'; |
|||
$.getJSON(wgServer + wgScriptPath + urll + params, function(data) { |
|||
$.each(data['query']['pages'], function(key, val) { |
|||
timestamp = val['revisions'][0]['timestamp']; |
|||
if(timestamp != getCookie('gendn')) { |
|||
message = val['revisions'][0]['*']; |
|||
if(message == '') { |
|||
message = 'undefined'; |
|||
} |
|||
} |
|||
else { |
|||
message = 'undefined'; |
|||
} |
|||
}); |
|||
params = '&action=render' |
|||
if(message != 'undefined') { |
|||
$.get({ |
|||
url: wgServer + wgScriptPath + urll + params, |
|||
dataType: 'text', |
|||
success: function(data) { |
|||
var div = $('<div></div>').attr('id', 'gendn').css({ |
|||
'display': 'block', |
|||
'background-color': '#FFCE7B', |
|||
'border': '1px solid #FFA500', |
|||
'width': '98%', |
|||
'padding': '0.6em', |
|||
'margin': '0.2em', |
|||
'font-weight': 'bold', |
|||
'margin-bottom': '20px' |
|||
}); |
|||
var span = $('<span></span>').attr('class', 'morphLink').css({ |
|||
'font-size': '80%', |
|||
'float': 'right' |
|||
}).text(navigationBarHide).click(function() { |
|||
createCookie('gendn', timestamp, 1000); |
|||
$('#gendn').remove(); |
|||
}); |
|||
div.append(span, data); |
|||
$('#contentSub').after(div); |
|||
} |
|||
}); |
|||
} |
|||
}); |
|||
return; |
|||
} |
|||
// Funzioni (6) per l'anteprima rapida |
|||
// Autore: Sanjilops |
|||
var quickSaveCheckText = ''; |
|||
var quickPreviewFirstLoad = true; |
|||
var quickPreviewHiddenCatlist; |
|||
var quickPreviewCatNS = 'Categoria:'; |
|||
var quickPreviewHiddencatsCat = 'Categorie nascoste'; |
|||
function quickEditor() { |
|||
var sect = $('[name=wpSection]'); |
|||
if(!location.search.match(/&?undo=\d+/) && ((sect.length && !sect.eq(0).attr('value')) || !sect.length)) { |
|||
quickSaveLoad(); |
|||
} |
|||
if(!(wgTitle.match(/\.(j|cs)s$/) && wgNamespaceNumber % 2 == 0)) { |
|||
quickPreviewLoad(); |
|||
} |
|||
$('#wpTextbox1').mouseup(quickEditSwitch).keyup(quickEditSwitch); |
|||
return; |
|||
} |
|||
function quickSaveLoad() { |
|||
var b = $('<input />').attr({ |
|||
'type': 'button', |
|||
'value': 'Salva', |
|||
'id': 'quicksaveButton', |
|||
'accesskey': 1, |
|||
'title': 'Salva e resta nell\'editor [alt-shift-1]' |
|||
}).click(function() { |
|||
quickSave(); |
|||
}); |
|||
$('#wpPreview').before(b); |
|||
quickSaveCheckText = $('#wpTextbox1').attr('value'); |
|||
return; |
|||
} |
|||
function quickSave() { |
|||
var textBox = $('#wpTextbox1'); |
|||
$('#wpTextbox1,#wpSave,#quicksaveButton,#quickpreviewButton').attr('disabled', 'disabled'); |
|||
var source = encodeURIComponent(textBox.attr('value')); |
|||
var msgBox = $('#quickSaveMsgBox'); |
|||
if(!msgBox.length) { |
|||
msgBox = $('<div></div>').attr('id', 'quickSaveMsgBox'); |
|||
$('#firstHeading').before(msgBox); |
|||
} |
|||
else { |
|||
msgBox.html(''); |
|||
} |
|||
var param = 'action=edit&format=xml&title=' + encodeURIComponent(wgPageName); |
|||
param += '&token=' + $('[name=wpEditToken]:first').attr('value').replace(/\+\\/, '%2' + "B%5" + 'C'); |
|||
if($('#wpSummary').length) { |
|||
param += '&summary=' + encodeURIComponent($('#wpSummary').attr('value')); |
|||
} |
|||
if($('#wpCaptchaId').length) { |
|||
param += '&captchaid=' + $('#wpCaptchaId').attr('value') + '&captchaword=' + encodeURIComponent($('#wpCaptchaWord').attr('value')); |
|||
$('#captcha_box').remove(); |
|||
} |
|||
if($('wpMinoredit:checked').length) { |
|||
param += '&minor=' |
|||
} |
|||
if($('#wpWatchthis').length) { |
|||
if($('#ca-watch').length && $('#wpWatchthis:checked').length) { |
|||
param += '&watchlist=watch'; |
|||
} |
|||
if($('#ca-unwatch').length && !$('#wpWatchthis:checked').length) { |
|||
param += '&watchlist=unwatch'; |
|||
} |
|||
} |
|||
param += '&basetimestamp=' + $('[name=wpEdittime]:first').attr('value'); |
|||
param += '&starttimestamp=' + $('[name=wpStarttime]:first').attr('value'); |
|||
param += '&text=' + source; |
|||
param += '&md5=' + MD5(textBox.attr('value')); |
|||
$.ajax({ |
|||
url: wgServer + wgScriptPath + '/api.php', |
|||
type: 'POST', |
|||
headers: {'Content-Type': 'application/x-www-form-urlencoded', 'Content-Length': param.length}, |
|||
data: param, |
|||
dataType: 'xml', |
|||
timeout: 30000, |
|||
error: function(data, status, error) { |
|||
var msgBox = $('#quickSaveMsgBox'); |
|||
if(status == 'timeout') { |
|||
msgBox.text('Salvataggio fallito: il server non risponde.'); |
|||
} |
|||
else { |
|||
if(error) { |
|||
msgBox.text('Salvataggio fallito. Risposta del server: ' + error); |
|||
} |
|||
else { |
|||
msgBox.text('Errore nella risposta del server. Controlla nella cronologia se il salvataggio è avvenuto.'); |
|||
} |
|||
} |
|||
msgBox.css('color', 'red'); |
|||
}, |
|||
success: function(data) { |
|||
var result = $('edit', data); |
|||
var msgBox = $('#quickSaveMsgBox'); |
|||
if(result.length) { |
|||
if(result.attr('result') == 'Success') { |
|||
msgBox.text('Salvataggio completato.').css('color', ''); |
|||
wgCurRevisionId = result.attr('newrevid'); |
|||
var param = 'action=query&format=xml&prop=revisions&meta=userinfo&uiprop=hasmsg&rvprop=timestamp%'; |
|||
param += '7Cuser&rvlimit=1&rvdir=older&titles=' + encodeURIComponent(wgPageName); |
|||
$.ajax({ |
|||
url: wgServer + wgScriptPath + '/api.php', |
|||
type: 'POST', |
|||
headers: {'Content-Type': 'application/x-www-form-urlencoded', 'Content-Length': param.length}, |
|||
data: param, |
|||
dataType: 'xml', |
|||
timeout: 30000, |
|||
error: function(data, status, error) { |
|||
var msgBox = $('#quickSaveMsgBox'); |
|||
msgBox.text(msgBox.text() + ' Impossibile procedere ad ulteriori salvataggi.'); |
|||
}, |
|||
success: function(data) { |
|||
var rev = $('rev', data); |
|||
var msgBox = $('#quickSaveMsgBox'); |
|||
if(!rev.length) { |
|||
msgBox.text(msgBox.text() + ' Impossibile procedere ad ulteriori salvataggi.'); |
|||
return; |
|||
} |
|||
var t = rev.attr('timestamp'); |
|||
$('[name=wpEdittime]:first').attr('value', t.replace(/\D/g, '')); |
|||
var d = new Date(t.replace(/(\d\d\d\d)-(\d\d)-(\d\d)T(.+)Z/, "$1/$2/$3 $4")); |
|||
d.setHours(d.getHours() - d.getTimezoneOffset() / 60); |
|||
msgBox.text(msgBox.text() + ' Ultima modifica: ' + rev.attr('user') + ' ' + d.toLocaleString()); |
|||
d = new Date(); |
|||
$('[name=wpStarttime]:first').attr('value', d.toISOString().replace(/[\-\:A-Za-z]/g, '').replace(/\.[0-9]{3}$/g, '')); |
|||
var userInfo = $('userinfo', data); |
|||
if(!userInfo.length) { |
|||
return; |
|||
} |
|||
var orange = $('#bodyContent div.usermessage:first'); |
|||
if(!userInfo.attr('messages')) { |
|||
orange.hide(); |
|||
return; |
|||
} |
|||
var name = wgUserName ? wgUserName : userInfo.attr('name'); |
|||
if(!orange.length) { |
|||
orange = $('<div></div>').attr('class', 'usermessage'); |
|||
$('#wikiPreview').before(orange); |
|||
} |
|||
else { |
|||
orange.css('display', 'block'); |
|||
var linkTalk = $('<a></a>').attr({ |
|||
'title': 'Discussioni utente:' + name, |
|||
'href': '/index.php?title=Discussioni_utente:' + encodeURI(name) + '&redirect=no' |
|||
}).text('nuovi messaggi'); |
|||
var linkDiff = $('<a></a>').attr({ |
|||
'title': 'Discussioni utente:' + name, |
|||
'href': '/index.php?title=Discussioni_utente:' + encodeURI(name) + '&diff=cur' |
|||
}).text('differenza con la revisione precedente'); |
|||
orange.append('Hai ', linkTalk, ' (', linkDiff, ')'); |
|||
} |
|||
}, |
|||
}); |
|||
$('#wpSummary').attr('value', ''); |
|||
quickSaveCheckText = textBox.attr('value'); |
|||
if(!wgTitle.match(/\.(j|cs)s$/) || wgNamespaceNumber % 2 == 1) { |
|||
textBox[0].selectionStart = 0; |
|||
textBox[0].selectionEnd = 0; |
|||
quickPreview(true); |
|||
} |
|||
if(wgUserName) { |
|||
if($('#wpWatchthis:checked').length) { |
|||
$('#ca-watch').attr('id', 'ca-unwatch'); |
|||
$('#ca-unwatch>a').attr({ |
|||
'href': $('#ca-unwatch>a').attr('href').replace(/=watch$/, '=unwatch'), |
|||
'title': $('#ca-unwatch>a').attr('title').replace(/^Rimuovi/, 'Aggiungi') |
|||
}).text('non seguire'); |
|||
msgBox.text(msgBox.text() + ' Pagina aggiunta agli osservati speciali.') |
|||
} |
|||
else { |
|||
$('#ca-unwatch').attr('id', 'ca-watch'); |
|||
$('#ca-watch>a').attr({ |
|||
'href': $('#ca-watch>a').attr('href').replace(/=unwatch$/, '=watch'), |
|||
'title': $('#ca-watch>a').attr('title').replace(/^Aggiungi/, 'Rimuovi') |
|||
}).text('segui'); |
|||
msgBox.text(msgBox.text() + ' Pagina rimossa dagli osservati speciali.') |
|||
} |
|||
} |
|||
} |
|||
else if(result.attr('result') == 'Failure') { |
|||
var captcha = $('captcha', result); |
|||
if(!captcha.length) { |
|||
msgBox.text('Salvataggio fallito: errore ignoto').css('color', 'red'); |
|||
return; |
|||
} |
|||
var captchaID = $('<input />').attr({ |
|||
'type': 'hidden', |
|||
'id': 'wpCaptchaId', |
|||
'value': captcha.attr('id') |
|||
}); |
|||
var captchaWord = $('<input />').attr('id', 'wpCaptchaWord').css('margin-bottom', '10px'); |
|||
var captchaImg = $('<img />').attr('src', wgScriptPath + '/index.php?title=Special:Captcha/image&wpCaptchaId=' + captcha.attr('value')); |
|||
var captchaLink = $('<a></a>').attr('href', '/wiki/Speciale:Captcha/help" title="Speciale:Captcha/help').text('come funziona?'); |
|||
var captchaMsg = $('<p></p>').append('La modifica richiesta aggiunge dei collegamenti esterni alla pagina; come misura precauzionale contro l\'inserimento automatico di spam, si prega di inserire nella casella sottostante la parola che compare distorta in questa immagine (', captchaLink, ')'); |
|||
var captchaBox = $('<div></div>').attr('id', 'captchaBox').append(captchaMsg, captchaImg, captchaWord, captchaID); |
|||
$('#toolbar').before(captchaBox); |
|||
} |
|||
} |
|||
var error = $('error', data); |
|||
if(error.length) { |
|||
msgBox.text('Errore nella risposta del server. Controlla nella cronologia se il salvataggio è avvenuto').css('color', 'red'); |
|||
switch(error.attr('code')) { |
|||
case 'editconflict': |
|||
$('#wpSave').removeAttr('disabled'); |
|||
setTimeout(function() { |
|||
$('#wpSave').click(); |
|||
return; |
|||
}); |
|||
return; |
|||
case 'noedit': |
|||
case 'noedit-anon': |
|||
msgBox.text('Non sei autorizzato a modificare questa pagina.').css('color', 'red'); |
|||
return; |
|||
default: |
|||
msgBox.text('Salvataggio fallito: ' + error.attr('info')).css('color', 'red'); |
|||
return; |
|||
} |
|||
} |
|||
}, |
|||
complete: function() { |
|||
$('#quickSaveMsgBox')[0].scrollIntoView(); |
|||
$('#wpTextbox1,#wpSave,#quicksaveButton,#quickpreviewButton').removeAttr('disabled'); |
|||
$('#wikiPreview').html(''); |
|||
$('body').css('cursor', 'auto'); |
|||
} |
|||
}); |
|||
$('body').css('cursor', 'progress'); |
|||
return; |
|||
} |
|||
function quickPreviewLoad() { |
|||
if(wgTitle.match(/\.(j|cs)s$/)) { |
|||
return; |
|||
} |
|||
var buttons = $('div.editButtons:first'); |
|||
if(!buttons.length) { |
|||
return; |
|||
} |
|||
var b = $('<input />').attr({ |
|||
'type': 'button', |
|||
'value': 'Visualizza anteprima', |
|||
'id': 'quickpreviewButton', |
|||
'accesskey': '2', |
|||
'title': 'Anteprima delle modifiche (consigliata prima di salvare) [alt-shift-2]' |
|||
}).click(function() { |
|||
quickPreview(false); |
|||
}); |
|||
var wpButton = $('#wpPreview').css({ |
|||
'margin': '0', |
|||
'padding': '0', |
|||
'font-size': '0', |
|||
'width': '0', |
|||
'border-width': '0' |
|||
}).before(b); |
|||
var hotkey = $('#quickpreview-hotkeysuggest').css({ |
|||
'left': (b.offset().left - 15) + 'px', |
|||
'visibility': 'visible' |
|||
}); |
|||
quickPreviewHiddenCatlist = getCookie('QPhc'); |
|||
if (quickPreviewHiddenCatlist == null) { |
|||
$.ajax({ |
|||
url: wgServer + wgScriptPath + '/api.php', |
|||
type: 'GET', |
|||
data: 'action=query&list=categorymembers&cmtitle=Category:' + encodeURI(quickPreviewHiddencatsCat) + '&cmlimit=500&format=xml', |
|||
dataType: 'xml', |
|||
success: function(data) { |
|||
var tmp = new Array(); |
|||
$('categormembers:first cm', data).each(function() { |
|||
tmp.push($(this).attr('title')); |
|||
}); |
|||
quickPreviewHiddenCatlist = tmp.join('|'); |
|||
document.cookie = 'QPhc=' + escape(quickPreviewHiddenCatlist); |
|||
} |
|||
}); |
|||
} |
|||
return; |
|||
} |
|||
function quickPreview(afterSave) { |
|||
// Pulizia dell'area di anteprima |
|||
var previewArea = $('#wikiPreview'); |
|||
if(!previewArea.length) { |
|||
return; |
|||
} |
|||
previewArea.html(''); |
|||
if(quickPreviewFirstLoad) { |
|||
previewArea.css('display', 'block'); |
|||
$('#editintro,#mw-anon-edit-warning,#contentSub2,#wpTalkPageText,#explainconflict').hide(); |
|||
$('.mw-newarticletext:first,.mw-newarticletextanon:first,.mw-warning-with-logexcerpt:first').hide(); |
|||
quickPreviewFirstLoad = false; |
|||
} |
|||
else { |
|||
// Rimuove eventuali css importati precedentemente; |
|||
$('#add-css-link').remove(); |
|||
} |
|||
// Imposta il titolo |
|||
$('#firstHeading').html(wgPageName.replace(/_/g, ' ')); |
|||
$('#quickpreviewButton').attr('disabled', 'disabled'); |
|||
$('body').css('cursor', 'progress'); |
|||
var param = 'action=parse&format=xml&prop=text%7Ccategories'; |
|||
if(afterSave) { |
|||
param += '&page=' + encodeURIComponent(wgPageName); |
|||
} |
|||
else { |
|||
var textBox = $('#wpTextbox1'); |
|||
var start = textBox[0].selectionStart; |
|||
var end = textBox[0].selectionEnd; |
|||
if(start < end) { |
|||
var source = textBox.attr('value').slice(start, end); |
|||
} |
|||
else { |
|||
var source = textBox.attr('value') + '\n'; |
|||
if($('[name=wpSection]:first').attr('value') == 'new') { |
|||
source = '== ' + $('wpSummary').attr('value') + ' ==\n' + source; |
|||
} |
|||
} |
|||
source = encodeURIComponent(source); |
|||
param+= '&pst=&title=' + encodeURIComponent(wgPageName) + '&text=' + source; |
|||
} |
|||
$.ajax({ |
|||
url: wgServer + wgScriptPath + '/api.php', |
|||
type: 'POST', |
|||
headers: {'Content-Type': 'application/x-www-form-urlencoded', 'Content-Length': param.length}, |
|||
data: param, |
|||
dataType: 'xml', |
|||
timeout: 30000, |
|||
error: function(data, status, error) { |
|||
if(status == 'timeout') { |
|||
alert('Errore: il server non risponde.'); |
|||
} |
|||
else { |
|||
if(error) { |
|||
alert('Anteprima non riuscita. Risposta del server: ' + error); |
|||
} |
|||
else { |
|||
alert('Anteprima non riuscita (errore del parser?)'); |
|||
} |
|||
} |
|||
}, |
|||
success: function(data) { |
|||
var code = $('text:first', data).text(); |
|||
var previewArea = $('#wikiPreview'); |
|||
previewArea.html(previewArea.html() + code); |
|||
var showCat = false; |
|||
var catLinksBox = $('#catlinks'); |
|||
var r = $('categories:first cl', data); |
|||
if(r.length) { |
|||
if(catLinksBox.length) { |
|||
catLinksBox.html(''); |
|||
} |
|||
else { |
|||
catLinksBox = $('<div></div>').attr({ |
|||
'id': 'catlinks', |
|||
'class': 'catlinks' |
|||
}); |
|||
$('div.visualClear:first').before(catLinksBox); |
|||
} |
|||
var normalCatLinks = new Array(); |
|||
var hiddenCatLinks = new Array(); |
|||
r.each(function() { |
|||
var catName = $(':first-child', this).text(); |
|||
if(quickPreviewHiddenCatlist.match(RegExp(catName.replace(/_/g, ' ')))) { |
|||
var span = $('<span></span>').attr('dir', 'ltr'); |
|||
var link = $('<a></a>').attr({ |
|||
'href': '/wiki/' + quickPreviewCatNS + encodeURI(catName), |
|||
'title': quickPreviewCatNS + catName.replace(/_/g, ' ') |
|||
}).text(catName.replace(/_/g, ' ')); |
|||
span.append(link); |
|||
hiddenCatLinks.push(span); |
|||
} |
|||
else { |
|||
normalCatLinks.push('[[:' + quickPreviewCatNS + catName + '|' + catName.replace(/_/g, ' ') + ']]'); |
|||
} |
|||
}); |
|||
if(hiddenCatLinks.length) { |
|||
var hiddenCatLinksBox = $('<div></div>').attr({ |
|||
'id': 'mw-hidden-catlinks', |
|||
'class': 'mw-hidden-cats-hidden' |
|||
}); |
|||
if(!normalCatLinks.length) { |
|||
catLinksBox.addClass('catlinks-allhidden'); |
|||
} |
|||
catLinksBox.append(hiddenCatLinksBox); |
|||
var label = 'CategoriX nascostX: '; |
|||
if(hiddenCatLinks.length > 1) { |
|||
hiddenCatLinksBox.append(label.replace('X', 'e')); |
|||
for(var i = 0; i < hiddenCatLinks.length; i++) { |
|||
hiddenCatLinksBox.append(hiddenCatLinks[i]); |
|||
if(i != hiddenCatLinks.length - 1) { |
|||
hiddenCatLinksBox.append('|'); |
|||
} |
|||
} |
|||
} |
|||
else { |
|||
hiddenCatLinksBox.append(label.replace('X', 'a'), hiddenCatLinks[0]); |
|||
} |
|||
} |
|||
if(normalCatLinks.length) { |
|||
showCat = true; |
|||
var normalCatsCode = '<div id="mw-normal-catlinks">[[Speciale:Categorie|CategoriX]]: '; // È brutto ma serve come stringa |
|||
if(normalCatLinks.length > 1) { |
|||
normalCatsCode = normalCatsCode.replace('X', 'e') + normalCatLinks.join('|'); |
|||
} |
|||
else { |
|||
normalCatsCode = normalCatsCode.replace('X', 'a') + normalCatLinks[0]; |
|||
} |
|||
normalCatsCode = (normalCatsCode + '</div>').replace(/&/g, '%2' + '6').replace(/\+/g, '%2' + 'B'); |
|||
normalCatsCode = 'action=parse&format=xml&prop=text&text=' + normalCatsCode; |
|||
$.ajax({ |
|||
url: wgServer + wgScriptPath + '/api.php', |
|||
type: 'POST', |
|||
headers: {'Content-Type': 'application/x-www-form-urlencoded', 'Content-Length': normalCatsCode.length}, |
|||
data: normalCatsCode, |
|||
dataType: 'xml', |
|||
timeout: 30000, |
|||
error: function(data, status, error) { |
|||
if(status == 'timeout') { |
|||
alert('Errore del server. Impossibile visualizzare le categorie.'); |
|||
} |
|||
else { |
|||
if(error) { |
|||
alert('Impossibile visualizzare le categorie: errore del server ' + error); |
|||
} |
|||
else { |
|||
alert('Impossibile visualizzare le categorie: errore del parser?'); |
|||
} |
|||
} |
|||
}, |
|||
success: function(data) { |
|||
var catLinksBox = $('#catlinks'); |
|||
catLinksBox.prepend($('text:first', data).text()).attr('class', 'catlinks'); |
|||
} |
|||
}); |
|||
} |
|||
$('#p-logo')[0].scrollIntoView(); |
|||
if(window.showTocToggle) { |
|||
window.tocShowText = 'mostra'; |
|||
window.tocHideText = 'nascondi'; |
|||
showTocToggle(); |
|||
} |
|||
} |
|||
else { |
|||
if(catLinksBox.length) { |
|||
catLinksBox.remove(); |
|||
} |
|||
} |
|||
hooksCommonRender(); |
|||
}, |
|||
complete: function() { |
|||
$('#quickpreviewButton').removeAttr('disabled'); |
|||
$('body').css('cursor', 'auto'); |
|||
} |
|||
}); |
|||
return; |
|||
} |
|||
function quickEditSwitch() { |
|||
var bs = $('#quicksaveButton'); |
|||
if(bs.length) { |
|||
if($(this).attr('value') == quickSaveCheckText) { |
|||
bs.attr('disabled', 'disabled'); |
|||
} |
|||
else { |
|||
bs.removeAttr('disabled'); |
|||
} |
|||
} |
|||
var bp = $('#quickpreviewButton'); |
|||
if(bp.length) { |
|||
if(this.selectionStart < this.selectionEnd) { |
|||
bp.attr('value', 'Anteprima selezione'); |
|||
} |
|||
else { |
|||
bp.attr('value', 'Visualizza anteprima'); |
|||
} |
|||
} |
|||
return; |
|||
} |
|||
// Inserisce il pulsante "purge" in cima alla pagina |
|||
// Autore: MFH |
|||
function createPurgeButton() { |
|||
var reportProblem = $('#ca-report-problem'); |
|||
if(reportProblem.length) { // Modifica il pulsante "report a problem", che è già invisibile |
|||
var link = $('a', reportProblem).eq(0); |
|||
link.text('Purge'); |
|||
link.attr('href', wgServer + wgScriptPath + '/index.php?title=' + wgPageName + '&action=purge'); |
|||
reportProblem.attr('id', 'ca-purge'); |
|||
} |
|||
else { |
|||
var menuList = $('#p-cactions ul').eq(0); |
|||
var newLi = $('<li></li>'); |
|||
newLi.attr('id', 'ca-purge'); |
|||
newLi.html('<a href="' + wgServer + wgScriptPath + '/index.php?title=' + wgPageName + '&action=purge">Purge</a>'); |
|||
menuList.append(newLi); |
|||
} |
|||
return; |
|||
} |
|||
// Logo random - Inattiva al momento |
|||
function randomLogo() { |
|||
var logoArray = new Array( |
|||
'http://vignette4.wikia.nocookie.net/nonciclopedia/images/e/ef/Logo_Natale_2015.png', |
|||
'http://vignette3.wikia.nocookie.net/nonciclopedia/images/c/c1/Logo_Natale_2015_3.png' |
|||
); |
|||
var chosenLogo = Math.round(Math.random() * (logoArray.length - 1)); |
|||
$('#p-logo').html('<a accesskey="z" title="Pagina principale [alt-shift-z]" href="/wiki/Pagina_principale" style="background-image: url(' + logoArray[chosenLogo] + ');"/>'); |
|||
return; |
|||
} |
|||
// Rende il link di modifica sezione identico a quello di wikipedia italiana |
|||
function moveEditSection() { |
|||
$('span.editsection').each(function() { |
|||
var editLink = $(this); |
|||
editLink.addClass('editsection-it_wiki'); |
|||
editLink.siblings().eq(0).after(editLink); |
|||
}); |
|||
return; |
|||
} |
|||
// Aggiunge link di modifica per la sezione 0 |
|||
function sectionZeroEditLink() { |
|||
if(!$('#bodyContent span.editsection').length || $('#no-sec0-edit').length) { |
|||
return; |
|||
} |
|||
var link = $('<a></a>').attr({ |
|||
'rel': 'nofollow', |
|||
'title': 'Modifica la sezione introduttiva', |
|||
'href': wgServer + wgScriptPath + '/index.php?title=' + encodeURI(wgPageName) + '&action=edit§ion=0&editintro=MediaWiki:Editintro' |
|||
}).text('modifica'); |
|||
var span = $('<span></span>').attr('class', 'editsection'); |
|||
span.append('[', link, ']'); |
|||
$('#siteSub').prepend(span); |
|||
return; |
|||
} |
|||
// Inserisce css personalizzati se viene usato il Template:Css |
|||
function addCSS() { |
|||
var styleSheet = $('#add-css'); |
|||
if(!styleSheet.length) { |
|||
return; |
|||
} |
|||
var linkElem = document.createElement('link'); |
|||
linkElem.type = 'text/css'; |
|||
linkElem.rel = 'stylesheet'; |
|||
linkElem.href = '/index.php?title=Nonciclopedia:Skin/' + styleSheet.text().replace(' ', '_') + '.css&action=raw&ctype=text/css&smaxage=120'; |
|||
linkElem.id = 'add-css-link'; |
|||
document.getElementsByTagName('head')[0].appendChild(linkElem); |
|||
return; |
|||
} |
|||
// Cambio del titolo |
|||
function rewriteTitle() { |
|||
if($('#TitleText').length) { |
|||
var titleText = $('#TitleText'); |
|||
var h1 = $('#firstHeading'); |
|||
h1.html(titleText.html()); |
|||
if(titleText.text()) { |
|||
document.title = titleText.text() + ' - Nonciclopedia'; |
|||
} |
|||
else { |
|||
document.title = 'Nonciclopedia'; |
|||
} |
|||
if($('#TitleColor').length) { |
|||
h1.css('color', $('#TitleColor').text()); |
|||
} |
|||
if($('#TitleBorderBottom').length) { |
|||
h1.css('border-bottom', $('#TitleBorderBottom').text()); |
|||
} |
|||
if($('#TitleFontFamily').length) { |
|||
h1.css('font-family', $('#TitleFontFamily').text()); |
|||
} |
|||
$('#TitleText,#TitleColor,#TitleBorderBottom,#TitleFontFamily').remove(); |
|||
} |
|||
return; |
|||
} |
|||
// Cambio del sottotitolo o sottotitolo random |
|||
function rewriteSubTitle() { |
|||
h3 = $('#siteSub'); |
|||
if($('#SubTitleText').length) { |
|||
h3.text($('#SubTitleText').text()); |
|||
$('#SubTitleText').remove(); |
|||
} |
|||
else { |
|||
var subTitles = new Array( |
|||
'Da Nonciclopedia, l\'enciclopedia libera su cauzione', |
|||
'Da Nonciclopedia, l\'enciclopedia libera con l\'indulto', |
|||
'Da Nonciclopedia, l\'enciclopedia libera dagli inestetismi', |
|||
'Dà Noncicloppedia, lenciclopedia l\'ibbera dal\'orttografia', |
|||
'Da Nonciclopedia, l\'enciclopedia che libera la gola e calma la tosse', |
|||
'Da Nonciclopedia, l\'enciclopedia libera... finché non ci beccano!', |
|||
'Da Nonciclopedia, l\'enciclopedia in libertà vigilata', |
|||
'Da Nonciclopedia, l\'enciclopedia libera da qualsivoglia contenuto', |
|||
'Da Nonciclopedia, l\'enciclopedia libidinosa', |
|||
'Da Nonciclopedia, l\'enciclopedia libertina', |
|||
'Da Nonciclopedia, l\'enciclopedia liberatoria', |
|||
'Da Nonciclopedia, l\'enciclopedia libera dal pudore. 8====D', |
|||
'Da Nonciclopedia, l\'enciclopedia liberalizzata (ma solo in Olanda)', |
|||
'Da Nonciclopedia, l\'enciclopedia liberamente ispirata all\'Osservatore Romano', |
|||
'Da Nonciclopedia, l\'enciclopedia VM 18 e libera dai bambini' |
|||
); |
|||
var n = Math.round(Math.random() * (subTitles.length - 1)); |
|||
h3.text(subTitles[n]); |
|||
} |
|||
return; |
|||
} |
|||
/*************** Effetti ***************/ |
|||
// Elenchi numerati |
|||
// Autore: Genuzzo |
|||
function numList() { |
|||
$('.ncMaster').each(function() { |
|||
var list = $('.ncContent li', this); |
|||
var posStr = $('.ncPos', this).text().split(','); |
|||
var posNum = new Array(); |
|||
for(var i = 0; i < posStr.length; i++) { |
|||
var num = parseInt(posStr[i]); |
|||
if(isNaN(num)) { |
|||
continue; |
|||
} |
|||
else if(num > 0 && num <= list.length) { |
|||
posNum.push(num - 1); |
|||
} |
|||
else if(num < 0 && num >= -list.length) { |
|||
posNum.push(list.length + num) |
|||
} |
|||
else { |
|||
continue; |
|||
} |
|||
} |
|||
var separator = $('.ncSeparator', this).text(); |
|||
var hasSeparator = (separator != ''); |
|||
if(hasSeparator) { |
|||
var newList = $('<div></div>'); |
|||
} |
|||
else { |
|||
var newList = $('<ul></ul>'); |
|||
} |
|||
for(var i = 0; i < posNum.length; i++) { |
|||
if(hasSeparator) { |
|||
newList.append(list.eq(posNum[i]).html()); |
|||
if(i != posNum.length -1) { |
|||
newList.append(separator); |
|||
} |
|||
} |
|||
else { |
|||
newList.append('<li>' + list.eq(posNum[i]).html() + '</li>'); |
|||
} |
|||
} |
|||
$(this).html('').append(newList); |
|||
}); |
|||
return; |
|||
} |
|||
// Elenchi random |
|||
function randomList() { |
|||
if($('.randomlist').length && $('.randomcontent').length && $('.randomtext').length) { |
|||
var randList = $('.randomlist'); |
|||
var randContent = $('.randomcontent'); |
|||
var randText = $('.randomtext'); |
|||
for(var i = 0; i < randList.length; i++) { |
|||
var max = parseInt(randList.eq(i).attr('title')); |
|||
var list = $('li', randContent.eq(i)); |
|||
var text = randText.eq(i); |
|||
var N = new Array(); |
|||
var dot = max == 1 ? '' : '• '; |
|||
text.text(''); |
|||
for(var j = 0; j < max; j++) { |
|||
do { |
|||
n = Math.round(Math.random() * (list.length - 1)); |
|||
for (var k = 0; k < j && n != -1; k++) { |
|||
if (N[k] == n) { |
|||
n = -1; |
|||
} |
|||
} |
|||
} while(n == -1) |
|||
N[j] = n; |
|||
var item = $('<div></div>'); |
|||
item.text(dot + list.eq(n).text()); |
|||
text.append(item); |
|||
} |
|||
} |
|||
} |
|||
return; |
|||
} |
|||
// Funzioni (2) di countdown |
|||
var timers = new Array(); |
|||
// Parametri: |
|||
// i: Indice del contatore |
|||
function updateTimer(i) { |
|||
var node = $('span.countdowntimer').eq(i); |
|||
var now = new Date(); |
|||
var then = new Date(); |
|||
then.setTime(node.attr('eventdate')); |
|||
var diff = Math.floor((then.getTime() - now.getTime()) / 1000); |
|||
// catch bad date strings |
|||
if(isNaN(diff)) { |
|||
node.text('** ' + then.toString() + ' **'); |
|||
return; |
|||
} |
|||
diff = Math.abs(diff); |
|||
var left = ' '; |
|||
// calcuate the diff |
|||
left = (diff % 60) + ' secondi ' + left; |
|||
diff = Math.floor(diff / 60); |
|||
if(diff > 0) { |
|||
left = (diff % 60) + ' minuti e ' + left; |
|||
} |
|||
diff = Math.floor(diff / 60); |
|||
if(diff > 0) { |
|||
left = (diff % 24) + ' ore, ' + left; |
|||
} |
|||
diff = Math.floor(diff / 24); |
|||
if(diff > 0) { |
|||
left = diff + ' giorni, ' + left |
|||
} |
|||
node.text(left); |
|||
// a setInterval() is more efficient, but calling setTimeout() |
|||
// makes errors break the script rather than infinitely recurse |
|||
timers[i] = setTimeout('updateTimer(' + i + ')',1000); |
|||
return; |
|||
} |
|||
function checkTimers() { |
|||
$('span.notimer').hide(); |
|||
$('span.countdowntimer').each(function(i) { |
|||
var node = $(this); |
|||
date = new Date(node.text()) |
|||
node.attr('eventdate', date.getTime()).text('0 giorni 0 ore 0 minuti 0 secondi').css('display', 'inline'); |
|||
updateTimer(i); |
|||
}); |
|||
return; |
|||
} |
|||
// Funzioni (2) per il Template:Counter |
|||
// Autore: Genuzzo |
|||
function coolCounterUpdate(text) { |
|||
text = text.split('>')[1].split('\n')[0].replace(/\./g, ''); |
|||
if(!initializedCounter) { |
|||
myCounter = new flipCounter('flip-counter', {value: text, inc: 0, pace: 0, auto: false}); |
|||
myCounter.add(1000); |
|||
$('#coolcounterwait').remove(); |
|||
initializedCounter = true; |
|||
} |
|||
myCounter.setValue(text); |
|||
return; |
|||
} |
|||
function initializeCoolCounter() { |
|||
if($('#flip-counter').length > 0) { |
|||
urll = '/api.php?action=parse&text={{NUMBEROFEDITS}}&format=xml'; |
|||
initializedCounter = false; |
|||
setInterval(function() { |
|||
$.ajax({ |
|||
url: wgServer + wgScriptPath + urll, |
|||
dataType: 'text', |
|||
success: function(data) { |
|||
coolCounterUpdate(data); |
|||
} |
|||
}); |
|||
}, 5000); |
|||
} |
|||
return; |
|||
} |
|||
// Class che aggiunge "target= '_blank'" ai link |
|||
function targetBlank() { |
|||
var tags = $('.target-blank a'); |
|||
if(!tags.length) { |
|||
return; |
|||
} |
|||
tags.attr('target', '_blank'); |
|||
return; |
|||
} |
|||
// Funzione per inserire il nome utente in appositi elementi |
|||
// Autore: Sparkla |
|||
function usernameReplace() { |
|||
var spanList = $('span.insertusername'); |
|||
if(!spanList.length) { |
|||
return; |
|||
} |
|||
var defaultText = '<tuo nome>'; |
|||
if(wgUserName) { |
|||
spanList.text(wgUserName); |
|||
return; |
|||
} |
|||
else { |
|||
spanList.text(defaultText); |
|||
} |
|||
var userPage = $('#pt-anonuserpage'); |
|||
if(userPage.length > 0) { |
|||
var IP = $('a:first', userPage); |
|||
if(!IP.length) { |
|||
return; |
|||
} |
|||
spanList.each(function() { |
|||
if($(this).text() == defaultText) { |
|||
$(this).text(IP.text()); |
|||
} |
|||
}); |
|||
return; |
|||
} |
|||
var IP = undefined; |
|||
$.ajax({ |
|||
url: wgServer + wgScriptPath + '/api.php?action=query&meta=userinfo&format=xml', |
|||
dataType: 'xml', |
|||
async: false, |
|||
success: function(data) { |
|||
IP = $('userinfo', data).attr('name'); |
|||
} |
|||
}); |
|||
if(!IP) { |
|||
return; |
|||
} |
|||
spanList.each(function() { |
|||
if($(this).text() == defaultText) { |
|||
$(this).text(IP); |
|||
} |
|||
}); |
|||
return; |
|||
} |
|||
// Funzioni (2) per gestire gli alert |
|||
// Carica un alert su un link prima di caricare la nuova pagina, oppure su un link "fasullo", senza caricare nessuna nuova pagina |
|||
function alertLink() { |
|||
$('span.alert-link,span.alert-nolink').each(function() { |
|||
var link = $('a:first', this); |
|||
var text = $(this).attr('title'); |
|||
link.click(function() { |
|||
alert(text); |
|||
}); |
|||
if($(this).hasClass('alert-nolink')) { |
|||
link.attr('href', '#'); |
|||
} |
|||
}); |
|||
return; |
|||
} |
|||
// Carica uno o più alert al caricamento della pagina |
|||
function alertLoad() { |
|||
$('span.alert-load').each(function() { |
|||
alert($(this).text()); |
|||
}); |
|||
return; |
|||
} |
|||
// Visualizza note come tooltip |
|||
// Autore: Sanjilops |
|||
function refTooltip() { |
|||
$('sup.reference').each(function() { |
|||
var span = $('<span></span>'); |
|||
var id = $(this).attr('id').replace(/^cite\_ref\-/, ''); |
|||
span.attr({ |
|||
'class': 'reference-tt', |
|||
'id': 'cite-tt' + id |
|||
}); |
|||
var ref = $('#cite_note-' + id.replace(/_(\d+)-\d+$/, '-$1') + ' span.reference-text').html(); |
|||
if(!ref) { |
|||
return; |
|||
} |
|||
span.html(ref); |
|||
if($(this).position().left < $('#bodyContent').width() / 2) { |
|||
span.css('left', ($(this).width() - 1) + 'px'); |
|||
} |
|||
else { |
|||
span.css('right', ($(this).width() - 1) + 'px'); |
|||
} |
|||
span.css('width', ref < 400 ? ref + 'px' : '400px'); |
|||
$(this).append(span); |
|||
}); |
|||
return; |
|||
} |
|||
// Funzioni (2) per il cassetto |
|||
// Parametri: |
|||
// indexNavigationBar: Numero identificativo del cassetto |
|||
function toggleNavigationBar(indexNavigationBar) { |
|||
var navToggle = $('#NavToggle' + indexNavigationBar); |
|||
var navFrame = $('#NavFrame' + indexNavigationBar); |
|||
var navContent = $('>.NavPic, >.NavContent', navFrame); |
|||
if(!navFrame.length || !navToggle.length) { |
|||
return false; |
|||
} |
|||
// Se il cassetto è aperto |
|||
if(navToggle.text() == navigationBarHide) { |
|||
if(!navFrame.hasClass('noSlide') && !noNavSlide) { |
|||
navContent.fadeOut({duration: fadeDelay, queue: false}).slideUp(slideDelay); |
|||
} |
|||
else { |
|||
navContent.hide(); |
|||
} |
|||
navToggle.text(navigationBarShow); |
|||
} |
|||
// Se il cassetto è chiuso |
|||
else if(navToggle.text() == navigationBarShow) { |
|||
if(!navFrame.hasClass('noSlide') && !noNavSlide) { |
|||
navContent.fadeIn({duration: fadeDelay, queue: false}).hide().slideDown(slideDelay); |
|||
} |
|||
else { |
|||
navContent.show(); |
|||
} |
|||
navToggle.text(navigationBarHide); |
|||
} |
|||
return; |
|||
} |
|||
function createNavigationBarToggleButton() { |
|||
var indexNavigationBar = 0; |
|||
$('div.NavFrame').each(function() { |
|||
indexNavigationBar++; |
|||
var index = indexNavigationBar; |
|||
var navToggle = $('<span></span>'); |
|||
navToggle.attr({ |
|||
'class': 'NavToggle morphLink', |
|||
'id': 'NavToggle' + index, |
|||
'onclick': 'toggleNavigationBar(\'' + index + '\');' |
|||
}); |
|||
navToggle.text(navigationBarHide); |
|||
$('>.NavHead', this).append(navToggle); |
|||
$(this).attr({ |
|||
'id': 'NavFrame' + index |
|||
}); |
|||
}); |
|||
if(navigationBarShowDefault < indexNavigationBar) { |
|||
for(var i = 1; i <= indexNavigationBar; i++) { |
|||
toggleNavigationBar(i); |
|||
} |
|||
} |
|||
return; |
|||
} |
|||
// Funzioni (2) di toggleLink |
|||
// Autore: WhiteMystery |
|||
function toggleCollapse(objToToggle) { |
|||
var linkText = ''; |
|||
var targetObject = $('#' + objToToggle); |
|||
if(!targetObject.length) { |
|||
return; |
|||
} |
|||
var collapseText = $('#' + objToToggle + 'CollapseText').html(); |
|||
var expandText = $('#' + objToToggle + 'ExpandText').html(); |
|||
var slide = !$('#' + objToToggle + 'Link').hasClass('noSlide') && !noMorphSFX; |
|||
var fade = !$('#' + objToToggle + 'Link').hasClass('noFade') && !noMorphSFX; |
|||
if(targetObject.is(':hidden')) { |
|||
if(fade && slide) { |
|||
targetObject.fadeIn({duration: slideDelay, queue: false}).hide().slideDown(fadeDelay); |
|||
// I delay sono volutamente invertiti |
|||
} |
|||
else if(!fade && slide) { |
|||
targetObject.slideDown(slideDelay); |
|||
} |
|||
else if(fade && !slide) { |
|||
targetObject.fadeIn(fadeDelay); |
|||
} |
|||
else { |
|||
targetObject.show(); |
|||
} |
|||
linkText = collapseText; |
|||
} |
|||
else { |
|||
if(fade && slide) { |
|||
targetObject.fadeOut({duration: fadeDelay, queue: false}).slideUp(slideDelay); |
|||
} |
|||
else if(!fade && slide) { |
|||
targetObject.slideUp(slideDelay); |
|||
} |
|||
else if(fade && !slide) { |
|||
targetObject.fadeOut(fadeDelay); |
|||
} |
|||
else { |
|||
targetObject.hide(); |
|||
} |
|||
linkText = expandText; |
|||
} |
|||
$('#' + objToToggle + 'Link-').html(linkText); |
|||
return; |
|||
} |
|||
function createToggleLinks() { |
|||
$('.toggleLink').each(function() { |
|||
var spanID = $(this).attr('id'); |
|||
var targetID = spanID.replace(/Link$/, ''); |
|||
var collapseText = $('#' + targetID + 'CollapseText').html(); |
|||
var expandText = $('#' + targetID + 'ExpandText').html(); |
|||
var initialState = $('#' + targetID + 'InitialState').text(); |
|||
var toggleLink = $('<span></span>'); |
|||
$(this).append(toggleLink); |
|||
if(initialState == '0') { |
|||
$('#' + targetID).hide(); |
|||
toggleLink.html(expandText); |
|||
} |
|||
else { |
|||
$('#' + targetID).show(); |
|||
toggleLink.html(collapseText); |
|||
} |
|||
toggleLink.attr({ |
|||
'id': targetID + 'Link-', |
|||
'class': 'morphLink', |
|||
'onclick': 'toggleCollapse(\'' + targetID + '\');' |
|||
}); |
|||
}); |
|||
return; |
|||
} |
|||
// Funzioni (5) del morph 2.0 |
|||
// Autore: MFH |
|||
// Parametri: |
|||
// targetID: ID dell'oggetto morphizzato |
|||
// targetNumber: Numero dell'elemento che si vuole visualizzare |
|||
function performMorph(targetID, targetNumber) { |
|||
var master = $('#' + targetID + 'Master'); |
|||
var maxNumber = master.attr('max'); |
|||
for(var i = 1; i <= maxNumber; i++) { |
|||
$('.' + targetID + 'Content' + i).hide(); |
|||
} |
|||
if(master.hasClass('noFade') || noMorphSFX) { |
|||
$('.' + targetID + 'Content' + targetNumber).show(); |
|||
} |
|||
else { |
|||
$('.' + targetID + 'Content' + targetNumber).fadeIn({duration: fadeDelay, queue: false}); |
|||
} |
|||
if(master.hasClass('noLoop')) { |
|||
if(targetNumber == 1) { |
|||
$('.' + targetID + 'LinkNext').show(); |
|||
$('.' + targetID + 'LinkPrev').hide(); |
|||
} |
|||
else if(targetNumber == maxNumber) { |
|||
$('.' + targetID + 'LinkNext').hide(); |
|||
$('.' + targetID + 'LinkPrev').show(); |
|||
} |
|||
else { |
|||
$('.' + targetID + 'LinkNext').show(); |
|||
$('.' + targetID + 'LinkPrev').show(); |
|||
} |
|||
} |
|||
$('.' + targetID + 'Counter').text('(' + targetNumber + '/' + maxNumber + ')'); |
|||
master.attr('pos', targetNumber); |
|||
return; |
|||
} |
|||
function morphForward(targetID) { |
|||
var master = $('#' + targetID + 'Master'); |
|||
var maxPane = parseInt(master.attr('max')); |
|||
var nextPane = parseInt(master.attr('pos')) + 1; |
|||
if(nextPane <= maxPane) { |
|||
performMorph(targetID, nextPane); |
|||
} |
|||
else { |
|||
performMorph(targetID, '1'); |
|||
} |
|||
return; |
|||
} |
|||
function morphBackward(targetID) { |
|||
var master = $('#' + targetID + 'Master'); |
|||
var maxPane = parseInt(master.attr('max')); |
|||
var prevPane = parseInt(master.attr('pos')) - 1; |
|||
if(prevPane > 0) { |
|||
performMorph(targetID, prevPane); |
|||
} |
|||
else { |
|||
performMorph(targetID, maxPane); |
|||
} |
|||
return; |
|||
} |
|||
function morphRandom(targetID) { |
|||
var master = $('#' + targetID + 'Master'); |
|||
var maxPane = parseInt(master.attr('max')); |
|||
var randPane = Math.floor(Math.random() * maxPane + 1); |
|||
performMorph(targetID, randPane); |
|||
return; |
|||
} |
|||
function createMorphLinks() { |
|||
$('.morphMaster').each(function() { |
|||
var spanID = $(this).attr('id'); |
|||
var targetID = spanID.replace(/Master$/, ''); |
|||
var noLoop = $(this).hasClass('noLoop'); |
|||
var startPane = parseInt($('#' + targetID + 'Start').text()); |
|||
var counter = 1; |
|||
while($('.' + targetID + 'Content' + counter).length) { // Creazione link diretti |
|||
$('.' + targetID + 'Link' + counter).addClass('morphLink').attr('onclick', 'performMorph(\'' + targetID + '\', \'' + counter + '\');'); |
|||
$('.' + targetID + 'Content' + counter).hide(); // Preparazione contenuti |
|||
counter++; |
|||
} |
|||
$('#' + targetID + 'Start').remove(); |
|||
if(startPane >= 1 && startPane <= counter - 1) { |
|||
$('.' + targetID + 'Content' + startPane).show(); |
|||
} |
|||
else { |
|||
$('.' + targetID + 'Content1').show(); |
|||
startPane = 1 |
|||
} |
|||
if($('.' + targetID + 'Counter').length) { |
|||
$('.' + targetID + 'Counter').text('(' + startPane + '/' + (counter - 1) + ')'); |
|||
} |
|||
if($('.' + targetID + 'Content1').length) { // Creazione link di scorrimento |
|||
var nextLink = $('.' + targetID + 'LinkNext'); |
|||
nextLink.addClass('morphLink').attr('onclick', 'morphForward(\'' + targetID + '\');'); |
|||
if(noLoop && startPane == counter - 1) { |
|||
nextLink.hide(); |
|||
} |
|||
var prevLink = $('.' + targetID + 'LinkPrev'); |
|||
prevLink.addClass('morphLink').attr('onclick', 'morphBackward(\'' + targetID + '\');'); |
|||
if(noLoop && startPane == 1) { |
|||
prevLink.hide(); |
|||
} |
|||
} |
|||
$('.' + targetID + 'LinkRandom').addClass('morphLink').attr('onclick', 'morphRandom(\'' + targetID + '\');'); // Creazione link random |
|||
$(this).hide().attr({ |
|||
'pos': startPane, |
|||
'max': counter - 1 |
|||
}); |
|||
}); |
|||
return; |
|||
} |
|||
/************** TEST ***************/ |
|||
// Funzioni (8) per generare i test |
|||
// Autore: MFH |
|||
// Parametri: |
|||
// opArray: Array con operatori e numeri |
|||
// posArray: Array delle posizioni |
|||
function opSolve(opArray, posArray) { |
|||
var opDivided = new Array(Array(opArray[posArray[0]][0])); |
|||
var posDivided = new Array(Array(posArray[0], 0)); // Posizione, length-1 |
|||
var opDivInd = 0; |
|||
for(var i = 1; i < posArray.length; i++) { // Separa le differenti parentesi |
|||
if(posArray[i] == posArray[i-1] + 1) { |
|||
opDivided[opDivInd].push(opArray[posArray[i]][0]); |
|||
posDivided[opDivInd][1] = posDivided[opDivInd][1] + 1; |
|||
} |
|||
else { |
|||
opDivInd = opDivInd + 1; |
|||
posDivided.push(Array(posArray[i], 1)); |
|||
} |
|||
} |
|||
for(var i = 0; i <= opDivInd; i++) { |
|||
for(var j = 1; j < opDivided[opDivInd].length - 1; j++) { |
|||
if(opDivided[i][j] == '^') { |
|||
opDivided[i][j-1] = Math.pow(parseFloat(opDivided[i][j-1]),parseFloat(opDivided[i][j+1])); |
|||
opDivided[i].splice(j, 2); |
|||
j = j - 1; |
|||
} |
|||
} |
|||
for(var j = 1; j < opDivided[opDivInd].length - 1; j++) { |
|||
if(opDivided[i][j] == '*') { |
|||
opDivided[i][j-1] = parseFloat(opDivided[i][j-1])*parseFloat(opDivided[i][j+1]); |
|||
opDivided[i].splice(j, 2); |
|||
j = j - 1; |
|||
} |
|||
if(opDivided[i][j] == '/') { |
|||
opDivided[i][j-1] = parseFloat(opDivided[i][j-1])/parseFloat(opDivided[i][j+1]); |
|||
opDivided[i].splice(j, 2); |
|||
j = j - 1; |
|||
} |
|||
} |
|||
for(var j = 1; j < opDivided[opDivInd].length - 1; j++) { |
|||
if(opDivided[i][j] == '+') { |
|||
opDivided[i][j-1] = parseFloat(opDivided[i][j-1])+parseFloat(opDivided[i][j+1]); |
|||
opDivided[i].splice(j, 2); |
|||
j = j - 1; |
|||
} |
|||
if(opDivided[i][j] == '-') { |
|||
opDivided[i][j-1] = parseFloat(opDivided[i][j-1])-parseFloat(opDivided[i][j+1]); |
|||
opDivided[i].splice(j, 2); |
|||
j = j - 1; |
|||
} |
|||
} |
|||
} |
|||
for(var i = posDivided.length -1; i >= 0; i--) { |
|||
opArray[posDivided[i][0]] = Array(opDivided[i][0], opArray[posDivided[i][0]][1] - 1); |
|||
opArray.splice(posDivided[i][0]+1, posDivided[i][1]); |
|||
} |
|||
return opArray; |
|||
} |
|||
// Parametri: |
|||
// operation: Stringa contenente l'espressione da risolvere |
|||
// xValue: Valore della variabile x nella stringa |
|||
function mathParser(operation, xValue) { |
|||
var opArray = new Array(); |
|||
var brInd = 0; /* Bracket index */ |
|||
var brIndMax = 0; |
|||
for(var i = 0; i < operation.length; i++) { // Divide la stringa in singoli caratteri |
|||
var textChunk = operation.substr(i,1); |
|||
if(textChunk != ' ') { // Rimuove spazi inutili |
|||
if(textChunk == '(') { // Rimuove le parentesi conservando l'informazione |
|||
brInd = brInd + 1; |
|||
if(brInd > brIndMax) { |
|||
brIndMax = brInd; |
|||
} |
|||
} |
|||
else if(textChunk == ')') { |
|||
brInd = brInd - 1; |
|||
} |
|||
else if(textChunk == 'x') { |
|||
opArray.push(Array(xValue, brInd)); |
|||
} |
|||
else { |
|||
opArray.push(Array(textChunk, brInd)); |
|||
} |
|||
} |
|||
} |
|||
i = 0; |
|||
while(i < opArray.length - 1) { // Rimette assieme i numeri |
|||
if((opArray[i][0].match(/[0-9\.]/) || (opArray[i][0].match(/-/) && (i == 0 || opArray[i-1][1] < opArray[i][1]))) && opArray[i+1][0].match(/[0-9\.]/)) { |
|||
// Se è un numero o una virgola, o se c'è un meno all'inizio di una parentesi; e il carattere successivo è un numero o una virgola |
|||
opArray[i][0] = opArray[i][0] + opArray[i+1][0]; |
|||
opArray.splice(i+1, 1); |
|||
} |
|||
else { |
|||
i++; |
|||
} |
|||
} |
|||
for(var i = brIndMax; i >= 0; i--) { |
|||
var posArray = new Array(); |
|||
for(var j = 0; j < opArray.length; j++) { |
|||
if(opArray[j][1] == i) { |
|||
posArray.push(j); |
|||
} |
|||
} |
|||
opArray = opSolve(opArray, posArray); |
|||
} |
|||
return opArray[0][0]; |
|||
} |
|||
function chooseTag() { |
|||
if(wgNamespaceNumber < 0) { |
|||
return false; |
|||
} |
|||
if(wgAction == 'edit' || wgAction == 'submit') { |
|||
return 'wikiPreview'; |
|||
} |
|||
else if(wgAction == 'view' || wgAction == 'purge' || wgAction == 'historysubmit') { |
|||
return 'bodyContent'; |
|||
} |
|||
else if(wgAction == 'view' && (window.location.href.match('&diff=') || window.location.href.match('&oldid='))) { |
|||
return 'bodyContent'; |
|||
} |
|||
else { |
|||
return false; |
|||
} |
|||
} |
|||
var testGroups = new Array(); // Array associativo, ogni elemento è associato al nome del gruppo del test |
|||
// Sintassi: testGroups[nomeGruppo][domanda][risposta] |
|||
// nomeGruppo: Nome dato attraverso l'attributo group nel tag test |
|||
// domanda: Numero che identifica la domanda, solo ad uso interno |
|||
// risposta: Numero che identifica il testo della risposta, alternato al valore di ogni risposta |
|||
var testResults = new Array(); // Array associativo, contiene i risultati dei test |
|||
// Sintassi: testResults[nomeGruppo][profilo] |
|||
// nomeGruppo: Come sopra |
|||
// profilo: Numero che identifica il testo dei profili, alternato al valore massimo di ogni profilo |
|||
function createTags() { |
|||
var parentTag = chooseTag(); |
|||
if(!parentTag) { |
|||
return; |
|||
} |
|||
var page = $('#' + parentTag); |
|||
var pageOld = page.clone(true); |
|||
pageOld = pageOld.remove('table.diff:first').html(); |
|||
var pageNew = pageOld.replace(/\< ?(\/?) ?test(result)?\b(.*?)\>\;/g, '<$1test$2$3>').replace(/\< ?(\/?) ?abc(result)?\b(.*?)\>\;/g, '<$1abc$2$3>'); |
|||
page.html(page.html().replace(pageOld, pageNew)); |
|||
return; |
|||
} |
|||
function displayTest() { |
|||
var tagId = chooseTag(); |
|||
if(!tagId) { |
|||
return; |
|||
} |
|||
$('test').each(function() { |
|||
var test = $(this); |
|||
if(test.attr('group')) { |
|||
var testGroup = test.attr('group'); |
|||
} |
|||
else { |
|||
var testGroup = 'test'; |
|||
} |
|||
if(test.attr('type')) { |
|||
var testType = test.attr('type'); |
|||
} |
|||
else { |
|||
var testType = 'mct'; |
|||
} |
|||
if(testGroups[testGroup]) { |
|||
testGroups[testGroup].push(test.html().split('|')); |
|||
} |
|||
else { |
|||
testGroups[testGroup] = new Array(test.html().split('|')); |
|||
} |
|||
var testPos = testGroups[testGroup].length - 1; |
|||
var testStructure = $('<form></form>'); |
|||
var testTitle = $('<div></div>').css('font-weight', '700').html(testGroups[testGroup][testPos][0]); |
|||
testStructure.append(testTitle); |
|||
for(var i = 0; i < (testGroups[testGroup][testPos].length - 1) / 2; i++) { |
|||
var testInput = $('<input />').attr('class', 'test'); |
|||
var testLabel = $('<label></label>'); |
|||
if(testType == 'sct' || testType == 'single') { |
|||
testInput.attr({ |
|||
'type': 'radio', |
|||
'name': testGroup, |
|||
'value': testGroups[testGroup][testPos][2 * i + 2] |
|||
}); |
|||
testLabel.html(testGroups[testGroup][testPos][2 * i + 1]); |
|||
testStructure.append(testInput, ' ', testLabel, '<br />'); |
|||
} |
|||
else if(testType == 'ins' || testType == 'insert') { |
|||
testInput.attr({ |
|||
'type': 'text', |
|||
'name': testGroup, |
|||
'value': '0', |
|||
'alt': testGroups[testGroup][testPos][2 * i + 2] |
|||
}); |
|||
testLabel.html(testGroups[testGroup][testPos][2 * i + 1]); |
|||
testStructure.append(testLabel, ' ', testInput, '<br />'); |
|||
} |
|||
else { // For testType == 'mct' or testType == 'multi' |
|||
testInput.attr({ |
|||
'type': 'checkbox', |
|||
'name': testGroup, |
|||
'value': testGroups[testGroup][testPos][2 * i + 2] |
|||
}); |
|||
testLabel.html(testGroups[testGroup][testPos][2 * i + 1]); |
|||
testStructure.append(testInput, ' ', testLabel, '<br />'); |
|||
} |
|||
} |
|||
test.replaceWith(testStructure); |
|||
}); |
|||
$('testresult').each(function() { |
|||
var testResult = $(this); |
|||
if(testResult.attr('group')) { |
|||
var resultGroup = testResult.attr('group'); |
|||
} |
|||
else { |
|||
var resultGroup = 'test'; |
|||
} |
|||
if(testResult.html().split('|').length > 1) { |
|||
testResults[resultGroup] = testResult.html().split('|'); |
|||
} |
|||
else { |
|||
testResults[resultGroup] = null; |
|||
} |
|||
var resultStructure = $('<div></div>'); |
|||
var resultSubmit = $('<input />').attr({ |
|||
'type': 'submit', |
|||
'name': resultGroup, |
|||
'value': 'Risultato', |
|||
}).click(function() { |
|||
calculateTestResult(resultGroup); |
|||
}); |
|||
var resultText = $('<div></div>').attr('id', resultGroup); |
|||
resultStructure.append(resultSubmit, resultText); |
|||
testResult.replaceWith(resultStructure); |
|||
}); |
|||
return; |
|||
} |
|||
// Parametri: |
|||
// group: Nome del gruppo |
|||
function calculateTestResult(group) { |
|||
if (testGroups[group]) { |
|||
var resultScore = 0; |
|||
$('input.test[name=' + group + ']:checked(:checkbox,:radio)').each(function() { |
|||
resultScore += parseFloat($(this).attr('value')); |
|||
}); |
|||
$('input.test[name=' + group + ']:text').each(function() { |
|||
if(!$(this).attr('value')) { |
|||
resultScore += mathParser($(this).attr('alt'), 0); |
|||
} |
|||
else { |
|||
resultScore += mathParser($(this).attr('alt'), $(this).attr('value')); |
|||
} |
|||
}); |
|||
if (testResults[group]) { |
|||
var resultProfile = ''; |
|||
if(resultScore <= parseFloat(testResults[group][2])) { |
|||
resultProfile = testResults[group][1]; |
|||
} |
|||
else if(testResults[group].length >= 4) { |
|||
for(var i = 1; i < testResults[group].length / 2 - 1; i++) { |
|||
if(resultScore > parseFloat(testResults[group][2 * i]) && resultScore <= parseFloat(testResults[group][2 * i + 2])) { |
|||
resultProfile = testResults[group][2 * i + 1]; |
|||
} |
|||
} |
|||
if(!resultProfile) { |
|||
resultProfile = testResults[group][testResults[group].length - 1]; |
|||
} |
|||
} |
|||
var resultTitle = $('<div></div>').css('font-weight', '700').html(testResults[group][0]); |
|||
$('#' + group).html('').append(resultTitle, 'Hai ottenuto ' + resultScore + ' punti.<br />', resultProfile); |
|||
} |
|||
else { |
|||
$('#' + group).html('Hai ottenuto ' + resultScore + ' punti.'); |
|||
} |
|||
} |
|||
else { |
|||
$('#' + group).html('Errore! Gruppo non riconosciuto. Ricontrollare il codice per favore.'); |
|||
} |
|||
return; |
|||
} |
|||
var abcGroups = new Array(); // Array associativo, ogni elemento è associato al nome del gruppo del test abc |
|||
// Sintassi: abcGroups[nomeGruppo][domanda][risposta] |
|||
// nomeGruppo: Nome dato attraverso l'attributo group nel tag abc |
|||
// domanda: Numero che identifica la domanda, solo ad uso interno |
|||
// risposta: Numero che identifica il testo della risposta |
|||
var abcResults = new Array(); // Array associativo, contiene i risultati dei test abc |
|||
// Sintassi: abcResults[nomeGruppo][profilo] |
|||
// nomeGruppo: Come sopra |
|||
// profilo: Numero che identifica il testo dei profili |
|||
function displayAbc() { |
|||
var tagId = chooseTag(); |
|||
if(!tagId) { |
|||
return; |
|||
} |
|||
$('abc').each(function() { |
|||
var abc = $(this); |
|||
if(abc.attr('group')) { |
|||
var abcGroup = abc.attr('group'); |
|||
} |
|||
else { |
|||
var abcGroup = 'abc'; |
|||
} |
|||
if(abcGroups[abcGroup]) { |
|||
abcGroups[abcGroup].push(abc.html().split('|')); |
|||
} |
|||
else { |
|||
abcGroups[abcGroup] = new Array(abc.html().split('|')); |
|||
} |
|||
var abcPos = abcGroups[abcGroup].length - 1; |
|||
var abcStructure = $('<form></form>'); |
|||
var abcTitle = $('<div></div>').css('font-weight', '700').html(abcGroups[abcGroup][abcPos][0]); |
|||
abcStructure.append(abcTitle); |
|||
for(var i = 0; i < abcGroups[abcGroup][abcPos].length - 1; i++) { |
|||
var abcInput = $('<input />').attr({ |
|||
'class': 'abc', |
|||
'type': 'radio', |
|||
'name': abcGroup, |
|||
'value': i |
|||
}); |
|||
var abcLabel = $('<label></label>').html(String.fromCharCode(i + 65) + ': ' + abcGroups[abcGroup][abcPos][i + 1]); |
|||
abcStructure.append(abcInput, ' ', abcLabel, '<br />'); |
|||
} |
|||
abc.replaceWith(abcStructure); |
|||
}); |
|||
$('abcresult').each(function() { |
|||
var abcResult = $(this); |
|||
if(abcResult.attr('group')) { |
|||
var resultGroup = abcResult.attr('group'); |
|||
} |
|||
else { |
|||
var resultGroup = 'abc'; |
|||
} |
|||
if(abcResult.html().split('|').length > 1) { |
|||
abcResults[resultGroup] = abcResult.html().split('|'); |
|||
for(var i = 1; i < abcResults[resultGroup].length; i++) { |
|||
abcResults[resultGroup][i] = '<span style="font-weight: 700;">Maggioranza di ' + String.fromCharCode(i + 64) + ":</span> " + abcResults[resultGroup][i]; |
|||
} |
|||
} |
|||
var resultStructure = $('<div></div>'); |
|||
var resultSubmit = $('<input />').attr({ |
|||
'type': 'submit', |
|||
'name': resultGroup, |
|||
'value': 'Risultato', |
|||
}).click(function() { |
|||
calculateAbcResult(resultGroup); |
|||
}); |
|||
var resultText = $('<div></div>').attr('id', resultGroup); |
|||
resultStructure.append(resultSubmit, resultText); |
|||
abcResult.replaceWith(resultStructure); |
|||
}); |
|||
return; |
|||
} |
|||
// Parametri: |
|||
// group: Nome del gruppo |
|||
function calculateAbcResult(group) { |
|||
if (abcGroups[group]) { |
|||
var inputButtons = document.getElementsByTagName('input'); |
|||
var resultScore = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); |
|||
var resultMax = 0; |
|||
var resultMaxProfiles = new Array(); |
|||
$('input.abc[name=' + group + ']:radio:checked').each(function() { |
|||
resultScore[parseInt($(this).attr('value'))] += 1; |
|||
}); |
|||
for(var i = 0; i < resultScore.length; i++) { |
|||
if(resultScore[i] > resultMax) { |
|||
resultMax = resultScore[i]; |
|||
} |
|||
} |
|||
for(var i = 0; i < resultScore.length; i++) { |
|||
if(resultScore[i] == resultMax) { |
|||
resultMaxProfiles.push(i); |
|||
} |
|||
} |
|||
if(abcResults[group]) { |
|||
var resultTitle = $('<div></div>').css('font-weight', '700').html(abcResults[group][0]); |
|||
$('#' + group).html('').append(resultTitle); |
|||
for(var i = 0; i < resultMaxProfiles.length; i++) { |
|||
if(abcResults[group][resultMaxProfiles[i] + 1] != undefined) { |
|||
$('#' + group).append('<br />' + abcResults[group][resultMaxProfiles[i] + 1]); |
|||
} |
|||
} |
|||
} |
|||
else { |
|||
var resultResponse = 'Hai ottenuto una maggioranza di '; |
|||
for (var j = 0; j < resultMaxProfiles.length; j++) { |
|||
resultResponse += String.fromCharCode(resultMaxProfiles[j] + 65) + ', '; |
|||
} |
|||
resultResponse = resultResponse.slice(0, resultResponse.length - 2); |
|||
$('#' + group).html('').append(resultResponse); |
|||
} |
|||
} |
|||
else { |
|||
$('#' + group).html('Errore! Gruppo non riconosciuto. Ricontrollare il codice per favore.'); |
|||
} |
|||
return; |
|||
} |
|||
/*************** Altro ***************/ |
/*************** Altro ***************/ |
||
Riga 2 274: | Riga 222: | ||
if(skin != 'wikiamobile' && mwCustomEditButtons) { |
if(skin != 'wikiamobile' && mwCustomEditButtons) { |
||
mwCustomEditButtons[mwCustomEditButtons.length] = { |
mwCustomEditButtons[mwCustomEditButtons.length] = { |
||
"imageFile": " |
"imageFile": "https://upload.wikimedia.org/wikipedia/commons/0/0c/Button_P_template.png", |
||
"speedTip": "Template", |
"speedTip": "Template", |
||
"tagOpen": "{{", |
"tagOpen": "{{", |
||
Riga 2 281: | Riga 229: | ||
}; |
}; |
||
mwCustomEditButtons[mwCustomEditButtons.length] = { |
mwCustomEditButtons[mwCustomEditButtons.length] = { |
||
"imageFile": " |
"imageFile": "https://upload.wikimedia.org/wikipedia/commons/0/05/Button_Anf%C3%BChrung.png", |
||
"speedTip": "Citazione", |
"speedTip": "Citazione", |
||
"tagOpen": "{{Cit2|", |
"tagOpen": "{{Cit2|", |
||
Riga 2 291: | Riga 239: | ||
// Pulsanti da aggiungere nella pagina di modifica: sistema di aggiornamento centralizzato |
// Pulsanti da aggiungere nella pagina di modifica: sistema di aggiornamento centralizzato |
||
var pulsanteAccusa = { |
var pulsanteAccusa = { |
||
'imageFile': ' |
'imageFile': 'https://static.miraheze.org/nonciclopediawiki/9/93/Button_Jessica.png', |
||
'speedTip': 'Articolo in dubbio', |
'speedTip': 'Articolo in dubbio', |
||
'tagOpen': '{{Accusa|accusa=', |
'tagOpen': '{{Accusa|accusa=', |
||
'tagClose': '|firma=~~' + '~~}' + '}\n\n', |
'tagClose': '|firma=--~~' + '~~}' + '}\n\n', |
||
'sampleText': 'Inserire qui l\'accusa' |
'sampleText': 'Inserire qui l\'accusa' |
||
}; |
}; |
||
var pulsanteAllinea = { |
var pulsanteAllinea = { |
||
'imageFile': ' |
'imageFile': 'https://static.miraheze.org/nonciclopediawiki/f/f7/Button_align_center.png', |
||
'speedTip': 'Centrato', |
'speedTip': 'Centrato', |
||
'tagOpen': '{{Allinea|center|', |
'tagOpen': '{{Allinea|center|', |
||
Riga 2 307: | Riga 255: | ||
var pulsanteAllineaDX = { |
var pulsanteAllineaDX = { |
||
"imageFile": " |
"imageFile": "https://upload.wikimedia.org/wikipedia/commons/a/a5/Button_align_right.png", |
||
"speedTip": "Align right", |
"speedTip": "Align right", |
||
"tagOpen": '{{Allinea|right|', |
"tagOpen": '{{Allinea|right|', |
||
Riga 2 315: | Riga 263: | ||
var pulsanteAllineaSX = { |
var pulsanteAllineaSX = { |
||
"imageFile": " |
"imageFile": "https://upload.wikimedia.org/wikipedia/commons/e/ea/Button_align_left.png", |
||
"speedTip": "Align left", |
"speedTip": "Align left", |
||
"tagOpen": '{{Allinea|left|', |
"tagOpen": '{{Allinea|left|', |
||
Riga 2 331: | Riga 279: | ||
var pulsanteAPU = { |
var pulsanteAPU = { |
||
'imageFile': ' |
'imageFile': 'https://static.miraheze.org/nonciclopediawiki/0/0a/Button_sad.png', |
||
'speedTip': 'Articolo poco umoristico', |
'speedTip': 'Articolo poco umoristico', |
||
'tagOpen': '{{Accusa|accusa=APU|firma=~~' + '~~}' + '}\n\n', |
'tagOpen': '{{Accusa|accusa=APU|firma=--~~' + '~~}' + '}\n\n', |
||
'tagClose': '', |
'tagClose': '', |
||
'sampleText': '' |
'sampleText': '' |
||
Riga 2 339: | Riga 287: | ||
var pulsanteBarrato = { |
var pulsanteBarrato = { |
||
'imageFile': ' |
'imageFile': 'https://upload.wikimedia.org/wikipedia/en/c/c9/Button_strike.png', |
||
'speedTip': 'Barrato', |
'speedTip': 'Barrato', |
||
'tagOpen': '{{s|', |
'tagOpen': '{{s|', |
||
Riga 2 347: | Riga 295: | ||
var pulsanteBig = { |
var pulsanteBig = { |
||
'imageFile': ' |
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/5/56/Button_big.png', |
||
'speedTip': 'Grande', |
'speedTip': 'Grande', |
||
'tagOpen': '{{Dimensione|125%|', |
'tagOpen': '{{Dimensione|125%|', |
||
Riga 2 355: | Riga 303: | ||
var pulsanteBTA = { |
var pulsanteBTA = { |
||
'imageFile': ' |
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/3/34/Button_MrX.png', |
||
'speedTip': 'Battute tra amici', |
'speedTip': 'Battute tra amici', |
||
'tagOpen': '{{Cancellazione|motivo=BTA|firma=~~' + '~~}' + '}\n\n', |
'tagOpen': '{{Cancellazione|motivo=BTA|firma=--~~' + '~~}' + '}\n\n', |
||
'tagClose': '', |
'tagClose': '', |
||
'sampleText': '' |
'sampleText': '' |
||
Riga 2 363: | Riga 311: | ||
var pulsanteCancellazione = { |
var pulsanteCancellazione = { |
||
'imageFile': ' |
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/0/0c/Button_Chuck.png', |
||
'speedTip': 'Cancellazione immediata (USARE CON CAUTELA!)', |
'speedTip': 'Cancellazione immediata (USARE CON CAUTELA!)', |
||
'tagOpen': '{{Cancellazione|motivo=', |
'tagOpen': '{{Cancellazione|motivo=', |
||
'tagClose': '|firma=~~' + '~~}' + '}\n\n', |
'tagClose': '|firma=--~~' + '~~}' + '}\n\n', |
||
'sampleText': 'Inserire qui il motivo' |
'sampleText': 'Inserire qui il motivo' |
||
}; |
}; |
||
var pulsanteCarattere = { |
var pulsanteCarattere = { |
||
'imageFile': ' |
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/8/8c/Bottone_Carattere.png', |
||
'speedTip': 'Carattere', |
'speedTip': 'Carattere', |
||
'tagOpen': '{{Carattere|Tipo di carattere|dim%|', |
'tagOpen': '{{Carattere|Tipo di carattere|dim%|', |
||
Riga 2 379: | Riga 327: | ||
var pulsanteCassetto = { |
var pulsanteCassetto = { |
||
'imageFile': ' |
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/3/38/Button_cassetto.png', |
||
'speedTip': 'Cassetto', |
'speedTip': 'Cassetto', |
||
'tagOpen': '{{Cassetto|titolo=Titolo cassetto|testo=', |
'tagOpen': '{{Cassetto|titolo=Titolo cassetto|testo=', |
||
Riga 2 395: | Riga 343: | ||
var pulsanteCC = { |
var pulsanteCC = { |
||
'imageFile': ' |
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/0/04/Button_Creative_Commons.png', |
||
'speedTip': 'Creative Commons', |
'speedTip': 'Creative Commons', |
||
'tagOpen': '{{Creative Commons|by=y|nc=y|sa=y|versione=3.0}' + '}\n', |
'tagOpen': '{{Creative Commons|by=y|nc=y|sa=y|versione=3.0}' + '}\n', |
||
Riga 2 403: | Riga 351: | ||
var pulsanteCensura = { |
var pulsanteCensura = { |
||
'imageFile': ' |
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/2/20/Button_censura2.png', |
||
'speedTip': 'Censura', |
'speedTip': 'Censura', |
||
'tagOpen': '{{Censura|', |
'tagOpen': '{{Censura|', |
||
Riga 2 411: | Riga 359: | ||
var pulsanteCit2 = { |
var pulsanteCit2 = { |
||
'imageFile': ' |
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/6/6f/Button_cit2.png', |
||
'speedTip': 'Citazione 2', |
'speedTip': 'Citazione 2', |
||
'tagOpen': '{{Cit2|', |
'tagOpen': '{{Cit2|', |
||
Riga 2 419: | Riga 367: | ||
var pulsanteCitnec = { |
var pulsanteCitnec = { |
||
'imageFile': ' |
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/f/f6/Button_Citnec.png', |
||
'speedTip': 'Citazione necessaria', |
'speedTip': 'Citazione necessaria', |
||
'tagOpen': '{{Citnec|', |
'tagOpen': '{{Citnec|', |
||
Riga 2 427: | Riga 375: | ||
var pulsanteColonne = { |
var pulsanteColonne = { |
||
'imageFile': ' |
'imageFile': 'https://images.wikia.nocookie.net/__cb20100806112827/nonciclopedia/images/1/15/Button_colonne.png', |
||
'speedTip': 'Testo in colonne', |
'speedTip': 'Testo in colonne', |
||
'tagOpen': '{{Colonne|col=2|', |
'tagOpen': '{{Colonne|col=2|', |
||
Riga 2 435: | Riga 383: | ||
var pulsanteColore = { |
var pulsanteColore = { |
||
'imageFile': ' |
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/0/0f/Bottone_colore.png', |
||
'speedTip': 'Colore', |
'speedTip': 'Colore', |
||
'tagOpen': '{{Colore|#Codice esadecimale|', |
'tagOpen': '{{Colore|#Codice esadecimale|', |
||
Riga 2 443: | Riga 391: | ||
var pulsanteDimensione = { |
var pulsanteDimensione = { |
||
'imageFile': ' |
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/2/2f/Bottone_dimensione.png', |
||
'speedTip': 'Dimensione', |
'speedTip': 'Dimensione', |
||
'tagOpen': '{{Dimensione|dim%|', |
'tagOpen': '{{Dimensione|dim%|', |
||
Riga 2 451: | Riga 399: | ||
var pulsanteFormattazione1 = { |
var pulsanteFormattazione1 = { |
||
'imageFile': ' |
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/d/d6/E%27fiamme.png', |
||
'speedTip': 'Formattazione', |
'speedTip': 'Formattazione', |
||
'tagOpen': '{{Formattazione|note=', |
'tagOpen': '{{Formattazione|note=', |
||
'tagClose': '|firma=~~' + '~~}' + '}\n\n', |
'tagClose': '|firma=--~~' + '~~}' + '}\n\n', |
||
'sampleText': 'Inserire qui cosa fare' |
'sampleText': 'Inserire qui cosa fare' |
||
}; |
}; |
||
var pulsanteFormattazione2 = { |
var pulsanteFormattazione2 = { |
||
'imageFile': ' |
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/e/e1/E%27mat.png', |
||
'speedTip': 'Formattazione', |
'speedTip': 'Formattazione', |
||
'tagOpen': '{{Formattazione|note=', |
'tagOpen': '{{Formattazione|note=', |
||
'tagClose': '|firma=~~' + '~~}' + '}\n\n', |
'tagClose': '|firma=--~~' + '~~}' + '}\n\n', |
||
'sampleText': 'Inserire qui cosa fare' |
'sampleText': 'Inserire qui cosa fare' |
||
}; |
}; |
||
var pulsanteGallery = { |
var pulsanteGallery = { |
||
'imageFile': ' |
'imageFile': 'https://images.wikia.nocookie.net/central/images/1/12/Button_gallery.png', |
||
'speedTip': 'Galleria di immagini', |
'speedTip': 'Galleria di immagini', |
||
'tagOpen': '\n<gallery>\n', |
'tagOpen': '\n<gallery>\n', |
||
Riga 2 475: | Riga 423: | ||
var pulsanteManuali = { |
var pulsanteManuali = { |
||
'imageFile': ' |
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/f/fe/Bottone_Man.png', |
||
'speedTip': 'Link ai manuali', |
'speedTip': 'Link ai manuali', |
||
'tagOpen': '{{Man|', |
'tagOpen': '{{Man|', |
||
Riga 2 483: | Riga 431: | ||
var pulsanteNomedimmerda = { |
var pulsanteNomedimmerda = { |
||
'imageFile': ' |
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/3/33/Sguardone.png', |
||
'speedTip': 'Immagine da rinominare ', |
'speedTip': 'Immagine da rinominare ', |
||
'tagOpen': '{{Nomedimmerda|scadenza={{subst:7g}' + '}|motivo=', |
'tagOpen': '{{Nomedimmerda|scadenza={{subst:7g}' + '}|motivo=', |
||
'tagClose': '|firma=~~' + '~~}' + '}\n\n', |
'tagClose': '|firma=--~~' + '~~}' + '}\n\n', |
||
'sampleText': 'Inserisci un suggerimento' |
'sampleText': 'Inserisci un suggerimento' |
||
}; |
}; |
||
Riga 2 499: | Riga 447: | ||
var pulsanteRedirect = { |
var pulsanteRedirect = { |
||
'imageFile': ' |
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/7/73/Bottone_redirect.png', |
||
'speedTip': 'Redirect', |
'speedTip': 'Redirect', |
||
'tagOpen': '#REDIRECT [[', |
'tagOpen': '#REDIRECT [[', |
||
Riga 2 507: | Riga 455: | ||
var pulsanteReflink = { |
var pulsanteReflink = { |
||
'imageFile': ' |
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/6/6e/Bottone_reflink.png', |
||
'speedTip': 'Inserisci la nota nel testo', |
'speedTip': 'Inserisci la nota nel testo', |
||
'tagOpen': '<ref>', |
'tagOpen': '<ref>', |
||
Riga 2 515: | Riga 463: | ||
var pulsanteRestauro = { |
var pulsanteRestauro = { |
||
'imageFile': ' |
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/6/6c/Button_restauro.png', |
||
'speedTip': 'Articolo da sistemare', |
'speedTip': 'Articolo da sistemare', |
||
'tagOpen': '{{Restauro|motivo=', |
'tagOpen': '{{Restauro|motivo=', |
||
'tagClose': '|firma=~~' + '~~}' + '}\n\n', |
'tagClose': '|firma=--~~' + '~~}' + '}\n\n', |
||
'sampleText': 'Inserire qui la descrizione' |
'sampleText': 'Inserire qui la descrizione' |
||
}; |
}; |
||
var pulsanteRiquadro1 = { |
var pulsanteRiquadro1 = { |
||
'imageFile': ' |
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/f/f9/Button_box.png', |
||
'speedTip': 'Box', |
'speedTip': 'Box', |
||
'tagOpen': '{{Riquadro\n|larghezza=\n|colore-sfondo=\n|colore-testo=\n|colore-bordo=\n|spessore-bordo=\n|testo=\n|file-sx=\n|largh-file-sx=\n|file-dx=\n|largh-file-dx=\n}' + '}\n', |
'tagOpen': '{{Riquadro\n|larghezza=\n|colore-sfondo=\n|colore-testo=\n|colore-bordo=\n|spessore-bordo=\n|testo=\n|file-sx=\n|largh-file-sx=\n|file-dx=\n|largh-file-dx=\n}' + '}\n', |
||
Riga 2 531: | Riga 479: | ||
var pulsanteRiquadro2 = { |
var pulsanteRiquadro2 = { |
||
'imageFile': ' |
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/f/f9/Button_box.png', |
||
'speedTip': 'Box', |
'speedTip': 'Box', |
||
'tagOpen': '{{Riquadro\n|classe=\n|larghezza=\n|colore-sfondo=\n|colore-testo=\n|colore-bordo=\n|stile-bordo=\n|spessore-bordo=\n|stile-riquadro=\n|testo=\n|file-sx=\n|largh-file-sx=\n|file-dx=\n|largh-file-dx=\n}' + '}\n', |
'tagOpen': '{{Riquadro\n|classe=\n|larghezza=\n|colore-sfondo=\n|colore-testo=\n|colore-bordo=\n|stile-bordo=\n|spessore-bordo=\n|stile-riquadro=\n|testo=\n|file-sx=\n|largh-file-sx=\n|file-dx=\n|largh-file-dx=\n}' + '}\n', |
||
Riga 2 539: | Riga 487: | ||
var pulsanteScadenza = { |
var pulsanteScadenza = { |
||
'imageFile': ' |
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/a/a5/Button_Samara.png', |
||
'speedTip': 'Articolo in scadenza', |
'speedTip': 'Articolo in scadenza', |
||
'tagOpen': '{{Scadenza|scadenza=' + '{{subst:7g}' + '}|note=', |
'tagOpen': '{{Scadenza|scadenza=' + '{{subst:7g}' + '}|note=', |
||
'tagClose': '|firma=~~' + '~~}' + '}\n\n', |
'tagClose': '|firma=--~~' + '~~}' + '}\n\n', |
||
'sampleText': 'Note' |
'sampleText': 'Note' |
||
}; |
}; |
||
var pulsanteSmall = { |
var pulsanteSmall = { |
||
'imageFile': ' |
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/5/58/Button_small.png', |
||
'speedTip': 'Piccolo', |
'speedTip': 'Piccolo', |
||
'tagOpen': '{{Dimensione|80%|', |
'tagOpen': '{{Dimensione|80%|', |
||
Riga 2 555: | Riga 503: | ||
var pulsanteSottolineato = { |
var pulsanteSottolineato = { |
||
'imageFile': ' |
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/f/fd/Button_underline.png', |
||
'speedTip': 'Sottolineato', |
'speedTip': 'Sottolineato', |
||
'tagOpen': '{{u|', |
'tagOpen': '{{u|', |
||
Riga 2 563: | Riga 511: | ||
var pulsanteTabella = { |
var pulsanteTabella = { |
||
'imageFile': ' |
'imageFile': 'https://upload.wikimedia.org/wikipedia/en/6/60/Button_insert_table.png', |
||
'speedTip': 'Tabella', |
'speedTip': 'Tabella', |
||
'tagOpen': '{| class="wikitable"\n|-\n', |
'tagOpen': '{| class="wikitable"\n|-\n', |
||
Riga 2 571: | Riga 519: | ||
var pulsanteVideo = { |
var pulsanteVideo = { |
||
'imageFile': ' |
'imageFile': 'https://images.wikia.nocookie.net/__cb20100915172123/nonciclopedia/images/f/ff/Bottone_video.png', |
||
'speedTip': 'Inserisci un video - Per i parametri aggiuntivi leggi la pagina del template', |
'speedTip': 'Inserisci un video - Per i parametri aggiuntivi leggi la pagina del template', |
||
'tagOpen': '{{YoutubeVideo|', |
'tagOpen': '{{YoutubeVideo|', |
||
Riga 2 579: | Riga 527: | ||
var pulsanteEvidenzia = { |
var pulsanteEvidenzia = { |
||
"imageFile": " |
"imageFile": "https://images.wikia.nocookie.net/__cb20140408123004/nonciclopedia/images/b/b5/Bottone_evidenziatore.png", |
||
"speedTip": "Evidenziatore", |
"speedTip": "Evidenziatore", |
||
"tagOpen": "{{Evidenzia|giallo|", |
"tagOpen": "{{Evidenzia|giallo|", |
Versione attuale delle 10:55, 12 apr 2019
/*************** Variabili di uso globale ***************/
// Variabili per il caricamento della pagina
var hooksCustom = new Array(); // Array di funzioni personalizzate da avviare unicamente al caricamento della pagina
var hooksCustomRender = new Array(); // Array di funzioni personalizzate da avviare al caricamento della pagina e dell'anteprima
// Sintassi:
// Se la funzione non ha bisogno di parametri: hooksCustom.push(nomeFunzione);
// Se invece la funzione ha bisogno di parametri: hooksCustom.push([nomeFunzione, [parametro1, parametro2, ...]]);
// nomeFunzione _non_ deve essere _mai_ fra virgolette! E non bisogna nemmeno scrivere nomeFunzione(), le parentesi non ci vogliono!
// Variabili per gli effetti
var navigationBarHide = '[Nascondi]'; // Usati per il dismissableNotice e il cassetto
var navigationBarShow = '[Vedi]';
var slideDelay = 600; // Usati per cassetto, toggleLink e Morph
var fadeDelay = 400;
var navigationBarShowDefault = 0; // Usato per cassetto
/*************** Variabili di regolazione degli effetti ***************/
var disableHideEdit = false; // Disabilita la funzione hideEditPatch()
var disableTargetBlank = false; // Disabilita la funzione targetBlank()
var disableUsernameReplace = false; // Disabilita la funzione usernameReplace()
// var disableAlert = false; // Disabilita le funzioni alertLink() e alertLoad()
var disableRefTooltip = false; // Disabilita la funzione refTooltip()
var buttonPurge = false; // Abilita la funzione createPurgeButton()
var disableSectionZeroEditLink = false; // Disabilita la funzione sectionZeroEditLink()
var disableAddCSS = false; // Disabilita la funzione addCSS()
var disableAssignTitle = false; // Disabilita la funzione rewriteTitle()
var disableAssignSubTitle = false; // Disabilita la funzione rewriteSubTitle()
var noNavSlide = false; // Disabilita lo scorrimento nei cassetti [funzione toggleNavigationBar()]
var noMorphSFX = false; // Disabilita scorrimento e fading nel morph [funzioni toggleCollapse() e performMorph()]
/*************** Variabili di debug ***************/
var navBarDebug = false; // Funzione createNavigationBarToggleButton()
var toggleDebug = false; // Funzione createToggleLinks()
var morphDebug = false; // Funzione createMorphLinks()
var createTagsDebug = false; // Funzione createTags()
var testDebug = false; // Funzione displayTest()
var abcDebug = false; // Funzione displayAbc()
/*************** Caricamento della pagina ***************/
mw.hook('nonciclopedia.ready').add(function() {
// Patch
uncyPtPatch();
toolbarPatch();
communityPatch();
searchBoxPatch();
shareLinksPatch();
if($('.catinsert').length > 0) {
catInsertPatch();
setInterval(catInsertPatch, 30);
}
if(wgPageName == 'Speciale:Chat') chatPatch();
if(wgPageName == 'Speciale:Entra') registrationPatch();
if(wgPageName == 'Speciale:AdminDashboard') dashboardPatch();
oasisCheck()
// Skin
startAjaxWatch();
toolbarCookieHide();
linkAdQ();
if(wgAction == 'edit' || wgAction == 'submit') quickEditor();
if(buttonPurge && wgCanonicalNamespace != 'Special') createPurgeButton();
// Inclusioni
// Sintassi: importScript(script, condizione);
importScript('MediaWiki:Pesce_aprile_2009.js', wgPageName == 'Nonciclopedia:Storia/Pagine_commemorative/Pesci_d\'aprile/3');
importScript('MediaWiki:Pesce_aprile_2010.js', wgPageName == 'Nonciclopedia:Storia/Pagine_commemorative/Pesci_d\'aprile/4');
importScript('MediaWiki:Pesce_aprile_2011.js', wgPageName == 'Nonciclopedia:Storia/Pagine_commemorative/Pesci_d\'aprile/5');
//Funzioni dell'anteprima
hooksCommonRender();
// Altro
googleStat();
if(wgUserName) addEditintro();
// Funzioni fuori dal common.js
for(var i = 0; i < hooksCustom.length; i++) {
if(typeof hooksCustom[i] == typeof Array()) { // Se ci sono parametri da passare alla funzione
hooksCustom[i][0].apply(this, hooksCustom[i][1]);
}
else {
hooksCustom[i]();
}
}
});
// Funzioni da avviare al caricamento della pagina e dell'anteprima
function hooksCommonRender() {
// Patch
youtubePatch();
if(wgCanonicalNamespace == 'File') filePatch();
if(wgPageName == 'Speciale:Carica' || wgAction == 'edit') catTreePatch();
if(navigator.appName == 'Microsoft Internet Explorer') hiddenCatsExplorerPatch();
if(!disableHideEdit && $('#ca-edit').length && $('#hide-edit').length) hideEditPatch();
// Skin
// randomLogo();
moveEditSection();
if(wgNamespaceNumber > -1 && !disableSectionZeroEditLink) sectionZeroEditLink();
if(!disableAddCSS) addCSS();
if(!disableAssignTitle) rewriteTitle();
if(!disableAssignSubTitle) rewriteSubTitle();
// Effetti
numList();
randomList();
checkTimers();
initializeCoolCounter();
if(!disableTargetBlank) targetBlank();
if(!disableUsernameReplace) usernameReplace();
if(!disableRefTooltip) refTooltip();
if(!navBarDebug) createNavigationBarToggleButton();
if(!toggleDebug) createToggleLinks();
if(!morphDebug) createMorphLinks();
if(!createTagsDebug) createTags();
if(!testDebug) displayTest();
if(!abcDebug) displayAbc();
// Altro
jsLoading(); // Non mettere altro qui sotto
// Funzioni fuori dal common.js
for(var i = 0; i < hooksCustomRender.length; i++) {
if(typeof hooksCustomRender[i] == typeof Array()) { // Se ci sono parametri da passare alla funzione
hooksCustomRender[i][0].apply(this, hooksCustomRender[i][1]);
}
else {
hooksCustomRender[i]();
}
}
return;
}
// Funzioni da avviare da cellulare (Solo PP)
function hooksMobile() {
imgMobilePatch();
numList();
randomList();
createNavigationBarToggleButton();
createToggleLinks();
createMorphLinks();
}
/*************** Utilità ***************/
// Funzione per importare script
// Parametri:
// script: Nome della pagina in cui si trova lo script, solitamente una sottopagina di Nonciclopedia:Script
// condition: Condizione logica necessaria per includere lo script
function importScript(script, condition) {
if(!script) {
return;
}
if(condition || condition == undefined) {
var scriptElem = document.createElement('script');
scriptElem.type = 'text/javascript';
scriptElem.charset = 'UTF-8';
scriptElem.src = '/index.php?title=' + script + '&action=raw&ctype=text/javascript';
document.getElementsByTagName('head')[0].appendChild(scriptElem);
}
return;
}
// Restituisce il valore di un cookie
// Parametri:
// name: Nome della variabile memorizzata nel cookie
function getCookie(name) {
if(!document.cookie.length) {
return null;
}
var start = document.cookie.indexOf(name);
if(start == -1) {
return null;
}
start += name.length + 1;
var end = document.cookie.indexOf(';', start);
if(end == -1) {
end = document.cookie.length;
}
return unescape(document.cookie.substring(start,end));
}
/*************** Altro ***************/
// Statistiche di Google
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-17496918-1']);
_gaq.push(['_trackPageview']);
function googleStat() {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
}
// Funzione per il Template:Caricamento
function jsLoading() {
$('.jsloading-pre').remove();
$('.jsloading-post').show();
}
// Aggiunge l'Editintro nei link di modifica anche per gli utenti registrati
function addEditintro() {
if($('#ca-talk').hasClass('new')) {
$('#ca-talk a:first').attr('href', $('#ca-talk a:first').attr('href') + '&editintro=MediaWiki:Editintro');
}
if(wgCurRevisionId) {
$('#ca-edit a:first').attr('href', $('#ca-edit a:first').attr('href') + '&editintro=MediaWiki:Editintro');
}
$('span.editsection a').each(function() {
$(this).attr('href', $(this).attr('href') + '&editintro=MediaWiki:Editintro');
});
return;
}
/************** Pulsanti ***************/
// Pulsanti aggiunti di default
if(skin != 'wikiamobile' && mwCustomEditButtons) {
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "https://upload.wikimedia.org/wikipedia/commons/0/0c/Button_P_template.png",
"speedTip": "Template",
"tagOpen": "{{",
"tagClose": "}" + "}",
"sampleText": "Template"
};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "https://upload.wikimedia.org/wikipedia/commons/0/05/Button_Anf%C3%BChrung.png",
"speedTip": "Citazione",
"tagOpen": "{{Cit2|",
"tagClose": "|Testo sotto}" + "}",
"sampleText": "Testo citazione"
};
}
// Pulsanti da aggiungere nella pagina di modifica: sistema di aggiornamento centralizzato
var pulsanteAccusa = {
'imageFile': 'https://static.miraheze.org/nonciclopediawiki/9/93/Button_Jessica.png',
'speedTip': 'Articolo in dubbio',
'tagOpen': '{{Accusa|accusa=',
'tagClose': '|firma=--~~' + '~~}' + '}\n\n',
'sampleText': 'Inserire qui l\'accusa'
};
var pulsanteAllinea = {
'imageFile': 'https://static.miraheze.org/nonciclopediawiki/f/f7/Button_align_center.png',
'speedTip': 'Centrato',
'tagOpen': '{{Allinea|center|',
'tagClose': '}' + '}',
'sampleText': 'Inserisci qui il testo'
};
var pulsanteAllineaDX = {
"imageFile": "https://upload.wikimedia.org/wikipedia/commons/a/a5/Button_align_right.png",
"speedTip": "Align right",
"tagOpen": '{{Allinea|right|',
"tagClose": "}}",
"sampleText": "Testo allineato a destra"
};
var pulsanteAllineaSX = {
"imageFile": "https://upload.wikimedia.org/wikipedia/commons/e/ea/Button_align_left.png",
"speedTip": "Align left",
"tagOpen": '{{Allinea|left|',
"tagClose": "}}",
"sampleText": "Testo allineato a sinistra"
};
var pulsanteApice = {
'imageFile': 'http://upload.wikimedia.org/wikipedia/en/8/80/Button_upper_letter.png',
'speedTip': 'Apice',
'tagOpen': '<sup>',
'tagClose': '</sup>',
'sampleText': 'Inserire qui il testo'
};
var pulsanteAPU = {
'imageFile': 'https://static.miraheze.org/nonciclopediawiki/0/0a/Button_sad.png',
'speedTip': 'Articolo poco umoristico',
'tagOpen': '{{Accusa|accusa=APU|firma=--~~' + '~~}' + '}\n\n',
'tagClose': '',
'sampleText': ''
};
var pulsanteBarrato = {
'imageFile': 'https://upload.wikimedia.org/wikipedia/en/c/c9/Button_strike.png',
'speedTip': 'Barrato',
'tagOpen': '{{s|',
'tagClose': '}' + '}',
'sampleText': 'Inserire qui il testo'
};
var pulsanteBig = {
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/5/56/Button_big.png',
'speedTip': 'Grande',
'tagOpen': '{{Dimensione|125%|',
'tagClose': '}' + '}',
'sampleText': 'Inserisci qui il testo'
};
var pulsanteBTA = {
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/3/34/Button_MrX.png',
'speedTip': 'Battute tra amici',
'tagOpen': '{{Cancellazione|motivo=BTA|firma=--~~' + '~~}' + '}\n\n',
'tagClose': '',
'sampleText': ''
};
var pulsanteCancellazione = {
'imageFile': 'https://images.wikia.nocookie.net/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'
};
var pulsanteCarattere = {
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/8/8c/Bottone_Carattere.png',
'speedTip': 'Carattere',
'tagOpen': '{{Carattere|Tipo di carattere|dim%|',
'tagClose': '|#colore}}',
'sampleText': 'testo'
};
var pulsanteCassetto = {
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/3/38/Button_cassetto.png',
'speedTip': 'Cassetto',
'tagOpen': '{{Cassetto|titolo=Titolo cassetto|testo=',
'tagClose': '}}',
'sampleText': 'Inserire qui il testo'
};
var pulsanteCatImg = {
'imageFile': '',
'speedTip': 'Categoria immagini',
'tagOpen': '[[Categoria:Immagini ',
'tagClose': ']]',
'sampleText': ''
};
var pulsanteCC = {
'imageFile': 'https://images.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}' + '}\n',
'tagClose': '',
'sampleText': ''
};
var pulsanteCensura = {
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/2/20/Button_censura2.png',
'speedTip': 'Censura',
'tagOpen': '{{Censura|',
'tagClose': '}}',
'sampleText': 'testo da censurare'
};
var pulsanteCit2 = {
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/6/6f/Button_cit2.png',
'speedTip': 'Citazione 2',
'tagOpen': '{{Cit2|',
'tagClose': '}}\n',
'sampleText': 'Inserire qui la citazione'
};
var pulsanteCitnec = {
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/f/f6/Button_Citnec.png',
'speedTip': 'Citazione necessaria',
'tagOpen': '{{Citnec|',
'tagClose': '}}',
'sampleText': 'Inserire qui la citazione'
};
var pulsanteColonne = {
'imageFile': 'https://images.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'
};
var pulsanteColore = {
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/0/0f/Bottone_colore.png',
'speedTip': 'Colore',
'tagOpen': '{{Colore|#Codice esadecimale|',
'tagClose': '}}',
'sampleText': 'testo da colorare'
};
var pulsanteDimensione = {
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/2/2f/Bottone_dimensione.png',
'speedTip': 'Dimensione',
'tagOpen': '{{Dimensione|dim%|',
'tagClose': '}}',
'sampleText': 'testo'
};
var pulsanteFormattazione1 = {
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/d/d6/E%27fiamme.png',
'speedTip': 'Formattazione',
'tagOpen': '{{Formattazione|note=',
'tagClose': '|firma=--~~' + '~~}' + '}\n\n',
'sampleText': 'Inserire qui cosa fare'
};
var pulsanteFormattazione2 = {
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/e/e1/E%27mat.png',
'speedTip': 'Formattazione',
'tagOpen': '{{Formattazione|note=',
'tagClose': '|firma=--~~' + '~~}' + '}\n\n',
'sampleText': 'Inserire qui cosa fare'
};
var pulsanteGallery = {
'imageFile': 'https://images.wikia.nocookie.net/central/images/1/12/Button_gallery.png',
'speedTip': 'Galleria di immagini',
'tagOpen': '\n<gallery>\n',
'tagClose': '\n</gallery>\n',
'sampleText': 'File:Example.jpg|Caption1\nFile:Example.jpg|Caption2'
};
var pulsanteManuali = {
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/f/fe/Bottone_Man.png',
'speedTip': 'Link ai manuali',
'tagOpen': '{{Man|',
'tagClose': '}}',
'sampleText': 'Manuale (iniziale)'
};
var pulsanteNomedimmerda = {
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/3/33/Sguardone.png',
'speedTip': 'Immagine da rinominare ',
'tagOpen': '{{Nomedimmerda|scadenza={{subst:7g}' + '}|motivo=',
'tagClose': '|firma=--~~' + '~~}' + '}\n\n',
'sampleText': 'Inserisci un suggerimento'
};
var pulsantePedice = {
'imageFile': 'http://upload.wikimedia.org/wikipedia/en/7/70/Button_lower_letter.png',
'speedTip': 'Pedice',
'tagOpen': '<sub>',
'tagClose': '</sub>',
'sampleText': 'Inserire qui il testo'
};
var pulsanteRedirect = {
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/7/73/Bottone_redirect.png',
'speedTip': 'Redirect',
'tagOpen': '#REDIRECT [[',
'tagClose': ']]',
'sampleText': 'Nome pagina'
};
var pulsanteReflink = {
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/6/6e/Bottone_reflink.png',
'speedTip': 'Inserisci la nota nel testo',
'tagOpen': '<ref>',
'tagClose': '</ref>',
'sampleText': 'Inserisci qui il testo della nota'
};
var pulsanteRestauro = {
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/6/6c/Button_restauro.png',
'speedTip': 'Articolo da sistemare',
'tagOpen': '{{Restauro|motivo=',
'tagClose': '|firma=--~~' + '~~}' + '}\n\n',
'sampleText': 'Inserire qui la descrizione'
};
var pulsanteRiquadro1 = {
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/f/f9/Button_box.png',
'speedTip': 'Box',
'tagOpen': '{{Riquadro\n|larghezza=\n|colore-sfondo=\n|colore-testo=\n|colore-bordo=\n|spessore-bordo=\n|testo=\n|file-sx=\n|largh-file-sx=\n|file-dx=\n|largh-file-dx=\n}' + '}\n',
'tagClose': '',
'sampleText': ''
};
var pulsanteRiquadro2 = {
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/f/f9/Button_box.png',
'speedTip': 'Box',
'tagOpen': '{{Riquadro\n|classe=\n|larghezza=\n|colore-sfondo=\n|colore-testo=\n|colore-bordo=\n|stile-bordo=\n|spessore-bordo=\n|stile-riquadro=\n|testo=\n|file-sx=\n|largh-file-sx=\n|file-dx=\n|largh-file-dx=\n}' + '}\n',
'tagClose': '',
'sampleText': ''
};
var pulsanteScadenza = {
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/a/a5/Button_Samara.png',
'speedTip': 'Articolo in scadenza',
'tagOpen': '{{Scadenza|scadenza=' + '{{subst:7g}' + '}|note=',
'tagClose': '|firma=--~~' + '~~}' + '}\n\n',
'sampleText': 'Note'
};
var pulsanteSmall = {
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/5/58/Button_small.png',
'speedTip': 'Piccolo',
'tagOpen': '{{Dimensione|80%|',
'tagClose': '}' + '}',
'sampleText': 'Inserisci qui il testo'
};
var pulsanteSottolineato = {
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/f/fd/Button_underline.png',
'speedTip': 'Sottolineato',
'tagOpen': '{{u|',
'tagClose': '}' + '}',
'sampleText': 'Inserire qui il testo'
};
var pulsanteTabella = {
'imageFile': 'https://upload.wikimedia.org/wikipedia/en/6/60/Button_insert_table.png',
'speedTip': 'Tabella',
'tagOpen': '{| class="wikitable"\n|-\n',
'tagClose': '\n|}\n',
'sampleText': '!| header 1\n!| header 2\n!| header 3\n|-\n|| riga 1, cella 1\n|| riga 1, cella 2\n|| riga 1, cella 3\n|-\n|| riga 2, cella 1\n|| riga 2, cell1 2\n|| riga 2, cella 3'
};
var pulsanteVideo = {
'imageFile': 'https://images.wikia.nocookie.net/__cb20100915172123/nonciclopedia/images/f/ff/Bottone_video.png',
'speedTip': 'Inserisci un video - Per i parametri aggiuntivi leggi la pagina del template',
'tagOpen': '{{YoutubeVideo|',
'tagClose': '}' + '}',
'sampleText': 'Inserisci qui il codice del video'
};
var pulsanteEvidenzia = {
"imageFile": "https://images.wikia.nocookie.net/__cb20140408123004/nonciclopedia/images/b/b5/Bottone_evidenziatore.png",
"speedTip": "Evidenziatore",
"tagOpen": "{{Evidenzia|giallo|",
"tagClose": "}}",
"sampleText": "Testo"
};