Cimitero:MediaWiki:Common.js: differenze tra le versioni
Vai alla navigazione
Vai alla ricerca
Contenuto aggiunto Contenuto cancellato
m (Annullata la modifica 1599428 di Sanjilops (discussione)) |
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) |
||
(313 versioni intermedie di 18 utenti non mostrate) | |||
Riga 1: | Riga 1: | ||
/*************** Variabili di uso globale ***************/ |
|||
/* Funzione per cambiare il logo per il Nonciversario */ |
|||
// Variabili per il caricamento della pagina |
|||
function RandomLogo() { |
|||
var hooksCustom = new Array(); // Array di funzioni personalizzate da avviare unicamente al caricamento della pagina |
|||
var logoArray = new Array(); |
|||
var hooksCustomRender = new Array(); // Array di funzioni personalizzate da avviare al caricamento della pagina e dell'anteprima |
|||
logoArray[0] = 'http://images.wikia.com/nonciclopedia/images/b/bc/Wiki.png'; |
|||
// Sintassi: |
|||
logoArray[1] = 'http://images1.wikia.nocookie.net/nonciclopedia/images/e/ec/Logo-5-anni_Nonci.png'; |
|||
// Se la funzione non ha bisogno di parametri: hooksCustom.push(nomeFunzione); |
|||
logoArray[2] = 'http://images3.wikia.nocookie.net/nonciclopedia/images/a/ae/Logo-5-anni-Nonci-3.png'; |
|||
// 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! |
|||
var chosenLogo = Math.round(Math.random() * (logoArray.length - 1)); |
|||
document.getElementById('p-logo').innerHTML = '<a accesskey="z" title="Pagina principale [alt-shift-z]" href="/wiki/Pagina_principale" style="background-image: url(' + logoArray[chosenLogo] + ');"/>'; |
|||
} |
|||
addOnloadHook(RandomLogo); |
|||
// 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 |
|||
/********************** OnloadHooks **********************/ |
|||
uncyPtPatch(); |
|||
var hooks_custom = new Array(); |
|||
toolbarPatch(); |
|||
/* Funzioni generali */ |
|||
communityPatch(); |
|||
function hooks_common () { |
|||
searchBoxPatch(); |
|||
shareLinksPatch(); |
|||
hooks_common_render(); |
|||
if($('.catinsert').length > 0) { |
|||
createPurgeButton(); |
|||
catInsertPatch(); |
|||
return; |
|||
setInterval(catInsertPatch, 30); |
|||
} |
|||
addOnloadHook(hooks_common); |
|||
/* Funzioni del rendering - separate per richiamarle in anteprima rapida */ |
|||
var __test_js__ = false; |
|||
function hooks_common_render () { |
|||
randomlist(); |
|||
createCollapseButtons(); |
|||
createNavigationBarToggleButton(); |
|||
createToggleLinks(); |
|||
createMorphLinks(); |
|||
multislide_startup(); |
|||
multifade_startup(); |
|||
UserNameReplace(); |
|||
ref_tooltip(); |
|||
alertLink(); |
|||
setTimeout(alertLoad, 1); |
|||
alertUnload(); |
|||
import_script((/\<\;((test)|(abc))(.*)\>\;/.test(document.getElementById('bodyContent').innerHTML) && !__test_js__), "Nonciclopedia:Script/Test.js"); |
|||
target_blank(); |
|||
hiddencats_IE(); |
|||
return; |
|||
} |
|||
/* Funzioni dell'editor */ |
|||
function hooks_common_edit () { |
|||
if (wgAction != 'edit' && wgAction != 'submit') return; |
|||
charinsert_anon_hack(); |
|||
return; |
|||
} |
|||
addOnloadHook(hooks_common_edit); |
|||
/* Importazione script */ |
|||
function Script_Import () { |
|||
/* |
|||
Sintassi: import_script(CONDIZIONE, SCRIPT); |
|||
Es.: import_script((wgPageName == "Esempio"), "Esempio.js"); |
|||
*/ |
|||
import_script((wgPageName == "Speciale:WidgetDashboard"), "Nonciclopedia:Script/Shoutbox.js"); |
|||
import_script((wgPageName == "Giochi:CasiNonci/Slot_machine"), "Nonciclopedia:Script/SlotMachine.js"); |
|||
import_script((wgPageName == "Nonciclopedia:Storia/Pagine commemorative/Pesci d'aprile/4"), "Nonciclopedia:Script/Pesce aprile 2010.js"); |
|||
import_script((wgPageName == "Utente:Zaza/Sandbox/Monabooktor"), "Nonciclopedia:Script/Monabooktor.js"); |
|||
return; |
|||
} |
|||
function import_script (condition, script) { |
|||
if(!condition) return; |
|||
var scriptElem = document.createElement( 'script' ); |
|||
scriptElem.type = 'text/javascript'; |
|||
scriptElem.language = 'javascript'; |
|||
scriptElem.src = '/index.php?title=' + script + '&action=raw&ctype=text/javascript&smaxage=8400'; |
|||
document.getElementsByTagName( 'head' )[0].appendChild( scriptElem ); |
|||
return; |
|||
} |
|||
/************* Funzioni di utilità generale *************/ |
|||
/* Test if an element has a certain class ************************************** |
|||
* |
|||
* Description: Uses regular expressions and caching for better performance. |
|||
* Maintainers: User:Mike Dillon, User:R. Koot, User:SG |
|||
*/ |
|||
var hasClass = (function () { |
|||
var reCache = {}; |
|||
return function (element, className) { |
|||
return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className); |
|||
}; |
|||
})(); |
|||
function getElementsByClass (node, className, tagName) { |
|||
if (node.getElementsByClassName && (tagName == undefined || tagName == null || tagName == '*')) return node.getElementsByClassName(className); |
|||
var list = node.getElementsByTagName(tagName?tagName:'*'); |
|||
var array = new Array(); |
|||
var i = 0; |
|||
for (i in list) { |
|||
if (hasClass(list[i], className)) |
|||
array.push(list[i]); |
|||
} |
|||
return array; |
|||
} |
|||
/* Creates the method getElementsByClass, if unsupported from the browser */ |
|||
if(!document.getElementsByClass) document.getElementsByClass = function(className) { |
|||
return getElementsByClass(document, className, '*'); |
|||
}; |
|||
function getElementsByName (name, root) { |
|||
if (root == undefined) root = document; |
|||
var e = root.getElementsByTagName('*'); |
|||
var r = new Array(); |
|||
for (var i = 0; i < e.length; i++) { |
|||
if (e[i].getAttribute('name') == name) r[r.length] = e[i]; |
|||
} |
|||
return r; |
|||
} |
|||
function getText (e) { |
|||
if (e.textContent) return e.textContent; |
|||
else if (e.innerText) return e.innerText; |
|||
else return null; |
|||
} |
|||
function setText (e, t) { |
|||
if (e.textContent) e.textContent = t; |
|||
else if (e.innerText) e.innerText = t; |
|||
else { e.textContent = t; e.innerText = t; } // entrambi nulli, non si può discriminare |
|||
return; |
|||
} |
|||
function appendText (e, t) { |
|||
if (e.textContent) e.textContent += t; |
|||
else if (e.innerText) e.innerText += t; |
|||
else { e.textContent = t; e.innerText = t; } |
|||
return; |
|||
} |
|||
/* Crea una request Ajax */ |
|||
function createRequest () { |
|||
if (window.XMLHttpRequest) { // Mozilla, Safari... |
|||
return new XMLHttpRequest(); |
|||
} |
|||
else if (window.ActiveXObject) { // IEmmerda |
|||
return new ActiveXObject("Microsoft.XMLHTTP"); |
|||
} |
|||
return |
|||
} |
|||
/* Restituisce il valore di un cookie */ |
|||
function getCookie(name) { |
|||
if (document.cookie.length == 0) 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)); |
|||
} |
|||
/* Aggiunge uno zero alle cifre minori di 10 nella rappresentazione testuale */ |
|||
function addzero(n) { |
|||
if (n<10) return '0' + n.toString(); |
|||
else return n.toString(); |
|||
} |
|||
function addEvent(el, ev, f, capt) { |
|||
if (capt == undefined) capt = false; |
|||
if (el.addEventListener) el.addEventListener(ev, f, capt); |
|||
else if (el.attachEvent) el.attachEvent('on' + ev, f); |
|||
return; |
|||
} |
|||
function removeEvent(el, ev, f, capt) { |
|||
if (capt == undefined) capt = false; |
|||
if (el.removeEventListener) el.removeEventListener(ev, f, capt); |
|||
else if (el.detachEvent) el.detachEvent('on' + ev, f); |
|||
return; |
|||
} |
|||
var noFade = false; |
|||
function Fade (element, delay, i, rev, ratio) { |
|||
if (noFade) return; |
|||
/* rev = sparizione; se !rev, ratio = opacità finale; se rev, ratio = opacità iniziale*/ |
|||
var start_time = new Date().getTime(); |
|||
var start_value = rev? ratio : 0; |
|||
element.style.filter = "alpha(opacity=" + start_value * 100 + ")"; |
|||
element.style.opacity = start_value; |
|||
if (!parseInt(element.style.width) && navigator.appName == "Microsoft Internet Explorer") element.style.width = element.offsetWidth + 'px'; |
|||
setTimeout(function() { Do()} , i); |
|||
return; |
|||
function Do() { |
|||
var cur_time = new Date().getTime(); |
|||
var past_time = cur_time - start_time; |
|||
if (past_time >= delay) { /* ultima chiamata */ |
|||
var final_value = rev? 0 : ratio; |
|||
element.style.filter = "alpha(opacity=" + final_value * 100 + ")"; |
|||
element.style.opacity = final_value; |
|||
return; |
|||
} |
|||
var progress = past_time/delay; |
|||
var new_value = rev? ratio * (1 - progress) : ratio * progress; |
|||
element.style.filter = "alpha(opacity=" + new_value * 100 + ")"; |
|||
element.style.opacity = new_value; |
|||
setTimeout(function() { Do(); } , i); |
|||
return; |
|||
} |
} |
||
if(wgPageName == 'Speciale:Chat') chatPatch(); |
|||
} |
|||
if(wgPageName == 'Speciale:Entra') registrationPatch(); |
|||
if(wgPageName == 'Speciale:AdminDashboard') dashboardPatch(); |
|||
oasisCheck() |
|||
// Skin |
|||
var noSlide = false; |
|||
startAjaxWatch(); |
|||
function Slide(element, param, final_value, final_size, delay, i) { |
|||
toolbarCookieHide(); |
|||
if (noSlide) return; |
|||
linkAdQ(); |
|||
/* NB: Il valore finale deve avere la stessa unità di misura di quello iniziale! */ |
|||
if(wgAction == 'edit' || wgAction == 'submit') quickEditor(); |
|||
var start_time = new Date().getTime(); |
|||
if(buttonPurge && wgCanonicalNamespace != 'Special') createPurgeButton(); |
|||
var unit = 'px'; |
|||
if (typeof(final_value) == 'string') { |
|||
final_value = final_value.split(/\D/); |
|||
if (final_value.length > 1) unit = final_value[1]; |
|||
final_value = parseFloat(final_value[0]); |
|||
} |
|||
var start_value = Get(); |
|||
var sub = (start_value > final_value)? true : false; |
|||
var diff = Math.abs(start_value - final_value); |
|||
var start_size; |
|||
if (param == 'top' || param == 'bottom') start_size = element.parentNode.offsetHeight; |
|||
else if (param == 'left' || param == 'right') start_size = element.parentNode.offsetWidth; |
|||
var diff_size = Math.abs(start_size - final_size); |
|||
setTimeout( function() {Do(); } , i); |
|||
return; |
|||
function Do() { |
|||
var cur_time = new Date().getTime(); |
|||
var past_time = cur_time - start_time; |
|||
if (past_time >= delay) { /* ultima chiamata */ |
|||
Set(final_value); |
|||
if (param == 'top' || param == 'bottom') element.parentNode.style.height = final_size + unit; |
|||
else if (param == 'left' || param == 'right') element.parentNode.style.width = final_size + unit; |
|||
return; |
|||
} |
|||
var progress = diff * past_time/delay; |
|||
new_value = (sub)? start_value - progress : start_value + progress; |
|||
Set(new_value); |
|||
new_size = (sub)? start_size - diff_size * past_time/delay: start_size + diff_size * past_time/delay; |
|||
if (param == 'top' || param == 'bottom') element.parentNode.style.height = new_size + unit; |
|||
else if (param == 'left' || param == 'right') element.parentNode.style.width = new_size + unit; |
|||
setTimeout(function() { Do(); } , i); |
|||
return; |
|||
} |
|||
function Get() { |
|||
var ret; |
|||
switch (param) { |
|||
case 'top': |
|||
ret = element.style.top; |
|||
break; |
|||
case 'bottom': |
|||
ret = element.style.bottom; |
|||
break; |
|||
case 'left': |
|||
ret = element.style.left; |
|||
break; |
|||
case 'right': |
|||
ret = element.style.right; |
|||
break; |
|||
default: |
|||
return false; |
|||
} |
|||
if (/em/i.test(ret)) return parseFloat(ret); |
|||
return (/\d+/.test(ret))? parseInt(ret) : 0; |
|||
} |
|||
function Set(v) { |
|||
switch (param) { |
|||
case 'top': |
|||
element.style.top = v + unit; |
|||
return; |
|||
case 'bottom': |
|||
element.style.bottom = v + unit; |
|||
return; |
|||
case 'left': |
|||
element.style.left = v + unit; |
|||
return; |
|||
case 'right': |
|||
element.style.right = v + unit; |
|||
return; |
|||
default: |
|||
return false; |
|||
} |
|||
} |
|||
} |
|||
/************* Funzioni applicative ***************/ |
|||
// ============================================================ |
|||
// BEGIN Dynamic Navigation Bars (experimantal) |
|||
// This script is from Wikipedia. For author attribution, please see http://en.wikipedia.org/w/index.php?title=MediaWiki:Common.js&action=history |
|||
/** Collapsible tables ********************************************************* |
|||
* |
|||
* Description: Allows tables to be collapsed, showing only the header. See |
|||
* [[Wikipedia:NavFrame]]. |
|||
* Maintainers: [[User:R. Koot]] |
|||
*/ |
|||
var autoCollapse = 0; // numero massimo di barre visibili |
|||
// per default al caricamento di una pagina |
|||
var collapseCaption = "nascondi"; |
|||
var expandCaption = "vedi"; |
|||
function collapseTable( tableIndex ) |
|||
{ |
|||
var Button = document.getElementById( "collapseButton" + tableIndex ); |
|||
var Table = document.getElementById( "collapsibleTable" + tableIndex ); |
|||
if ( !Table || !Button ) { |
|||
return false; |
|||
} |
|||
var Rows = Table.getElementsByTagName( "tr" ); |
|||
if ( Button.firstChild.data == collapseCaption ) { |
|||
for ( var i = 1; i < Rows.length; i++ ) { |
|||
Rows[i].style.display = "none"; |
|||
} |
|||
Button.firstChild.data = expandCaption; |
|||
} else { |
|||
for ( var i = 1; i < Rows.length; i++ ) { |
|||
Rows[i].style.display = Rows[0].style.display; |
|||
} |
|||
Button.firstChild.data = collapseCaption; |
|||
} |
|||
} |
|||
function createCollapseButtons() |
|||
{ |
|||
var tableIndex = 0; |
|||
var NavigationBoxes = new Object(); |
|||
var Tables = document.getElementsByTagName( "table" ); |
|||
for ( var i = 0; i < Tables.length; i++ ) { |
|||
if ( hasClass( Tables[i], "collapsible" ) && !Tables[i].id) { |
|||
NavigationBoxes[ tableIndex ] = Tables[i]; |
|||
Tables[i].id = "collapsibleTable" + tableIndex; |
|||
var Button = document.createElement( "span" ); |
|||
var ButtonLink = document.createElement( "a" ); |
|||
var ButtonText = document.createTextNode( collapseCaption ); |
|||
Button.style.styleFloat = "right"; |
|||
Button.style.cssFloat = "right"; |
|||
Button.style.fontWeight = "normal"; |
|||
Button.style.textAlign = "right"; |
|||
Button.style.width = "6em"; |
|||
ButtonLink.setAttribute( "id", "collapseButton" + tableIndex ); |
|||
ButtonLink.setAttribute( "href", "javascript:collapseTable(" + tableIndex + ");" ); |
|||
ButtonLink.appendChild( ButtonText ); |
|||
Button.appendChild( document.createTextNode( "[" ) ); |
|||
Button.appendChild( ButtonLink ); |
|||
Button.appendChild( document.createTextNode( "]" ) ); |
|||
var Header = Tables[i].getElementsByTagName( "tr" )[0].getElementsByTagName( "th" )[0]; |
|||
/* only add button and increment count if there is a header row to work with */ |
|||
if (Header) { |
|||
Header.insertBefore( Button, Header.childNodes[0] ); |
|||
tableIndex++; |
|||
} |
|||
} |
|||
} |
|||
for ( var i = 0; i < tableIndex; i++ ) { |
|||
if ( hasClass( NavigationBoxes[i], "collapsed" ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], "autocollapse" ) ) ) { |
|||
collapseTable( i ); |
|||
} |
|||
} |
|||
} |
|||
/** Dynamic Navigation Bars (experimental) ************************************* |
|||
* |
|||
* Description: See [[Wikipedia:NavFrame]]. |
|||
* Maintainers: UNMAINTAINED |
|||
*/ |
|||
// set up the words in your language |
|||
var NavigationBarHide = '[' + collapseCaption + ']'; |
|||
var NavigationBarShow = '[' + expandCaption + ']'; |
|||
// set up max count of Navigation Bars on page, |
|||
// if there are more, all will be hidden |
|||
// NavigationBarShowDefault = 0; // all bars will be hidden |
|||
// NavigationBarShowDefault = 1; // on pages with more than 1 bar all bars will be hidden |
|||
var NavigationBarShowDefault = autoCollapse; |
|||
// shows and hides content and picture (if available) of navigation bars |
|||
// Parameters: |
|||
// indexNavigationBar: the index of navigation bar to be toggled |
|||
var noNavSlide = true; |
|||
function toggleNavigationBar(indexNavigationBar) { |
|||
var NavToggle = document.getElementById("NavToggle" + indexNavigationBar); |
|||
var NavFrame = document.getElementById("NavFrame" + indexNavigationBar); |
|||
if (!NavFrame || !NavToggle) { |
|||
return false; |
|||
} |
|||
// if shown now |
|||
if (NavToggle.firstChild.data == NavigationBarHide) { |
|||
if (!hasClass(NavFrame, 'no-slide') && !noNavSlide) NavSlide(NavFrame, true); |
|||
else { |
|||
for ( |
|||
var NavChild = NavFrame.firstChild; |
|||
NavChild != null; |
|||
NavChild = NavChild.nextSibling |
|||
) { |
|||
if ( hasClass( NavChild, 'NavPic' ) ) { |
|||
NavChild.style.display = 'none'; |
|||
} |
|||
if ( hasClass( NavChild, 'NavContent') ) { |
|||
NavChild.style.display = 'none'; |
|||
} |
|||
} |
|||
} |
|||
NavToggle.firstChild.data = NavigationBarShow; |
|||
// if hidden now |
|||
} else if (NavToggle.firstChild.data == NavigationBarShow) { |
|||
for ( |
|||
var NavChild = NavFrame.firstChild; |
|||
NavChild != null; |
|||
NavChild = NavChild.nextSibling |
|||
) { |
|||
if (hasClass(NavChild, 'NavPic')) { |
|||
NavChild.style.display = 'block'; |
|||
} |
|||
if (hasClass(NavChild, 'NavContent')) { |
|||
NavChild.style.display = 'block'; |
|||
} |
|||
} |
|||
if (!hasClass(NavFrame, 'no-slide') && !noNavSlide) NavSlide(NavFrame, false); |
|||
NavToggle.firstChild.data = NavigationBarHide; |
|||
} |
|||
} |
|||
var NavigationBarSlideDelay = 600; |
|||
var NavigationBarSlideInterval = 70; |
|||
var NavigationBarFadeDelay = 400; |
|||
var NavigationBarFadeInterval = 70; |
|||
function NavSlide (NavFrame, close) { |
|||
/* close = chiusura */ |
|||
for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) { |
|||
if ( hasClass( NavChild, 'NavPic' ) || hasClass( NavChild, 'NavContent') ) Slide(NavChild); |
|||
} |
|||
return; |
|||
// Inclusioni |
|||
function Slide (element) { |
|||
// Sintassi: importScript(script, condizione); |
|||
if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.userAgent[navigator.userAgent.indexOf("MSIE") + 5]) >= 8) return; |
|||
importScript('MediaWiki:Pesce_aprile_2009.js', wgPageName == 'Nonciclopedia:Storia/Pagine_commemorative/Pesci_d\'aprile/3'); |
|||
var fade = !hasClass(NavFrame, 'no-fade'); |
|||
importScript('MediaWiki:Pesce_aprile_2010.js', wgPageName == 'Nonciclopedia:Storia/Pagine_commemorative/Pesci_d\'aprile/4'); |
|||
var start_time = new Date().getTime() + NavigationBarFadeDelay * ((close && fade)? 1.1 : 0); |
|||
importScript('MediaWiki:Pesce_aprile_2011.js', wgPageName == 'Nonciclopedia:Storia/Pagine_commemorative/Pesci_d\'aprile/5'); |
|||
var size = element.offsetHeight; |
|||
var start_value = close? 0: 0 - size; |
|||
var final_value = close? 0 - size : 0; |
|||
element.style.marginTop = start_value + 'px'; |
|||
element.style.width = 'auto'; |
|||
if (fade) { |
|||
if (close) Fade(element, NavigationBarFadeDelay, NavigationBarFadeInterval, true, 0.7); |
|||
else { |
|||
element.style.filter = "alpha(opacity=0)"; |
|||
element.style.opacity = 0; |
|||
} |
|||
} |
|||
setTimeout(function() { Do(); } , NavigationBarSlideInterval + NavigationBarFadeDelay * ((close && fade)? 1.1 : 0)); |
|||
return; |
|||
function Do() { |
|||
var cur_time = new Date().getTime(); |
|||
var past_time = cur_time - start_time; |
|||
if (past_time >= NavigationBarSlideDelay) { |
|||
element.style.marginTop = final_value + 'px'; |
|||
if (!close && fade) Fade(element, NavigationBarFadeDelay, NavigationBarFadeInterval, false, 1); |
|||
if (close) element.style.display = 'none'; |
|||
return; |
|||
} |
|||
var progress = past_time/NavigationBarSlideDelay; |
|||
var new_value = close? final_value * progress : start_value * (1 - progress); |
|||
element.style.marginTop = new_value + 'px'; |
|||
setTimeout(function() { Do(); } , NavigationBarSlideInterval); |
|||
return; |
|||
} |
|||
} |
|||
} |
|||
// adds show/hide-button to navigation bars |
|||
function createNavigationBarToggleButton() |
|||
{ |
|||
var indexNavigationBar = 0; |
|||
// iterate over all < div >-elements |
|||
var divs = document.getElementsByTagName("div"); |
|||
for( |
|||
var i=0; |
|||
NavFrame = divs[i]; |
|||
i++ |
|||
) { |
|||
// if found a navigation bar |
|||
if (hasClass(NavFrame, "NavFrame")) { |
|||
indexNavigationBar++; |
|||
var NavToggle = document.createElement("a"); |
|||
NavToggle.className = 'NavToggle'; |
|||
NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar); |
|||
NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');'); |
|||
var NavToggleText = document.createTextNode(NavigationBarHide); |
|||
NavToggle.appendChild(NavToggleText); |
|||
// Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked) |
|||
for( |
|||
var j=0; |
|||
j < NavFrame.childNodes.length; |
|||
j++ |
|||
) { |
|||
if (hasClass(NavFrame.childNodes[j], "NavHead")) { |
|||
NavFrame.childNodes[j].appendChild(NavToggle); |
|||
} |
|||
} |
|||
NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar); |
|||
} |
|||
} |
|||
// if more Navigation Bars found than Default: hide all |
|||
if (NavigationBarShowDefault < indexNavigationBar) { |
|||
for( |
|||
var i=1; |
|||
i<=indexNavigationBar; |
|||
i++ |
|||
) { |
|||
toggleNavigationBar(i); |
|||
} |
|||
} |
|||
} |
|||
/** Codice sostituzione Username ([[template:USERNAME]]) ******************************* |
|||
* Inserts user name into <span id="insertusername"></span> |
|||
* By [[wikia:User:Splarka|Splarka]] |
|||
*/ |
|||
var disableUsernameReplace = false; |
|||
function UserNameReplace() { |
|||
if (disableUsernameReplace) return; |
|||
var list = getElementsByClass(document.getElementsByTagName('body')[0], "insertusername", 'span'); |
|||
if (list.length < 1) return; |
|||
if (wgUserName) { |
|||
for (var i=0; UserName = list[i]; i++) { |
|||
setText(UserName, wgUserName); |
|||
} |
|||
return; |
|||
} |
|||
var defaultText = "<tuo nome>"; |
|||
var userpage = document.getElementById("pt-anonuserpage"); |
|||
if (userpage != null) { |
|||
var IP = getText(userpage.getElementsByTagName('a')[0]); |
|||
if (IP == null) return; |
|||
for (var i=0; UserName = list[i]; i++) { |
|||
if (getText(UserName) == defaultText) |
|||
setText(UserName, IP); |
|||
} |
|||
return; |
|||
} |
|||
var httpRequest; |
|||
if (window.XMLHttpRequest) { // Mozilla, Safari, ... |
|||
httpRequest = new XMLHttpRequest(); |
|||
} else if (window.ActiveXObject) { // IE |
|||
httpRequest = new ActiveXObject("Microsoft.XMLHTTP"); |
|||
} |
|||
var id = setTimeout(function() { httpRequest.abort();}, 30000); |
|||
httpRequest.onreadystatechange = function () { |
|||
if (httpRequest.readyState != 4) return; |
|||
clearTimeout(id); |
|||
if (httpRequest.status != 200) return; |
|||
if (httpRequest.responseXML == null) return; |
|||
var IP = httpRequest.responseXML.getElementsByTagName('userinfo')[0].getAttribute("name"); |
|||
if (IP == null) return; |
|||
for (var i=0; UserName = list[i]; i++) { |
|||
if (getText(UserName) == defaultText) |
|||
setText(UserName, IP); |
|||
} |
|||
return; |
|||
} |
|||
httpRequest.open('GET', wgServer + wgScriptPath + "/api.php?action=query&meta=userinfo&format=xml", true); |
|||
httpRequest.send(''); |
|||
return; |
|||
} |
|||
/* Generatori di 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() { |
|||
for(var i=0; Elem = document.getElementsByTagName("span")[i]; i++) { |
|||
if((Elem.getAttribute('id') == "alert-link") || (Elem.getAttribute('id') == "alert-nolink")) { |
|||
var Link = Elem.firstChild; |
|||
var Testo = Elem.title; |
|||
Link.setAttribute('onclick', 'alert("' + Testo + '");'); |
|||
if(Elem.getAttribute('id') == "alert-nolink") { |
|||
Link.removeAttribute('href',0); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
/* Carica uno o più alert al caricamento della pagina */ |
|||
var disablealertLoad = 0; |
|||
function alertLoad() { |
|||
if (disablealertLoad) return; |
|||
for(var i=0; Elem = document.getElementsByTagName("span")[i]; i++) { |
|||
if(Elem.getAttribute('id') == "alert-load") { |
|||
var Testo = Elem.innerText || Elem.textContent; |
|||
alert(Testo); |
|||
} |
|||
} |
|||
} |
|||
/* Carica uno o più alert all'uscita dalla pagina */ |
|||
function alertUnload() { |
|||
if (disablealertLoad) return; |
|||
for(var i=0; Elem = document.getElementsByTagName("span")[i]; i++) { |
|||
if(Elem.getAttribute('id') == "alert-unload") { |
|||
var Testo = Elem.innerText || Elem.textContent; |
|||
var temp = document.getElementsByTagName("body")[0].getAttribute('onUnload'); |
|||
if (temp) document.getElementsByTagName("body")[0].setAttribute('onUnload', temp + 'alert("' + Testo + '");'); |
|||
else document.getElementsByTagName("body")[0].setAttribute('onUnload', 'alert("' + Testo + '");'); |
|||
} |
|||
} |
|||
} |
|||
/* Elenchi random */ |
|||
function randomlist() { |
|||
if (document.getElementsByClass('randomlist') && |
|||
document.getElementsByClass('randomcontent') && |
|||
document.getElementsByClass('randomtext')) { |
|||
var listNumber = document.getElementsByClass('randomlist').length; |
|||
for (var k = 0; k < listNumber; k++) { |
|||
var max = parseInt(document.getElementsByClass('randomlist')[k].title); |
|||
var List = document.getElementsByClass('randomcontent')[k].getElementsByTagName('li'); |
|||
var Text = document.getElementsByClass('randomtext')[k]; |
|||
var N = new Array(); |
|||
if (max == 1) var dot = ''; |
|||
else var dot = '• '; |
|||
Text.innerHTML = ''; |
|||
for (var i = 0; i < max; i++) { |
|||
do { |
|||
n = Math.round(Math.random() * (List.length - 1)); |
|||
for (var j = 0; j < i && n != -1; j++) { |
|||
if (N[j] == n) n = -1; |
|||
} |
|||
} while (n == -1) |
|||
N[i] = n; |
|||
var Item = document.createElement('div'); |
|||
Item.innerHTML = dot + List[n].innerHTML; |
|||
Text.appendChild(Item); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
/* Hook that enables collapsing objects. |
|||
* Added 11/5/2007 by WhiteMystery (misterioblanco@gmail.com) |
|||
* on Encyclopedia Dramatica, stolen by Zaza |
|||
* Improved with multiMorph and galleryMorph by MFH |
|||
* Enhanced with fading effect by Sanjilops |
|||
* Uses publicly available code in one function, where noted. */ |
|||
var noMorphSFX = true; |
|||
/* Function that toggles collapsing objects. |
|||
* Added 11/5/2007 by WhiteMystery (misterioblanco@gmail.com) |
|||
* on Encyclopedia Dramatica, stolen by Zaza |
|||
* Uses publicly available code in one function, where noted. */ |
|||
function tableOrNot(objId) { |
|||
//Funzioni dell'anteprima |
|||
if (document.getElementById(objId).tagName == "TABLE") return "table"; |
|||
hooksCommonRender(); |
|||
else return "block"; |
|||
} |
|||
var toggleLinkDelay = 700; |
|||
var toggleLinkInterval = 10; |
|||
function toggleCollapse(objToToggle) { |
|||
var objToToggle = this.parentNode.id.replace(/Link$/, ''); |
|||
var linkText = ""; |
|||
var targetObject = returnObjById(objToToggle); |
|||
if (!targetObject) return; |
|||
var collapseText = returnObjById(objToToggle + "CollapseText").innerHTML; |
|||
var expandText = returnObjById(objToToggle + "ExpandText").innerHTML; |
|||
var slide = !hasClass(returnObjById(objToToggle + "Link"), "no-slide") && !noMorphSFX; |
|||
var fade = !hasClass(returnObjById(objToToggle + "Link"), 'no-fade') && !noMorphSFX; |
|||
if ( targetObject.style.display == "none" ) { |
|||
targetObject.style.display = tableOrNot(objToToggle); |
|||
linkText = collapseText; |
|||
if (slide) Slide(targetObject, false); |
|||
if (fade) { |
|||
if (!parseInt(targetObject.style.width) && navigator.appName == "Microsoft Internet Explorer") targetObject.style.width = targetObject.offsetWidth + 'px'; |
|||
targetObject.style.filter = "alpha(opacity=0)"; |
|||
targetObject.style.opacity = 0; |
|||
setTimeout(function () {Fade(targetObject, toggleLinkDelay, toggleLinkInterval, false, 1);}, 1); |
|||
} |
|||
} |
|||
else { |
|||
if (slide) { |
|||
Slide(targetObject, true); |
|||
setTimeout(function() { targetObject.style.display = "none"; }, toggleLinkDelay + toggleLinkInterval); |
|||
if (fade) setTimeout(function () {Fade(targetObject, toggleLinkDelay, toggleLinkInterval, true, 0.8);}, 1); |
|||
} |
|||
else { |
|||
if (fade) { |
|||
setTimeout(function () {Fade(targetObject, toggleLinkDelay, toggleLinkInterval, true, 0.8);}, 1); |
|||
setTimeout(function () {targetObject.style.display = "none"; }, toggleLinkDelay + toggleLinkInterval); |
|||
} |
|||
else targetObject.style.display = "none"; |
|||
} |
|||
linkText = expandText; |
|||
} |
|||
// Altro |
|||
var toggleLink = returnObjById(objToToggle + "Link-"); |
|||
googleStat(); |
|||
toggleLink.innerHTML = linkText; |
|||
if(wgUserName) addEditintro(); |
|||
// Funzioni fuori dal common.js |
|||
for(var i = 0; i < hooksCustom.length; i++) { |
|||
function Slide (element, close) { |
|||
if(typeof hooksCustom[i] == typeof Array()) { // Se ci sono parametri da passare alla funzione |
|||
if (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.userAgent[navigator.userAgent.indexOf("MSIE") + 5]) >= 8) return; |
|||
hooksCustom[i][0].apply(this, hooksCustom[i][1]); |
|||
var start_time = new Date().getTime(); |
|||
var size = element.offsetHeight; |
|||
var start_value = close? 0: 0 - size; |
|||
var final_value = close? 0 - size : 0; |
|||
element.style.marginTop = start_value + 'px'; |
|||
element.style.width = 'auto'; |
|||
setTimeout(function() { Do(); } , toggleLinkInterval); |
|||
return; |
|||
function Do() { |
|||
var cur_time = new Date().getTime(); |
|||
var past_time = cur_time - start_time; |
|||
if (past_time >= NavigationBarSlideDelay) { |
|||
element.style.marginTop = final_value + 'px'; |
|||
return; |
|||
} |
|||
var progress = past_time/toggleLinkDelay; |
|||
var new_value = close? final_value * progress : start_value * (1 - progress); |
|||
element.style.marginTop = new_value + 'px'; |
|||
setTimeout(function() { Do(); } , toggleLinkInterval); |
|||
return; |
|||
} |
} |
||
} |
|||
} |
|||
function createToggleLinks() { |
|||
var toggleLinkCollection = document.getElementsByClass("toggleLink"); |
|||
for (var i = 0; i < toggleLinkCollection.length; i++) { |
|||
var spanID = toggleLinkCollection[i].getAttribute("id"); |
|||
var targetID = spanID.substr(0, spanID.length - 4); |
|||
var collapseText = returnObjById(targetID + "CollapseText").innerHTML; |
|||
var expandText = returnObjById(targetID + "ExpandText").innerHTML; |
|||
var initialState = returnObjById(targetID + "InitialState").innerHTML; |
|||
var toggleLink = document.createElement("a"); |
|||
toggleLinkCollection[i].appendChild(toggleLink); |
|||
if (initialState == "0") { |
|||
returnObjById(targetID).style.display = "none"; |
|||
toggleLink.innerHTML = expandText; |
|||
} |
|||
else { |
else { |
||
hooksCustom[i](); |
|||
returnObjById(targetID).style.display = tableOrNot(targetID); |
|||
toggleLink.innerHTML = collapseText; |
|||
} |
} |
||
toggleLink.onclick = toggleCollapse; |
|||
//toggleLink.className = "morphLink"; |
|||
toggleLink.id = targetID + "Link-"; |
|||
} |
} |
||
} |
}); |
||
/* Functions that performs the morph operation. |
|||
* Added 11/5/2007 by WhiteMystery (misterioblanco@gmail.com) |
|||
* on Encyclopedia Dramatica, stolen by Zaza |
|||
* Uses publicly available code in one function, where noted. */ |
|||
var MorphFadeDelay = 800; |
|||
var MorphFadeInterval = 50; |
|||
// Funzioni da avviare al caricamento della pagina e dell'anteprima |
|||
function performMorph(targetID, targetNumber) { |
|||
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 |
|||
var counter = 1; |
|||
// randomLogo(); |
|||
moveEditSection(); |
|||
if(wgNamespaceNumber > -1 && !disableSectionZeroEditLink) sectionZeroEditLink(); |
|||
if(!disableAddCSS) addCSS(); |
|||
if(!disableAssignTitle) rewriteTitle(); |
|||
if(!disableAssignSubTitle) rewriteSubTitle(); |
|||
// Effetti |
|||
while ( returnObjById(targetID + "Content" + counter) ) { |
|||
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 |
|||
if ( counter == targetNumber ) { |
|||
jsLoading(); // Non mettere altro qui sotto |
|||
returnObjById(targetID + "Content" + counter).style.display = tableOrNot(targetID + "Content" + counter); |
|||
if (!hasClass(returnObjById(targetID + "Master"), 'no-fade') && !noMorphSFX) Fade(returnObjById(targetID + "Content" + counter), MorphFadeDelay, MorphFadeInterval, false, 1); |
|||
} |
|||
else |
|||
returnObjById(targetID + "Content" + counter).style.display = "none"; |
|||
counter++; |
|||
} |
|||
// Funzioni fuori dal common.js |
|||
returnObjById(targetID + "Master").innerHTML = targetNumber; |
|||
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]); |
|||
function morphForward() { |
|||
var targetID = this.getAttribute('name').replace(/LinkNext$/, ''); |
|||
var nextPane = parseInt(returnObjById(targetID + "Master").innerHTML) + 1; |
|||
if ( returnObjById(targetID + "Content" + nextPane) ) |
|||
performMorph(targetID, nextPane); |
|||
else |
|||
performMorph(targetID, "1"); |
|||
} |
|||
function morphBackward() { |
|||
var targetID = this.getAttribute('name').replace(/LinkPrev$/, ''); |
|||
var prevPane = parseInt(returnObjById(targetID + "Master").innerHTML) - 1; |
|||
if ( prevPane > 0 ) |
|||
performMorph(targetID, prevPane); |
|||
else { |
|||
var maxIndex = 1; |
|||
while ( returnObjById(targetID + "Content" + maxIndex) ) |
|||
maxIndex++; |
|||
performMorph(targetID, maxIndex - 1); |
|||
} |
|||
} |
|||
/* Special functions for the galleryMorph, |
|||
* created by MFH */ |
|||
function performGalleryMorph(targetID, targetNumber) { |
|||
var counter = 1; |
|||
while ( returnObjById(targetID + "Content" + counter) ) { |
|||
if ( counter == targetNumber ) { |
|||
returnObjById(targetID + "Content" + counter).style.display = tableOrNot(targetID + "Content" + counter); |
|||
if (!hasClass(returnObjById(targetID + "Master"), 'no-fade') && !noMorphSFX) Fade(returnObjById(targetID + "Content" + counter), MorphFadeDelay, MorphFadeInterval, false, 1); |
|||
} |
|||
else |
|||
returnObjById(targetID + "Content" + counter).style.display = "none"; |
|||
counter++; |
|||
} |
|||
if (targetNumber == 1) { |
|||
returnObjById(targetID + "LinkPrev").style.display = "none"; |
|||
} |
|||
else { |
|||
returnObjById(targetID + "LinkPrev").style.display = tableOrNot(targetID + "LinkPrev"); |
|||
} |
|||
if (targetNumber == counter - 1) { |
|||
returnObjById(targetID + "LinkNext").style.display = "none"; |
|||
} |
|||
else { |
|||
returnObjById(targetID + "LinkNext").style.display = tableOrNot(targetID + "LinkNext"); |
|||
} |
|||
galleryCounter = returnObjById(targetID + "Master").getAttribute("counter"); |
|||
returnObjById(targetID + "Counter").innerHTML = "(" + targetNumber + "/" + galleryCounter + ")"; |
|||
returnObjById(targetID + "Master").innerHTML = targetNumber; |
|||
} |
|||
function galleryMorphForward() { |
|||
var targetID = this.getAttribute('name').replace(/LinkNext$/, ''); |
|||
var nextPane = parseInt(returnObjById(targetID + "Master").innerHTML) + 1; |
|||
if ( returnObjById(targetID + "Content" + nextPane) ) |
|||
performGalleryMorph(targetID, nextPane); |
|||
else |
|||
performGalleryMorph(targetID, "1"); |
|||
} |
|||
function galleryMorphBackward() { |
|||
var targetID = this.getAttribute('name').replace(/LinkPrev$/, ''); |
|||
var prevPane = parseInt(returnObjById(targetID + "Master").innerHTML) - 1; |
|||
if ( prevPane > 0 ) |
|||
performGalleryMorph(targetID, prevPane); |
|||
else { |
|||
var maxIndex = 1; |
|||
while ( returnObjById(targetID + "Content" + maxIndex) ) |
|||
maxIndex++; |
|||
performGalleryMorph(targetID, maxIndex - 1); |
|||
} |
|||
} |
|||
/* Function that creates ED's collapsing objects and toggle links. |
|||
* Added 11/5/2007 by WhiteMystery (misterioblanco@gmail.com) |
|||
* on Encyclopedia Dramatica, stolen by Zaza |
|||
* Uses publicly available code in one function, where noted. |
|||
* |
|||
* Updated: 1/11/2008 by WhiteMystery to add new Morphing Objects |
|||
* functionality. |
|||
* Updated: 23/5/2009 by MFH to add 2 new kinds of morph: |
|||
* multiMorph and galleryMorph */ |
|||
function createMorphLinks () { |
|||
var morphMasterCollection = document.getElementsByClass("morphMaster"); |
|||
var multiMorphMasterCollection = document.getElementsByClass("multiMorphMaster"); |
|||
var galleryMorphMasterCollection = document.getElementsByClass("galleryMorphMaster"); |
|||
for (var i = 0; i < morphMasterCollection.length; i++) { |
|||
var spanID = morphMasterCollection[i].getAttribute("id"); |
|||
var targetID = spanID.substr(0, spanID.length - 6); |
|||
var counter = 1; |
|||
// Create forward and backward paging if the paging elements exist |
|||
if ( returnObjById(targetID + "LinkNext") && returnObjById(targetID + "LinkPrev") && returnObjById(targetID + "Content1") ) { |
|||
// Create the forward link |
|||
var nextLink = document.createElement("div"); |
|||
nextLink.innerHTML = returnObjById(targetID + "LinkNext").innerHTML; |
|||
nextLink.setAttribute('name', targetID + "LinkNext"); |
|||
nextLink.onclick = morphForward; |
|||
nextLink.className = "morphLink"; |
|||
returnObjById(targetID + "LinkNext").innerHTML = ""; |
|||
returnObjById(targetID + "LinkNext").appendChild(nextLink, 0); |
|||
// Create the backward link |
|||
var prevLink = document.createElement("div"); |
|||
prevLink.innerHTML = returnObjById(targetID + "LinkPrev").innerHTML; |
|||
prevLink.setAttribute('name', targetID + "LinkPrev"); |
|||
prevLink.onclick = morphBackward; |
|||
prevLink.className = "morphLink"; |
|||
returnObjById(targetID + "LinkPrev").innerHTML = ""; |
|||
returnObjById(targetID + "LinkPrev").appendChild(prevLink, 0); |
|||
// Initialize content panes |
|||
while ( returnObjById(targetID + "Content" + counter) ) { |
|||
if ( counter == 1 ) |
|||
returnObjById(targetID + "Content" + counter).style.display = tableOrNot(targetID + "Content" + counter); |
|||
else |
|||
returnObjById(targetID + "Content" + counter).style.display = "none"; |
|||
counter++; |
|||
} |
|||
} |
} |
||
else { |
|||
hooksCustomRender[i](); |
|||
counter = 1; |
|||
// Whether or not there is paging, generate normal links |
|||
while (returnObjById(targetID + "Link" + counter) && returnObjById(targetID + "Content" + counter)) { |
|||
var morphLink = document.createElement("div"); |
|||
morphLink.innerHTML = returnObjById(targetID + "Link" + counter).innerHTML; |
|||
returnObjById(targetID + "Link" + counter).innerHTML = ""; |
|||
returnObjById(targetID + "Link" + counter).appendChild(morphLink); |
|||
morphLink.className = "morphLink"; |
|||
morphLink.setAttribute('name', targetID + "Link" + counter); |
|||
morphLink.onclick = function () { |
|||
var targetID = this.getAttribute('name').replace(/Link\d+$/, ''); |
|||
var targetNumber = this.parentNode.id.replace(/.+Link/, ''); |
|||
performMorph(targetID, targetNumber); |
|||
return |
|||
}; |
|||
// Initialize content panes |
|||
if (counter == 1) |
|||
returnObjById(targetID + "Content" + counter).style.display = tableOrNot(targetID + "Content" + counter); |
|||
else |
|||
returnObjById(targetID + "Content" + counter).style.display = "none"; |
|||
counter++; |
|||
} |
} |
||
morphMasterCollection[i].innerHTML = "1"; |
|||
morphMasterCollection[i].style.display = "none"; |
|||
} |
} |
||
for (var i = 0; i < multiMorphMasterCollection.length; i++) { |
|||
var spanID = multiMorphMasterCollection[i].getAttribute("id"); |
|||
var targetID = spanID.substr(0, spanID.length - 6); |
|||
var counter = 1; |
|||
// Create forward and backward paging if the paging elements exist |
|||
if (document.getElementsByClass(targetID + "LinkNext") && document.getElementsByClass(targetID + "LinkPrev") && document.getElementsByClass(targetID + "Content1")) { |
|||
// Create the forward link |
|||
var nextLinkCollection = document.getElementsByClass(targetID + "LinkNext"); |
|||
for (j = 0; j < nextLinkCollection.length; j++) { |
|||
var nextLink = document.createElement("div"); |
|||
nextLink.innerHTML = nextLinkCollection[j].innerHTML; |
|||
nextLink.setAttribute('name', targetID + "LinkNext"); |
|||
nextLink.onclick = morphForward; |
|||
nextLink.className = "morphLink"; |
|||
nextLinkCollection[j].innerHTML = ""; |
|||
nextLinkCollection[j].appendChild(nextLink, 0); |
|||
} |
|||
// Create the backward link |
|||
var prevLinkCollection = document.getElementsByClass(targetID + "LinkPrev"); |
|||
for (j = 0; j < prevLinkCollection.length; j++) { |
|||
var prevLink = document.createElement("div"); |
|||
prevLink.innerHTML = prevLinkCollection[j].innerHTML; |
|||
prevLink.setAttribute('name', targetID + "LinkPrev"); |
|||
prevLink.onclick = morphBackward; |
|||
prevLink.className = "morphLink"; |
|||
prevLinkCollection[j].innerHTML = ""; |
|||
prevLinkCollection[j].appendChild(prevLink, 0); |
|||
} |
|||
// Initialize content panes |
|||
while (returnObjById(targetID + "Content" + counter)) { |
|||
if (counter == 1) |
|||
returnObjById(targetID + "Content" + counter).style.display = tableOrNot(targetID + "Content" + counter); |
|||
else |
|||
returnObjById(targetID + "Content" + counter).style.display = "none"; |
|||
counter++; |
|||
} |
|||
} |
|||
counter = 1; |
|||
// Whether or not there is paging, generate normal links |
|||
while ( document.getElementsByClass(targetID + "Link" + counter) && returnObjById(targetID + "Content" + counter) ) { |
|||
var morphLinkCollection = document.getElementsByClass(targetID + "Link" + counter); |
|||
for (j = 0; j < morphLinkCollection.length; j++) { |
|||
var morphLink = document.createElement("div"); |
|||
morphLink.innerHTML = morphLinkCollection[j].innerHTML; |
|||
morphLinkCollection[j].innerHTML = ""; |
|||
morphLink.setAttribute('name', targetID + "Link" + counter); |
|||
morphLinkCollection[j].appendChild(morphLink, 0); |
|||
morphLink.onclick = function () { |
|||
var targetID = this.getAttribute('name').replace(/Link\d+$/, ''); |
|||
var targetNumber = this.getAttribute('name').replace(/.+Link/, ''); |
|||
performMorph(targetID, targetNumber); |
|||
return |
|||
}; |
|||
morphLink.className = "morphLink"; |
|||
} |
|||
// Initialize content panes |
|||
if (counter == 1) |
|||
returnObjById(targetID + "Content" + counter).style.display = tableOrNot(targetID + "Content" + counter); |
|||
else |
|||
returnObjById(targetID + "Content" + counter).style.display = "none"; |
|||
counter++; |
|||
} |
|||
multiMorphMasterCollection[i].innerHTML = "1"; |
|||
multiMorphMasterCollection[i].style.display = "none"; |
|||
} |
|||
for (var i = 0; i < galleryMorphMasterCollection.length; i++) { |
|||
var spanID = galleryMorphMasterCollection[i].getAttribute("id"); |
|||
var targetID = spanID.substr(0, spanID.length - 6); |
|||
var counter = 1; |
|||
// Create forward and backward paging if the paging elements exist |
|||
if ( returnObjById(targetID + "LinkNext") && returnObjById(targetID + "LinkPrev") && returnObjById(targetID + "Content1") ) { |
|||
// Create the forward link |
|||
var nextLink = document.createElement("div"); |
|||
nextLink.innerHTML = returnObjById(targetID + "LinkNext").innerHTML; |
|||
nextLink.setAttribute('name', targetID + "LinkNext"); |
|||
nextLink.onclick = galleryMorphForward; |
|||
nextLink.className = "morphLink"; |
|||
returnObjById(targetID + "LinkNext").innerHTML = ""; |
|||
returnObjById(targetID + "LinkNext").appendChild(nextLink, 0); |
|||
// Create the backward link |
|||
var prevLink = document.createElement("div"); |
|||
prevLink.innerHTML = returnObjById(targetID + "LinkPrev").innerHTML; |
|||
prevLink.setAttribute('name', targetID + "LinkPrev"); |
|||
prevLink.onclick = galleryMorphBackward; |
|||
prevLink.className = "morphLink"; |
|||
returnObjById(targetID + "LinkPrev").innerHTML = ""; |
|||
returnObjById(targetID + "LinkPrev").appendChild(prevLink, 0); |
|||
// Initialize content panes |
|||
while ( returnObjById(targetID + "Content" + counter) ) { |
|||
if (counter == 1) |
|||
returnObjById(targetID + "Content" + counter).style.display = tableOrNot(targetID + "Content" + counter); |
|||
else |
|||
returnObjById(targetID + "Content" + counter).style.display = "none"; |
|||
counter++; |
|||
} |
|||
if (counter == 2) { |
|||
returnObjById(targetID + "LinkNext").style.display = "none"; |
|||
} |
|||
galleryCounter = counter - 1; |
|||
returnObjById(targetID + "Master").setAttribute("counter", galleryCounter); |
|||
if (returnObjById(targetID + "Counter")) { |
|||
returnObjById(targetID + "Counter").innerHTML = "(1/" + galleryCounter + ")"; |
|||
} |
|||
} |
|||
galleryMorphMasterCollection[i].innerHTML = "1"; |
|||
galleryMorphMasterCollection[i].style.display = "none"; |
|||
} |
|||
} |
|||
/* Function that toggles ED's collapsing objects. |
|||
* Added 11/5/2007 by WhiteMystery (misterioblanco@gmail.com) |
|||
* on Encyclopedia Dramatica, stolen by Zaza |
|||
* Taken from http://www.netlobo.com/javascript_get_element_id.html */ |
|||
function returnObjById(id) { |
|||
if (document.getElementById) |
|||
var returnVar = document.getElementById(id); |
|||
else if (document.all) |
|||
var returnVar = document.all[id]; |
|||
else if (document.layers) |
|||
var returnVar = document.layers[id]; |
|||
return returnVar; |
|||
} |
|||
/* Attiva il charinsert per gli anonimi nel box "newarticleintro" */ |
|||
function charinsert_anon_hack () { |
|||
if(!(wgAction == "edit" && wgArticleId == 0 && wgUserName == null)) return; |
|||
var box = getElementsByClass(document.getElementById("bodyContent"), "mw-newarticletextanon", 'div')[0]; |
|||
if (!box) return; |
|||
var link = '<' + 'a href="#" onclick="insertTags('$1','','');return false">$1<' + '/a>'; |
|||
box.innerHTML = box.innerHTML.replace(/<charinsert>(.+?)<\/charinsert>/, link); |
|||
return; |
return; |
||
} |
|||
/* Function to add a "purge" button at the top of the page, |
|||
* usefull for dpl, random and similar things that need the |
|||
* cache of the server. |
|||
* |
|||
* Created by MFH */ |
|||
var buttonPurge = 0; |
|||
function createPurgeButton() { |
|||
if (buttonPurge == 0 || wgCanonicalNamespace == 'Special') return; |
|||
if (document.getElementById('ca-report-problem')) { /* Modifies the "report a problem" button, that is already invisible */ |
|||
document.getElementById('ca-report-problem').getElementsByTagName('a')[0].innerHTML = 'Purge'; |
|||
document.getElementById('ca-report-problem').getElementsByTagName('a')[0].href = wgServer + wgScriptPath + '/index.php?title=' + wgPageName + '&action=purge'; |
|||
document.getElementById('ca-report-problem').setAttribute('id', 'ca-purge'); |
|||
} |
|||
else { |
|||
var menuList = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; |
|||
var newLi = document.createElement('li'); |
|||
newLi.setAttribute('id', 'ca-purge'); |
|||
newLi.innerHTML = '<a href="' + wgServer + wgScriptPath + '/index.php?title=' + wgPageName + '&action=purge">Purge</a>'; |
|||
menuList.appendChild(newLi); |
|||
} |
|||
} |
} |
||
// Funzioni da avviare da cellulare (Solo PP) |
|||
function hooksMobile() { |
|||
/* Visualizza correttamente categorie nascoste in IE */ |
|||
imgMobilePatch(); |
|||
function hiddencats_IE () { |
|||
numList(); |
|||
if (navigator.appName != "Microsoft Internet Explorer") return; |
|||
randomList(); |
|||
var div = document.getElementById("mw-hidden-catlinks"); |
|||
createNavigationBarToggleButton(); |
|||
if (div == null) return; |
|||
createToggleLinks(); |
|||
var span = document.createElement('span'); |
|||
createMorphLinks(); |
|||
span.id = 'mw-hidden-catlinks-switch'; |
|||
span.innerHTML = ">>"; |
|||
div.insertBefore(span, div.firstChild); |
|||
return; |
|||
} |
} |
||
/*************** Utilità ***************/ |
|||
/* Class che aggiunge "target= '_blank'" ai link */ |
|||
// Funzione per importare script |
|||
function target_blank () { |
|||
// Parametri: |
|||
var tags = getElementsByClass(document.getElementsByTagName('body')[0], "target-blank"); |
|||
// script: Nome della pagina in cui si trova lo script, solitamente una sottopagina di Nonciclopedia:Script |
|||
if (tags == null) return; |
|||
// condition: Condizione logica necessaria per includere lo script |
|||
var i, j, links; |
|||
function importScript(script, condition) { |
|||
for (i=0; i < tags.length; i++) { |
|||
if(!script) { |
|||
links = tags[i].getElementsByTagName('a'); |
|||
for (j=0; j < links.length; j++) links[j].target = '_blank'; |
|||
} |
|||
return; |
|||
} |
|||
/* Visualizza note come tooltip */ |
|||
/* by Sanjilops - http://nonciclopedia.wikia.com/wiki/Utente:Sanjilops */ |
|||
var disablereftooltip = false; |
|||
function ref_tooltip () { |
|||
if (disablereftooltip) return; |
|||
var refs = getElementsByClass(document.getElementById('bodyContent'), "reference", 'sup'); |
|||
if (!refs) return; |
|||
for (var i = 0; i < refs.length; i++) Do(refs[i]); |
|||
return; |
|||
function Do (ref) { |
|||
var span = document.createElement('span'); |
|||
var id = ref.id.substr('cite_ref-'.length); |
|||
span.className = "reference-tt"; |
|||
span.id = "cite_tt-" + id; |
|||
var li = document.getElementById('cite_note-' + id.replace(/_(\d+)-\d+$/, '-$1')); |
|||
if (!li) return; |
|||
var temp = li.innerHTML; |
|||
temp = temp.split(/^.+a href=\"#cite_ref-.+\" title=\"\">.+?<\/a>(<\/sup>)? /); |
|||
span.innerHTML = (temp.length)? temp[temp.length - 1] : temp; |
|||
if (ref.offsetLeft < document.getElementById('bodyContent').offsetWidth/2) span.style.left = (ref.offsetWidth - 1) + 'px'; |
|||
else span.style.right = (ref.offsetWidth - 1) + 'px'; |
|||
temp = getText(span); |
|||
temp = temp.length * 12; |
|||
span.style.width = (temp < 400)? temp + 'px' : "400px"; |
|||
ref.appendChild(span); |
|||
return; |
|||
} |
|||
} |
|||
/* Funzione che imposta il tasto "modifica" sulla versione corrente nella schermata delle differenze; non attiva di default. |
|||
* Per attivarla inserire nel proprio monobook.js il codice: |
|||
addOnloadHook(editcurrentid); |
|||
*/ |
|||
function editcurrentid () { |
|||
var b = document.getElementById('ca-edit'); |
|||
if (!b) return; |
|||
if (getElementsByClass(document, 'diff', 'table').length == 0) return; |
|||
var l = b.firstChild; |
|||
l.href = l.href.replace(/&oldid=\d+/, ''); |
|||
appendText(l, '*'); |
|||
return; |
|||
} |
|||
/* multiSFX */ |
|||
var multislide_time = 1000; |
|||
var multislide_interval = 10; |
|||
var noMultislide = false; |
|||
var multislide_state = new Object(); |
|||
var multislide_master = new Object(); |
|||
function multislide_startup () { |
|||
if (noMultislide) return; |
|||
var toggles = getElementsByClass(document, "multislideToggle"); |
|||
if (!toggles.length) return; |
|||
var names = new Array(); |
|||
var id = '', i, elements, master; |
|||
for (var I=0; I< toggles.length; I++) { |
|||
id = toggles[I].title; |
|||
if (String(names).indexOf(id) != -1) continue; |
|||
names[names.length] = id; |
|||
multislide_state[id] = false; |
|||
master = document.getElementById(id + "Master"); |
|||
if (master) { |
|||
multislide_master[id] = new Object(); |
|||
multislide_master[id].onload = hasClass(master, "slideOnload"); |
|||
multislide_master[id].time = (/slideTime-\d+/.test(master.className))? parseInt(master.className.match(/slideTime-(\d+)/)[1]) : -1; |
|||
multislide_master[id].fade = hasClass(master, "slideFade"); |
|||
} |
|||
else multislide_master[id] = null; |
|||
} |
|||
var dom, n; |
|||
for (I=0; I< names.length; I++) { |
|||
id = names[I]; |
|||
n = 0; |
|||
dom = document.getElementsByTagName('body')[0].getElementsByTagName('*'); |
|||
for (i = 0; i < dom.length; i++) { |
|||
if (dom[i].title == id && dom[i].nodeName.toUpperCase() != 'A') { |
|||
if (hasClass(dom[i], "multislideToggle")) { |
|||
dom[i].setAttribute('name', id + "-Toggle"); |
|||
CreateToggle(dom[i], id, n); |
|||
n++; |
|||
} |
|||
else { |
|||
dom[i].setAttribute('name', id + "-Content"); |
|||
SetStartPosition(dom[i]); |
|||
} |
|||
dom[i].removeAttribute('title'); |
|||
} |
|||
} |
|||
if (multislide_master[id] && multislide_master[id].onload) multislide_toggle(id, multislide_master[id].time); |
|||
} |
|||
return; |
|||
function CreateToggle (el, id, n) { |
|||
var time = (/slideTime-\d+/.test(el.className))? parseInt(el.className.match(/slideTime-(\d+)/)[1]) : -1; |
|||
var fade = hasClass(el, "slideFade"); |
|||
if (hasClass(el, "slideHover")) { |
|||
el.onmouseover = function () {multislide_toggle(id, time, fade, true); return;} |
|||
el.onmouseout = function () {multislide_toggle(id, time, fade, false); return;} |
|||
} |
|||
else el.onclick = function () {multislide_toggle(id, time, fade); return;}; |
|||
var On = getElementsByClass(el, "slideOn")[0]; |
|||
if (!On) return; |
|||
var toggle; |
|||
if (el.firstChild.nodeType != 1) { |
|||
toggle = document.createElement('span'); |
|||
toggle.innerHTML = el.firstChild.nodeValue; |
|||
el.replaceChild(toggle, el.firstChild); |
|||
} |
|||
else toggle = el.firstChild; |
|||
toggle.id = id + "-toggle" + n; /* dato che n è i, gli id possono non essere consecutivi */ |
|||
On.id = id + "-toggle" + n + "-on"; |
|||
var Off = getElementsByClass(el, "slideOff")[0]; |
|||
if (!Off) { |
|||
Off = toggle.cloneNode(true); |
|||
Off.style.display = 'none'; |
|||
el.appendChild(Off); |
|||
} |
|||
Off.id = id + "-toggle" + n + "-off"; |
|||
return; |
|||
} |
|||
function SetStartPosition (el) { |
|||
var height = el.offsetHeight; |
|||
var width = el.offsetWidth; |
|||
if (hasClass(el, "slideFromTop")) { |
|||
el.style.top = '-' + height + 'px'; |
|||
return; |
return; |
||
} |
|||
if (hasClass(el, "slideFromBottom")) { |
|||
el.style.bottom = '-' + height + 'px'; |
|||
return; |
|||
} |
|||
if (!hasClass(el.parentNode, "slideNoResize") && (el.parentNode.style == undefined || !el.parentNode.style.height)) el.parentNode.style.height = height + 'px'; |
|||
if (hasClass(el, "slideFromLeft")) { |
|||
el.style.left = '-' + width + 'px'; |
|||
return; |
|||
} |
|||
if (hasClass(el, "slideFromRight")) el.style.right = '-' + width + 'px'; |
|||
return; |
|||
} |
|||
} |
|||
function multislide_toggle(id, toggle_time, toggle_fade, hoverWantedState) { |
|||
if(hoverWantedState != undefined && hoverWantedState == multislide_state[id]) return; |
|||
var contents = getElementsByName(id + "-Content"); |
|||
var el, time, fade; |
|||
for (var i = 0; i < contents.length; i++) { |
|||
el = contents[i]; |
|||
if (/slideTime-\d+/.test(el.className)) time = parseInt(el.className.match(/slideTime-(\d+)/)[1]); |
|||
else { |
|||
if (toggle_time != -1) time = toggle_time; |
|||
else { |
|||
if (multislide_master[id] && multislide_master[id].time != -1) time = multislide_master[id].time; |
|||
else time = multislide_time; |
|||
} |
|||
} |
|||
fade = hasClass(el, "slideFade") || toggle_fade || (multislide_master[id] && multislide_master[id].fade); |
|||
var dir = el.className.match(/slideFrom(Top|Bottom|Left|Right)/)[0].substr(9).toLowerCase(); |
|||
var framesize; |
|||
if (!multislide_state[id]) { |
|||
if (dir == 'top' || dir == 'bottom') framesize = el.parentNode.offsetHeight + el.offsetHeight; |
|||
else if (dir == 'left' || dir == 'right') framesize = el.parentNode.offsetWidth + el.offsetWidth; |
|||
Slide(el, dir, 0, framesize, time, multislide_interval); |
|||
} |
|||
else { |
|||
var size; |
|||
if (dir == 'top' || dir == 'bottom') { size = el.offsetHeight; framesize = el.parentNode.offsetHeight - size; } |
|||
else if (dir == 'left' || dir == 'right') { size = el.offsetWidth; framesize = el.parentNode.offsetWidth - size; } |
|||
Slide(el, dir, 0 - size, framesize, time, multislide_interval); |
|||
} |
|||
if (fade) _fade(el, time, multislide_state[id]); |
|||
} |
|||
var toggles = getElementsByName(id + "-Toggle"); |
|||
for (var i = 0; i < toggles.length; i++) { |
|||
var el = document.getElementById(id + "-toggle" + i); |
|||
if (!el) continue; |
|||
el.innerHTML = (multislide_state[id])? document.getElementById(id + "-toggle" + i + "-off").innerHTML : document.getElementById(id + "-toggle" + i + "-on").innerHTML; |
|||
} |
|||
multislide_state[id] = !multislide_state[id]; |
|||
return; |
|||
function _fade (el, time, rev) { |
|||
setTimeout(function () {Fade(el, time, multislide_interval, rev, (rev? 0.8 : 1)); }, 1); |
|||
setTimeout(function () {el.style.filter = "alpha(opacity=100)"; el.style.opacity = 1; }, time + 5*multislide_interval); |
|||
return;} |
|||
} |
|||
var multifade_time = 1000; |
|||
var multifade_interval = 10; |
|||
var multifade_state = new Object(); |
|||
var multifade_master = new Object(); |
|||
var noMultifade = false; |
|||
function multifade_startup () { |
|||
if (noMultifade) return; |
|||
var toggles = getElementsByClass(document, "multifadeToggle"); |
|||
if (!toggles.length) return; |
|||
var names = new Array(); |
|||
var id = '', i, elements, master; |
|||
for (var I=0; I< toggles.length; I++) { |
|||
id = toggles[I].title; |
|||
if (String(names).indexOf(id) != -1) continue; |
|||
names[names.length] = id; |
|||
multifade_state[id] = false; |
|||
master = document.getElementById(id + "Master"); |
|||
if (master) { |
|||
multifade_master[id] = new Object(); |
|||
multifade_master[id].onload = hasClass(master, "fadeOnload"); |
|||
multifade_master[id].time = (/fadeTime-\d+/.test(master.className))? parseInt(master.className.match(/fadeTime-(\d+)/)[1]) : -1; |
|||
} |
|||
else multifade_master[id] = null; |
|||
} |
|||
var dom, n; |
|||
for (I=0; I< names.length; I++) { |
|||
id = names[I]; |
|||
n = 0; |
|||
dom = document.getElementsByTagName('body')[0].getElementsByTagName('*'); |
|||
for (i = 0; i < dom.length; i++) { |
|||
if (dom[i].title == id && dom[i].nodeName.toUpperCase() != 'A') { |
|||
if (hasClass(dom[i], "multifadeToggle")) { |
|||
dom[i].setAttribute('name', id + "-Toggle"); |
|||
CreateToggle(dom[i], id, n); |
|||
n++; |
|||
} |
|||
else { |
|||
dom[i].setAttribute('name', id + "-Content"); |
|||
dom[i].style.opacity = 0; |
|||
dom[i].style.filter = 'alpha(opacity=0)'; |
|||
} |
|||
dom[i].removeAttribute('title'); |
|||
} |
|||
} |
|||
if (multifade_master[id] && multifade_master[id].onload) multifade_toggle(id, multifade_master[id].time); |
|||
} |
|||
return; |
|||
function CreateToggle (el, id, n) { |
|||
el.setAttribute('name', id + "-Toggle"); |
|||
var time = (/fadeTime-\d+/.test(el.className))? parseInt(el.className.match(/fadeTime-(\d+)/)[1]) : -1; |
|||
if (hasClass(el, "fadeHover")) { |
|||
el.onmouseover = function () {multifade_toggle(id, time, true); return;} |
|||
el.onmouseout = function () {multifade_toggle(id, time, false); return;} |
|||
} |
|||
else el.onclick = function () {multifade_toggle(id, time); return;}; |
|||
var On = getElementsByClass(el, "fadeOn")[0]; |
|||
if (!On) return; |
|||
var toggle; |
|||
if (el.firstChild.nodeType != 1) { |
|||
toggle = document.createElement('span'); |
|||
toggle.innerHTML = el.firstChild.nodeValue; |
|||
el.replaceChild(toggle, el.firstChild); |
|||
} |
|||
else toggle = el.firstChild; |
|||
toggle.id = id + "-toggle" + n; /* dato che n è i, gli id possono non essere consecutivi */ |
|||
On.id = id + "-toggle" + n + "-on"; |
|||
var Off = getElementsByClass(el, "fadeOff")[0]; |
|||
if (!Off) { |
|||
Off = toggle.cloneNode(true); |
|||
Off.style.display = 'none'; |
|||
el.appendChild(Off); |
|||
} |
|||
Off.id = id + "-toggle" + n + "-off"; |
|||
return; |
|||
} |
|||
} |
|||
function multifade_toggle(id, general_time, hoverWantedState) { |
|||
if(hoverWantedState != undefined && hoverWantedState == multifade_state[id]) return; |
|||
var contents = getElementsByName(id + "-Content"); |
|||
var el, time; |
|||
for (var i = 0; i < contents.length; i++) { |
|||
el = contents[i]; |
|||
if (/fadeTime-\d+/.test(el.className)) time = parseInt(el.className.match(/fadeTime-(\d+)/)[1]); |
|||
else { |
|||
if (general_time != -1) time = general_time; |
|||
else { |
|||
if (multifade_master[id] && multifade_master[id].time != -1) time = multifade_master[id].time; |
|||
else time = multifade_time; |
|||
} |
|||
} |
|||
Fade(el, time, multifade_interval, multifade_state[id], multifade_state[id]? 0.8 : 1); |
|||
} |
|||
var toggles = getElementsByName(id + "-Toggle"); |
|||
for (var i = 0; i < toggles.length; i++) { |
|||
var el = document.getElementById(id + "-toggle" + i); |
|||
if (!el) continue; |
|||
el.innerHTML = (multifade_state[id])? document.getElementById(id + "-toggle" + i + "-off").innerHTML : document.getElementById(id + "-toggle" + i + "-on").innerHTML; |
|||
} |
|||
multifade_state[id] = !multifade_state[id]; |
|||
return; |
|||
} |
|||
/* Parser for simple math expressions |
|||
Created by MFH for Nonciclopedia */ |
|||
function opSolve(opArray, posArray) { |
|||
var opDivided = new Array(Array(opArray[posArray[0]][0])); |
|||
var posDivided = new Array(Array(posArray[0], 0)); /* Position, length-1*/ |
|||
var opDivInd = 0; |
|||
for (var i = 1; i < posArray.length; i++) { /* Separates the different brackets*/ |
|||
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)); |
|||
} |
|||
} |
} |
||
if(condition || condition == undefined) { |
|||
for (var i = 0; i <= opDivInd; i++) { |
|||
var scriptElem = document.createElement('script'); |
|||
for (var j = 1; j < opDivided[opDivInd].length - 1; j++) { |
|||
scriptElem.type = 'text/javascript'; |
|||
if (opDivided[i][j] == '^') { |
|||
scriptElem.charset = 'UTF-8'; |
|||
opDivided[i][j-1] = Math.pow(parseFloat(opDivided[i][j-1]),parseFloat(opDivided[i][j+1])); |
|||
scriptElem.src = '/index.php?title=' + script + '&action=raw&ctype=text/javascript'; |
|||
opDivided[i].splice(j, 2); |
|||
document.getElementsByTagName('head')[0].appendChild(scriptElem); |
|||
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; |
|||
} |
|||
} |
|||
} |
} |
||
return; |
|||
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; |
|||
} |
} |
||
// Restituisce il valore di un cookie |
|||
function math_parser(operation, xValue) { |
|||
// Parametri: |
|||
var opArray = new Array(); |
|||
// name: Nome della variabile memorizzata nel cookie |
|||
var brInd = 0; /* Bracket index */ |
|||
function getCookie(name) { |
|||
var brIndMax = 0; |
|||
if(!document.cookie.length) { |
|||
return null; |
|||
for (var i = 0; i < operation.length; i++) { /* Divides the string in single characters */ |
|||
var textChunk = operation.substr(i,1); |
|||
if (textChunk != ' ') { /* Removes useless spaces */ |
|||
if (textChunk == '(') { /* Removes brackets, conserving the information */ |
|||
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)); |
|||
} |
|||
} |
|||
} |
} |
||
var start = document.cookie.indexOf(name); |
|||
i = 0; |
|||
if(start == -1) { |
|||
while (i < opArray.length - 1) { /* Puts numbers together again */ |
|||
return null; |
|||
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\.]/)) { |
|||
/* If is a number or a comma, or if is a minus at the beginnig of a bracket; and the following is a number or a comma */ |
|||
opArray[i][0] = opArray[i][0] + opArray[i+1][0]; |
|||
opArray.splice(i+1, 1); |
|||
} |
|||
else { |
|||
i++; |
|||
} |
|||
} |
} |
||
start += name.length + 1; |
|||
for (var i = brIndMax; i >= 0; i--) { |
|||
var end = document.cookie.indexOf(';', start); |
|||
var posArray = new Array(); |
|||
if(end == -1) { |
|||
for (var j = 0; j < opArray.length; j++) { |
|||
end = document.cookie.length; |
|||
if (opArray[j][1] == i) { |
|||
posArray.push(j); |
|||
} |
|||
} |
|||
opArray = opSolve(opArray, posArray); |
|||
} |
} |
||
return unescape(document.cookie.substring(start,end)); |
|||
return opArray[0][0]; |
|||
} |
} |
||
/*Analisi delle visite*/ |
|||
function init() { |
|||
codice = document.createElement('script'); |
|||
codice.type = 'text/javascript'; |
|||
if (wgUserName) { |
|||
codice.innerHTML = "var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-17496928-1']); _gaq.push(['_trackPageview']); (function() { 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);})();"; |
|||
} |
|||
else { |
|||
codice.innerHTML = "var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-17496918-1']); _gaq.push(['_trackPageview']); (function() {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);})();"; |
|||
} |
|||
headTag = document.getElementsByTagName("head")[0]; |
|||
headTag.appendChild(codice); |
|||
} |
|||
addOnloadHook(init); |
|||
/*************** Altro ***************/ |
|||
/* Funzione returnto in Special:Signup - disattivata per problemi */ |
|||
// Statistiche di Google |
|||
/*function entraSignUp() { |
|||
var _gaq = _gaq || []; |
|||
if(!wgUserName) { |
|||
_gaq.push(['_setAccount', 'UA-17496918-1']); |
|||
document.getElementById('pt-login').innerHTML='<a accesskey="o" title="La registrazione è consigliata, anche se non obbligatoria [o]" href="/index.php?title=Speciale:Signup&returnto=' + wgPageName + '>Entra / Registrati</a>' |
|||
_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); |
|||
} |
} |
||
addOnloadHook(entraSignUp);*/ |
|||
// Funzione per il Template:Caricamento |
|||
function |
function jsLoading() { |
||
$('.jsloading-pre').remove(); |
|||
window.fbAsyncInit = function() { |
|||
$('.jsloading-post').show(); |
|||
FB.init({appId: '331743818234', status: true, cookie: true, |
|||
xfbml: true}); |
|||
}; |
|||
(function() { |
|||
var e = document.createElement('script'); e.async = true; |
|||
e.src = document.location.protocol + |
|||
'//connect.facebook.net/en_US/all.js'; |
|||
document.getElementById('fb-root').appendChild(e); |
|||
}()); |
|||
addOnloadHook(facebooklikeboxTEST); |
|||
} |
} |
||
// Aggiunge l'Editintro nei link di modifica anche per gli utenti registrati |
|||
function addEditintro() { |
|||
/************************** MONOBOOK.JS *******************************/ |
|||
if($('#ca-talk').hasClass('new')) { |
|||
/************ SPOSTATO QUI FINO A RISOLUZIONE DEL PROBLEMA ************/ |
|||
$('#ca-talk a:first').attr('href', $('#ca-talk a:first').attr('href') + '&editintro=MediaWiki:Editintro'); |
|||
/************************ OnloadHooks ************/ |
|||
} |
|||
/* Funzioni generali */ |
|||
if(wgCurRevisionId) { |
|||
function hooks_monobook () { |
|||
$('#ca-edit a:first').attr('href', $('#ca-edit a:first').attr('href') + '&editintro=MediaWiki:Editintro'); |
|||
addeditintro(); |
|||
} |
|||
hooks_monobook_render (); |
|||
$('span.editsection a').each(function() { |
|||
communitya (); |
|||
$(this).attr('href', $(this).attr('href') + '&editintro=MediaWiki:Editintro'); |
|||
sharelinks(); |
|||
}); |
|||
search_thumb(); |
|||
ShoutBox_load(); |
|||
return; |
return; |
||
} |
} |
||
addOnloadHook(hooks_monobook); |
|||
/* Funzioni del rendering - separate per richiamarle in anteprima rapida */ |
|||
function hooks_monobook_render () { |
|||
addCss(); |
|||
hideEdit(); |
|||
rewriteTitle(); |
|||
change_subtitle(); |
|||
moveeditsection(); |
|||
sectionzero_editlink(); |
|||
/************** Pulsanti ***************/ |
|||
jsLoading(); // dev'essere sempre l'ultima!! |
|||
// Pulsanti aggiunti di default |
|||
return; |
|||
if(skin != 'wikiamobile' && mwCustomEditButtons) { |
|||
} |
|||
mwCustomEditButtons[mwCustomEditButtons.length] = { |
|||
"imageFile": "https://upload.wikimedia.org/wikipedia/commons/0/0c/Button_P_template.png", |
|||
/* Funzioni dell'editor */ |
|||
"speedTip": "Template", |
|||
function hooks_monobook_edit () { |
|||
"tagOpen": "{{", |
|||
if (wgAction != 'edit' && wgAction != 'submit') return; |
|||
"tagClose": "}" + "}", |
|||
Quick_Editor(); |
|||
"sampleText": "Template" |
|||
// vandal_block_load(); |
|||
return; |
|||
} |
|||
addOnloadHook(hooks_monobook_edit); |
|||
/* Codice per far scomparire tasto modifica in articoli da cancellare */ |
|||
/* Per disabilitarlo: aggiungere nel proprio monobook.js la riga */ |
|||
/* disablehideEdit = 1; */ |
|||
var disablehideEdit = 0; |
|||
function hideEdit () { |
|||
if(disablehideEdit) return; |
|||
if (!document.getElementById('ca-edit') || !document.getElementById('hide-edit')) return; |
|||
editLink = document.getElementById('ca-edit').firstChild; |
|||
editLink.removeAttribute('href', 0); |
|||
editLink.style.color = 'gray'; |
|||
editLink.innerHTML = 'X'; |
|||
return; |
|||
} |
|||
/* Reskin parser */ |
|||
/* Permette di personalizzare il foglio di stile di una pagina */ |
|||
/* Utilizzato da Template:Css */ |
|||
var disableaddCss = 0; |
|||
function addCss () { |
|||
if(disableaddCss) return; |
|||
var Css = document.getElementById('add-css'); |
|||
if (!Css) return; |
|||
// aggiungo l'eventuale stile esterno (linked): |
|||
var linkElem = document.createElement( 'link' ); |
|||
linkElem.type = 'text/css'; |
|||
linkElem.rel = 'stylesheet'; |
|||
linkElem.href = '/index.php?title=Nonciclopedia:Skin/' + Css.innerHTML + '.css&action=raw&ctype=text/css&smaxage=120'; |
|||
linkElem.id = "add-css-link"; |
|||
document.getElementsByTagName( 'head' )[0].appendChild( linkElem ); |
|||
return; |
|||
} |
|||
/* Funzioni per impedire svuotamenti di massa da parte dei vandali */ |
|||
var VB_code = false; |
|||
function vandal_block_load () { |
|||
if ((wgAction != 'edit' && wgAction != 'submit') || wgArticleId == 0 || wgPageName == "Nonciclopedia:Sandbox" || wgPageName == "Template:Prova" || ((wgNamespaceNumber == 2 || wgNamespaceNumber == 3) && RegExp("^" + wgUserName + "/?").test(wgTitle))) return false; /* non si attiva su pagine inesistenti, sandbox e sulle proprie pagine utenti e discussioni */ |
|||
if (wgUserGroups) { |
|||
if(wgUserGroups.join().indexOf("emailconfirmed") != -1 && wgUserGroups.join().indexOf("autoconfirmed") != -1) return false; |
|||
} |
|||
VB_code = document.getElementById('wpTextbox1').value; |
|||
if (VB_code.length == 0) return false; |
|||
var button = document.getElementById('wpSave'); |
|||
button.onclick = vandal_block; |
|||
return; |
|||
} |
|||
function vandal_block () { |
|||
var textbox = document.getElementById('wpTextbox1'); |
|||
if (/\{\{\s*(cancellazione|scadenza|accusa).*\}\}\n/i.test(VB_code)) { |
|||
var template = /\{\{\s*(cancellazione|scadenza|accusa).*\}\}\n/i.exec(VB_code); |
|||
if (template != null && textbox.value.indexOf(template) == -1) textbox.value = template + '\n' + textbox.value; /* rimette i template quando vengono rimossi */ |
|||
} |
|||
var is_section = /§ion=\d/.test(location.search); |
|||
if (textbox.value.length/VB_code.length > 0.5 || (!is_section && /^#\s?REDIRECT/i.test(textbox.value))) return; /* il blocco scatta per riduzioni del testo superiori al 50%; eccezione per i redirect */ |
|||
if (textbox.value.length/VB_code.length < 0.2 && !is_section) { |
|||
alert("Questo potrebbe essere un vandalismo. Il salvataggio verrà annullato"); |
|||
textbox.value = VB_code; |
|||
return; |
|||
} |
|||
var n1 = Math.round(Math.random() * 9000) + 1000; |
|||
var n2 = Math.round(Math.random() * 9000) + 1000; |
|||
var answer = prompt("Attenzione: questo potrebbe essere un vandalismo. Rispondi correttamente alla domanda per continuare. Per evitare questo passaggio, registrati e conferma la registrazione via mail.\n\nQuanto fa " + n1 + " + " + n2 + " ?", ''); |
|||
if (answer == null || answer.match(/\d+/) != n1 + n2) { |
|||
alert("Risposta non corretta. Il salvataggio verrà annullato"); |
|||
textbox.value = VB_code; |
|||
return; |
|||
} |
|||
alert("Se sei un vandalo, sappi che la tua modifica verrà annullata entro un minuto. Lascia perdere e trovati un altro passatempo. Se invece non sei un vandalo, registrati, o conferma la registrazione con la mail."); |
|||
return; |
|||
} |
|||
/** Extra toolbar options ****************************************************** |
|||
* |
|||
* Description: UNDOCUMENTED |
|||
* Maintainers: [[User:MarkS]]?, [[User:Voice of All]], [[User:R. Koot]] |
|||
*/ |
|||
//This is a modified copy of a script by User:MarkS for extra features added by User:Voice of All. |
|||
// This is based on the original code on Wikipedia:Tools/Editing tools |
|||
// To disable this script, add <code>mwCustomEditButtons = [];<code> to [[Special:Mypage/monobook.js]] |
|||
if (mwCustomEditButtons) { |
|||
mwCustomEditButtons[mwCustomEditButtons.length] = { |
|||
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/0/0c/Button_P_template.png", |
|||
"speedTip": "Template", |
|||
"tagOpen": "{{", |
|||
"tagClose": "}" + "}", |
|||
"sampleText": "Template"}; |
|||
mwCustomEditButtons[mwCustomEditButtons.length] = { |
|||
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/0/05/Button_Anf%C3%BChrung.png", |
|||
"speedTip": "Citazione", |
|||
"tagOpen": "{{Cit|", |
|||
"tagClose": "|Testo sotto}" + "}", |
|||
"sampleText": "Testo citazione"}; |
|||
} |
|||
/*************** INIZIO CATEGORYTREE *****************/ |
|||
/* Messaggi in italiano */ |
|||
var categoryTreeCollapseMsg = "comprimi"; |
|||
var categoryTreeExpandMsg = "espandi"; |
|||
var categoryTreeCollapseBulletMsg = "[\x3cb\x3e−\x3c/b\x3e]"; |
|||
var categoryTreeExpandBulletMsg = "[\x3cb\x3e+\x3c/b\x3e]"; |
|||
var categoryTreeLoadMsg = "carica"; |
|||
var categoryTreeLoadingMsg = "caricamento in corso"; |
|||
var categoryTreeNothingFoundMsg = "nessun risultato"; |
|||
var categoryTreeNoSubcategoriesMsg = "nessuna sottocategoria."; |
|||
var categoryTreeNoParentCategoriesMsg = "nessuna categoria superiore"; |
|||
var categoryTreeNoPagesMsg = "nessuna voce né sottocategoria."; |
|||
var categoryTreeErrorMsg = "Problema nel caricamento dei dati."; |
|||
var categoryTreeRetryMsg = "Attendere un momento e riprovare."; |
|||
/* Codice */ |
|||
function categoryTreeNextDiv(e) { |
|||
var n= e.nextSibling; |
|||
while ( n && ( n.nodeType != 1 || n.nodeName != 'DIV') ) { |
|||
//alert('nodeType: ' + n.nodeType + '; nodeName: ' + n.nodeName); |
|||
n= n.nextSibling; |
|||
} |
|||
return n; |
|||
} |
|||
function categoryTreeExpandNode(cat, options, lnk) { |
|||
var div= categoryTreeNextDiv( lnk.parentNode.parentNode ); |
|||
div.style.display= 'block'; |
|||
lnk.innerHTML= categoryTreeCollapseBulletMsg; |
|||
lnk.title= categoryTreeCollapseMsg; |
|||
lnk.onclick= function() { categoryTreeCollapseNode(cat, options, lnk) } |
|||
if (!lnk.className.match(/(^| )CategoryTreeLoaded($| )/)) { |
|||
categoryTreeLoadNode(cat, options, lnk, div); |
|||
} |
|||
} |
|||
function categoryTreeCollapseNode(cat, options, lnk) { |
|||
var div= categoryTreeNextDiv( lnk.parentNode.parentNode ); |
|||
div.style.display= 'none'; |
|||
lnk.innerHTML= categoryTreeExpandBulletMsg; |
|||
lnk.title= categoryTreeExpandMsg; |
|||
lnk.onclick= function() { categoryTreeExpandNode(cat, options, lnk) } |
|||
} |
|||
function categoryTreeLoadNode(cat, options, lnk, div) { |
|||
div.style.display= 'block'; |
|||
lnk.className= 'CategoryTreeLoaded'; |
|||
lnk.innerHTML= categoryTreeCollapseBulletMsg; |
|||
lnk.title= categoryTreeCollapseMsg; |
|||
lnk.onclick= function() { categoryTreeCollapseNode(cat, options, lnk) } |
|||
categoryTreeLoadChildren(cat, options, div) |
|||
} |
|||
function categoryTreeEncodeValue(value) { |
|||
switch (typeof value) { |
|||
case 'function': |
|||
throw new Error("categoryTreeEncodeValue encountered a function"); |
|||
break; |
|||
case 'string': |
|||
s = '"' + value.replace(/([\\"'])/g, "\\$1") + '"'; |
|||
break; |
|||
case 'number': |
|||
case 'boolean': |
|||
case 'null': |
|||
s = String(value); |
|||
break; |
|||
case 'object': |
|||
if ( !value ) { |
|||
s = 'null'; |
|||
} |
|||
else if (typeof value.length === 'number' && !(value.propertyIsEnumerable('length'))) { |
|||
s = ''; |
|||
for (i = 0; i<value.length; i++) { |
|||
v = value[i]; |
|||
if ( s!='' ) s += ', '; |
|||
s += categoryTreeEncodeValue( v ); |
|||
} |
|||
s = '[' + s + ']'; |
|||
} |
|||
else { |
|||
s = ''; |
|||
for (k in value) { |
|||
v = value[k]; |
|||
if ( s!='' ) s += ', '; |
|||
s += categoryTreeEncodeValue( k ); |
|||
s += ': '; |
|||
s += categoryTreeEncodeValue( v ); |
|||
} |
|||
s = '{' + s + '}'; |
|||
} |
|||
break; |
|||
default: |
|||
throw new Error("categoryTreeEncodeValue encountered strange variable type " + (typeof value)); |
|||
} |
|||
return s; |
|||
} |
|||
function categoryTreeLoadChildren(cat, options, div) { |
|||
div.innerHTML= '<i class="CategoryTreeNotice">' + categoryTreeLoadingMsg + '</i>'; |
|||
if ( typeof options == "string" ) { //hack for backward compatibility |
|||
options = { mode : options }; |
|||
} |
|||
function f( request ) { |
|||
if (request.status != 200) { |
|||
div.innerHTML = '<i class="CategoryTreeNotice">' + categoryTreeErrorMsg + ' </i>'; |
|||
var retryLink = document.createElement('a'); |
|||
retryLink.innerHTML = categoryTreeRetryMsg; |
|||
retryLink.onclick = function() { |
|||
categoryTreeLoadChildren(cat, options, div, enc); |
|||
} |
|||
div.appendChild(retryLink); |
|||
return; |
|||
} |
|||
result= request.responseText; |
|||
result= result.replace(/^\s+|\s+$/, ''); |
|||
if ( result == '' ) { |
|||
result= '<i class="CategoryTreeNotice">'; |
|||
if ( options.mode == 0 ) result= categoryTreeNoSubcategoriesMsg; |
|||
else if ( options.mode == 10 ) result= categoryTreeNoPagesMsg; |
|||
else if ( options.mode == 100 ) result= categoryTreeNoParentCategoriesMsg; |
|||
else result= categoryTreeNothingFoundMsg; |
|||
result+= '</i>'; |
|||
} |
|||
result = result.replace(/##LOAD##/g, categoryTreeExpandMsg); |
|||
div.innerHTML= result; |
|||
if(wgAction == 'edit' || wgAction == 'submit') { |
|||
var links = div.getElementsByTagName('a'); |
|||
var l, i=0; |
|||
for (i in links) { |
|||
l = links[i]; |
|||
if (!(/CategoryTreeLabelCategory/.test(l.className))) continue; |
|||
l.setAttribute('onclick', "this.href='javascript:void(0)'; insertTags('[[Categoria:" + l.innerHTML + "]]', '', '');"); |
|||
l.title = "Clicca per inserire"; |
|||
} |
|||
} |
|||
} |
|||
var opt = categoryTreeEncodeValue(options); |
|||
sajax_do_call( "efCategoryTreeAjaxWrapper", [cat, opt, 'json'] , f ); |
|||
} |
|||
/************ FINE CATEGORYTREE ****************/ |
|||
/* |
|||
== Tooltips and access keys == |
|||
*/ |
|||
ta = new Object(); |
|||
ta['pt-userpage'] = new Array('.','La tua pagina utente'); |
|||
ta['pt-anonuserpage'] = new Array('.','La pagina utente di questo indirizzo IP'); |
|||
ta['pt-mytalk'] = new Array('n','La tua pagina di discussione'); |
|||
ta['pt-anontalk'] = new Array('n','Discussioni sulle modifiche fatte da questo indirizzo IP'); |
|||
ta['pt-preferences'] = new Array('','Le tue preferenze'); |
|||
ta['pt-watchlist'] = new Array('l','La lista delle pagine che stai tenendo sotto osservazione'); |
|||
ta['pt-mycontris'] = new Array('y','L\'elenco dei tuoi contributi'); |
|||
ta['pt-login'] = new Array('o','La registrazione è consigliata, anche se non obbligatoria'); |
|||
ta['pt-anonlogin'] = new Array('o','La registrazione è consigliata, anche se non obbligatoria'); |
|||
ta['pt-logout'] = new Array('o','Uscita (logout)'); |
|||
ta['ca-talk'] = new Array('t','Vedi le discussioni relative a questa pagina'); |
|||
ta['ca-edit'] = new Array('e','Puoi modificare questa pagina. Per favore usa il pulsante di anteprima prima di salvare'); |
|||
ta['ca-addsection'] = new Array('+','Aggiungi un commento a questa discussione'); |
|||
ta['ca-viewsource'] = new Array('e','Questa pagina è protetta, ma puoi vedere il suo codice sorgente'); |
|||
ta['ca-history'] = new Array('h','Versioni precedenti di questa pagina'); |
|||
ta['ca-protect'] = new Array('=','Proteggi questa pagina'); |
|||
ta['ca-unprotect'] = new Array('=','Sblocca questa pagina'); |
|||
ta['ca-delete'] = new Array('d','Cancella questa pagina'); |
|||
ta['ca-undelete'] = new Array('d','Ripristina la pagina com\'era prima della cancellazione'); |
|||
ta['ca-move'] = new Array('m','Sposta questa pagina (cambia titolo)'); |
|||
ta['ca-watch'] = new Array('w','Aggiungi questa pagina alla tua lista di osservati speciali'); |
|||
ta['ca-unwatch'] = new Array('w','Elimina questa pagina dalla tua lista di osservati speciali'); |
|||
ta['search'] = new Array('f','Cerca all\'interno del sito'); |
|||
ta['p-logo'] = new Array('','Pagina principale'); |
|||
ta['n-mainpage'] = new Array('z','Visita la pagina principale'); |
|||
ta['n-portal'] = new Array('','Descrizione del progetto, cosa puoi fare, dove trovare le cose'); |
|||
ta['n-currentevents'] = new Array('','Informazioni sugli eventi di attualità'); |
|||
ta['n-recentchanges'] = new Array('r','Elenco delle ultime modifiche del sito'); |
|||
ta['n-randompage'] = new Array('x','Mostra una pagina a caso'); |
|||
ta['n-help'] = new Array('a','Pagine di aiuto'); |
|||
ta['n-sitesupport'] = new Array('','Aiutaci'); |
|||
ta['t-whatlinkshere'] = new Array('j','Elenco di tutte le pagine che sono collegate a questa'); |
|||
ta['t-recentchangeslinked'] = new Array('k','Elenco delle ultime modifiche alle pagine collegate a questa'); |
|||
ta['feed-rss'] = new Array('','Feed RSS per questa pagina'); |
|||
ta['feed-atom'] = new Array('','Feed Atom per questa pagina'); |
|||
ta['t-contributions'] = new Array('','Lista dei contributi di questo utente'); |
|||
ta['t-emailuser'] = new Array('','Invia un messaggio e-mail a questo utente'); |
|||
ta['t-upload'] = new Array('u','Carica immagini o file multimediali'); |
|||
ta['t-specialpages'] = new Array('q','Lista di tutte le pagine speciali'); |
|||
ta['ca-nstab-main'] = new Array('c','Vedi la voce'); |
|||
ta['ca-nstab-user'] = new Array('c','Vedi la pagina utente'); |
|||
ta['ca-nstab-media'] = new Array('c','Vedi la pagina del file multimediale'); |
|||
ta['ca-nstab-special'] = new Array('','Questa è una pagina speciale, non può essere modificata'); |
|||
ta['ca-nstab-wp'] = new Array('c','Vedi la pagina di servizio'); |
|||
ta['ca-nstab-image'] = new Array('c','Vedi la pagina dell\'immagine'); |
|||
ta['ca-nstab-mediawiki'] = new Array('c','Vedi il messaggio di sistema'); |
|||
ta['ca-nstab-template'] = new Array('c','Vedi il template'); |
|||
ta['ca-nstab-help'] = new Array('c','Vedi la pagina di aiuto'); |
|||
ta['ca-nstab-category'] = new Array('c','Vedi la pagina della categoria'); |
|||
/* |
|||
==Routine per il cambio del titolo e del sottotitolo== |
|||
*/ |
|||
/* "Technical restrictions" title fix ***************************************** |
|||
* |
|||
* copiato da :it:MediaWiki:Common.js, a sua volta copiato da :en:MediaWiki:Common.js |
|||
*/ |
|||
// The function looks for span like this: |
|||
// <span id="TitleText">title</span> |
|||
// |
|||
var disableAssignTitle = 0; // un utente può disabilitare l'assegnazione del titolo dal suo monobook.js |
|||
var disableAssignSubTitle = 0; // un utente può disabilitare l'assegnazione del sottotitolo dal suo monobook.js |
|||
function rewriteTitle() { |
|||
try { |
|||
if (!disableAssignTitle) { |
|||
var titleTextElement = document.getElementById("TitleText"); |
|||
if (titleTextElement) { |
|||
var titleTextHTML = titleTextElement.innerHTML; |
|||
titleText = pickUpText(titleTextElement); |
|||
// assegno il testo completo di HTML come titolo della pagina: |
|||
var h1 = document.getElementsByTagName("h1")[0]; |
|||
if (h1) { |
|||
h1.innerHTML = titleTextHTML; |
|||
} |
|||
// assegno il testo senza HTML come titolo della finestra del browser: |
|||
if (titleText == "") { |
|||
document.title = "Nonciclopedia"; |
|||
} |
|||
else { |
|||
document.title = titleText + " - Nonciclopedia"; |
|||
} |
|||
// nascondo l'elemento "TitleText" perché serve solo per il javascript: |
|||
titleTextElement.style.display = "none"; |
|||
// se è presente la specifica del colore, lo assegno al titolo della pagina: |
|||
var titleColorElement = document.getElementById("TitleColor"); |
|||
if (titleColorElement) { |
|||
titleColorText = pickUpText(titleColorElement); |
|||
if (h1) { |
|||
h1.style.color = titleColorText; |
|||
} |
|||
// nascondo l'elemento "TitleColor" perché serve solo per il javascript: |
|||
titleColorElement.style.display = "none"; |
|||
} |
|||
// se è presente la specifica dello stile del bordo inferiore, lo assegno al titolo della pagina: |
|||
var titleBorderBottomElement = document.getElementById("TitleBorderBottom"); |
|||
if (titleBorderBottomElement) { |
|||
titleBorderBottomText = pickUpText(titleBorderBottomElement); |
|||
if (h1) { |
|||
h1.style.borderBottom = titleBorderBottomText; |
|||
} |
|||
// nascondo l'elemento "TitleBorderBottom" perché serve solo per il javascript: |
|||
titleBorderBottomElement.style.display = "none"; |
|||
} |
|||
// se è presente la specifica del font-family, lo assegno al titolo della pagina: |
|||
var titleFontFamilyElement = document.getElementById("TitleFontFamily"); |
|||
if (titleFontFamilyElement) { |
|||
titleFontFamilyText = pickUpText(titleFontFamilyElement); |
|||
if (h1) { |
|||
h1.style.fontFamily = titleFontFamilyText; |
|||
} |
|||
// nascondo l'elemento "TitleFontFamily" perché serve solo per il javascript: |
|||
titleFontFamilyElement.style.display = "none"; |
|||
} |
|||
} |
|||
} |
|||
} catch (e) { |
|||
/* Something went wrong. */ |
|||
} |
|||
} |
|||
// similar to innerHTML, but only returns the text portions of the insides, excludes HTML |
|||
function pickUpText(aParentElement) { |
|||
var str = ""; |
|||
function pickUpTextInternal(aElement) { |
|||
var child = aElement.firstChild; |
|||
while (child) { |
|||
if (child.nodeType == 1) // ELEMENT_NODE |
|||
pickUpTextInternal(child); |
|||
else if (child.nodeType == 3) // TEXT_NODE |
|||
str += child.nodeValue; |
|||
child = child.nextSibling; |
|||
} |
|||
} |
|||
pickUpTextInternal(aParentElement); |
|||
return str; |
|||
} |
|||
var disableRandomSubTitle = 0; |
|||
// routine per l'eventuale assegnazione del sottotitolo (default: random): |
|||
function change_subtitle() { |
|||
var subTitleTextElement = document.getElementById("SubTitleText"); |
|||
if ((subTitleTextElement) && (!disableAssignSubTitle)) { |
|||
var subTitleTextHTML = subTitleTextElement.innerHTML; |
|||
subTitleText = pickUpText(subTitleTextElement); |
|||
// assegno il testo completo di HTML come sottotitolo della pagina: |
|||
var h3 = document.getElementsByTagName("h3")[0]; |
|||
if (h3) { |
|||
h3.innerHTML = subTitleTextHTML; |
|||
} |
|||
// nascondo l'elemento "SubTitleText" perché serve solo per il javascript: |
|||
subTitleTextElement.style.display = "none"; |
|||
} else { |
|||
sottotitoloRandom(); |
|||
} |
|||
} |
|||
function sottotitoloRandom() { |
|||
if (disableRandomSubTitle) return; |
|||
var sottotitoli = new Array(); |
|||
//attenzione, il testo non può contenere nessun tag o collegamento |
|||
sottotitoli[0] = "Da Nonciclopedia, l'enciclopedia libera su cauzione"; |
|||
sottotitoli[1] = "Da Nonciclopedia, l'enciclopedia libera con l'indulto"; |
|||
sottotitoli[2] = "Da Nonciclopedia, l'enciclopedia libera dagli inestetismi"; |
|||
sottotitoli[3] = "Dà Noncicloppedia, lenciclopedia l'ibbera dal'orttografia"; |
|||
sottotitoli[4] = "Da Nonciclopedia, l'enciclopedia che libera la gola e calma la tosse"; |
|||
sottotitoli[5] = "Da Nonciclopedia, l'enciclopedia libera... finché non ci beccano!"; |
|||
sottotitoli[6] = "Da Nonciclopedia, l'enciclopedia in libertà vigilata"; |
|||
sottotitoli[7] = "Da Nonciclopedia, l'enciclopedia libera da qualsivoglia contenuto"; |
|||
sottotitoli[8] = "Da Nonciclopedia, l'enciclopedia libidinosa"; |
|||
sottotitoli[9] = "Da Nonciclopedia, l'enciclopedia libertina"; |
|||
sottotitoli[10] = "Da Nonciclopedia, l'enciclopedia liberatoria"; |
|||
sottotitoli[11] = "Da Nonciclopedia, l'enciclopedia libera dal pudore. 8====D"; |
|||
sottotitoli[12] = "Da Nonciclopedia, l'enciclopedia liberalizzata (ma solo in Olanda)"; |
|||
sottotitoli[13] = "Da Nonciclopedia, l'enciclopedia liberamente ispirata all'Osservatore Romano"; |
|||
sottotitoli[14] = "Da Nonciclopedia, l'enciclopedia VM 18 e libera dai bambini"; |
|||
var n = Math.round(Math.random() * (sottotitoli.length - 1)); //scelta random |
|||
// assegno il testo come sottotitolo della pagina: |
|||
subtitle = document.getElementById("siteSub"); |
|||
subtitle.innerHTML = sottotitoli[n]; |
|||
} |
|||
/* Apre la shoutbox */ |
|||
function ShoutBox_load() { |
|||
if(wgPageName != "Nonciclopedia:ShoutBox" || wgAction !="view") return false; |
|||
window.open('http://nonciclopedia.wikia.com/index.php?title=Speciale:WidgetDashboard&action=render&useskin=monaco', '_blank','directories=no, location=no, menubar=no, toolbar=no, titlebar=no, width=250, height=300', false); |
|||
return; |
|||
} |
|||
/******************* QUICK EDITOR ********************/ |
|||
/* Functions for rapid saving and previewing without need of reloading the page: basically a hack on api.php */ |
|||
/* Created and mantained by Sanjilops (http://nonciclopedia.wikia.com/wiki/Utente:Sanjilops) */ |
|||
/* Feel free to copy and adapt it on your wiki. Check also MediaWiki:Monobook.css */ |
|||
/** |
|||
* |
|||
* MD5 (Message-Digest Algorithm) |
|||
* http://www.webtoolkit.info/ |
|||
* |
|||
**/ |
|||
var MD5 = function (string) { |
|||
function RotateLeft(lValue, iShiftBits) { |
|||
return (lValue<<iShiftBits) | (lValue>>>(32-iShiftBits)); |
|||
} |
|||
function AddUnsigned(lX,lY) { |
|||
var lX4,lY4,lX8,lY8,lResult; |
|||
lX8 = (lX & 0x80000000); |
|||
lY8 = (lY & 0x80000000); |
|||
lX4 = (lX & 0x40000000); |
|||
lY4 = (lY & 0x40000000); |
|||
lResult = (lX & 0x3FFFFFFF)+(lY & 0x3FFFFFFF); |
|||
if (lX4 & lY4) { |
|||
return (lResult ^ 0x80000000 ^ lX8 ^ lY8); |
|||
} |
|||
if (lX4 | lY4) { |
|||
if (lResult & 0x40000000) { |
|||
return (lResult ^ 0xC0000000 ^ lX8 ^ lY8); |
|||
} else { |
|||
return (lResult ^ 0x40000000 ^ lX8 ^ lY8); |
|||
} |
|||
} else { |
|||
return (lResult ^ lX8 ^ lY8); |
|||
} |
|||
} |
|||
function F(x,y,z) { return (x & y) | ((~x) & z); } |
|||
function G(x,y,z) { return (x & z) | (y & (~z)); } |
|||
function H(x,y,z) { return (x ^ y ^ z); } |
|||
function I(x,y,z) { return (y ^ (x | (~z))); } |
|||
function FF(a,b,c,d,x,s,ac) { |
|||
a = AddUnsigned(a, AddUnsigned(AddUnsigned(F(b, c, d), x), ac)); |
|||
return AddUnsigned(RotateLeft(a, s), b); |
|||
}; |
}; |
||
mwCustomEditButtons[mwCustomEditButtons.length] = { |
|||
"imageFile": "https://upload.wikimedia.org/wikipedia/commons/0/05/Button_Anf%C3%BChrung.png", |
|||
function GG(a,b,c,d,x,s,ac) { |
|||
"speedTip": "Citazione", |
|||
a = AddUnsigned(a, AddUnsigned(AddUnsigned(G(b, c, d), x), ac)); |
|||
"tagOpen": "{{Cit2|", |
|||
return AddUnsigned(RotateLeft(a, s), b); |
|||
"tagClose": "|Testo sotto}" + "}", |
|||
"sampleText": "Testo citazione" |
|||
}; |
}; |
||
function HH(a,b,c,d,x,s,ac) { |
|||
a = AddUnsigned(a, AddUnsigned(AddUnsigned(H(b, c, d), x), ac)); |
|||
return AddUnsigned(RotateLeft(a, s), b); |
|||
}; |
|||
function II(a,b,c,d,x,s,ac) { |
|||
a = AddUnsigned(a, AddUnsigned(AddUnsigned(I(b, c, d), x), ac)); |
|||
return AddUnsigned(RotateLeft(a, s), b); |
|||
}; |
|||
function ConvertToWordArray(string) { |
|||
var lWordCount; |
|||
var lMessageLength = string.length; |
|||
var lNumberOfWords_temp1=lMessageLength + 8; |
|||
var lNumberOfWords_temp2=(lNumberOfWords_temp1-(lNumberOfWords_temp1 % 64))/64; |
|||
var lNumberOfWords = (lNumberOfWords_temp2+1)*16; |
|||
var lWordArray=Array(lNumberOfWords-1); |
|||
var lBytePosition = 0; |
|||
var lByteCount = 0; |
|||
while ( lByteCount < lMessageLength ) { |
|||
lWordCount = (lByteCount-(lByteCount % 4))/4; |
|||
lBytePosition = (lByteCount % 4)*8; |
|||
lWordArray[lWordCount] = (lWordArray[lWordCount] | (string.charCodeAt(lByteCount)<<lBytePosition)); |
|||
lByteCount++; |
|||
} |
|||
lWordCount = (lByteCount-(lByteCount % 4))/4; |
|||
lBytePosition = (lByteCount % 4)*8; |
|||
lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80<<lBytePosition); |
|||
lWordArray[lNumberOfWords-2] = lMessageLength<<3; |
|||
lWordArray[lNumberOfWords-1] = lMessageLength>>>29; |
|||
return lWordArray; |
|||
}; |
|||
function WordToHex(lValue) { |
|||
var WordToHexValue="",WordToHexValue_temp="",lByte,lCount; |
|||
for (lCount = 0;lCount<=3;lCount++) { |
|||
lByte = (lValue>>>(lCount*8)) & 255; |
|||
WordToHexValue_temp = "0" + lByte.toString(16); |
|||
WordToHexValue = WordToHexValue + WordToHexValue_temp.substr(WordToHexValue_temp.length-2,2); |
|||
} |
|||
return WordToHexValue; |
|||
}; |
|||
function Utf8Encode(string) { |
|||
string = string.replace(/\r\n/g,"\n"); |
|||
var utftext = ""; |
|||
for (var n = 0; n < string.length; n++) { |
|||
var c = string.charCodeAt(n); |
|||
if (c < 128) { |
|||
utftext += String.fromCharCode(c); |
|||
} |
|||
else if((c > 127) && (c < 2048)) { |
|||
utftext += String.fromCharCode((c >> 6) | 192); |
|||
utftext += String.fromCharCode((c & 63) | 128); |
|||
} |
|||
else { |
|||
utftext += String.fromCharCode((c >> 12) | 224); |
|||
utftext += String.fromCharCode(((c >> 6) & 63) | 128); |
|||
utftext += String.fromCharCode((c & 63) | 128); |
|||
} |
|||
} |
|||
return utftext; |
|||
}; |
|||
var x=Array(); |
|||
var k,AA,BB,CC,DD,a,b,c,d; |
|||
var S11=7, S12=12, S13=17, S14=22; |
|||
var S21=5, S22=9 , S23=14, S24=20; |
|||
var S31=4, S32=11, S33=16, S34=23; |
|||
var S41=6, S42=10, S43=15, S44=21; |
|||
string = Utf8Encode(string); |
|||
x = ConvertToWordArray(string); |
|||
a = 0x67452301; b = 0xEFCDAB89; c = 0x98BADCFE; d = 0x10325476; |
|||
for (k=0;k<x.length;k+=16) { |
|||
AA=a; BB=b; CC=c; DD=d; |
|||
a=FF(a,b,c,d,x[k+0], S11,0xD76AA478); |
|||
d=FF(d,a,b,c,x[k+1], S12,0xE8C7B756); |
|||
c=FF(c,d,a,b,x[k+2], S13,0x242070DB); |
|||
b=FF(b,c,d,a,x[k+3], S14,0xC1BDCEEE); |
|||
a=FF(a,b,c,d,x[k+4], S11,0xF57C0FAF); |
|||
d=FF(d,a,b,c,x[k+5], S12,0x4787C62A); |
|||
c=FF(c,d,a,b,x[k+6], S13,0xA8304613); |
|||
b=FF(b,c,d,a,x[k+7], S14,0xFD469501); |
|||
a=FF(a,b,c,d,x[k+8], S11,0x698098D8); |
|||
d=FF(d,a,b,c,x[k+9], S12,0x8B44F7AF); |
|||
c=FF(c,d,a,b,x[k+10],S13,0xFFFF5BB1); |
|||
b=FF(b,c,d,a,x[k+11],S14,0x895CD7BE); |
|||
a=FF(a,b,c,d,x[k+12],S11,0x6B901122); |
|||
d=FF(d,a,b,c,x[k+13],S12,0xFD987193); |
|||
c=FF(c,d,a,b,x[k+14],S13,0xA679438E); |
|||
b=FF(b,c,d,a,x[k+15],S14,0x49B40821); |
|||
a=GG(a,b,c,d,x[k+1], S21,0xF61E2562); |
|||
d=GG(d,a,b,c,x[k+6], S22,0xC040B340); |
|||
c=GG(c,d,a,b,x[k+11],S23,0x265E5A51); |
|||
b=GG(b,c,d,a,x[k+0], S24,0xE9B6C7AA); |
|||
a=GG(a,b,c,d,x[k+5], S21,0xD62F105D); |
|||
d=GG(d,a,b,c,x[k+10],S22,0x2441453); |
|||
c=GG(c,d,a,b,x[k+15],S23,0xD8A1E681); |
|||
b=GG(b,c,d,a,x[k+4], S24,0xE7D3FBC8); |
|||
a=GG(a,b,c,d,x[k+9], S21,0x21E1CDE6); |
|||
d=GG(d,a,b,c,x[k+14],S22,0xC33707D6); |
|||
c=GG(c,d,a,b,x[k+3], S23,0xF4D50D87); |
|||
b=GG(b,c,d,a,x[k+8], S24,0x455A14ED); |
|||
a=GG(a,b,c,d,x[k+13],S21,0xA9E3E905); |
|||
d=GG(d,a,b,c,x[k+2], S22,0xFCEFA3F8); |
|||
c=GG(c,d,a,b,x[k+7], S23,0x676F02D9); |
|||
b=GG(b,c,d,a,x[k+12],S24,0x8D2A4C8A); |
|||
a=HH(a,b,c,d,x[k+5], S31,0xFFFA3942); |
|||
d=HH(d,a,b,c,x[k+8], S32,0x8771F681); |
|||
c=HH(c,d,a,b,x[k+11],S33,0x6D9D6122); |
|||
b=HH(b,c,d,a,x[k+14],S34,0xFDE5380C); |
|||
a=HH(a,b,c,d,x[k+1], S31,0xA4BEEA44); |
|||
d=HH(d,a,b,c,x[k+4], S32,0x4BDECFA9); |
|||
c=HH(c,d,a,b,x[k+7], S33,0xF6BB4B60); |
|||
b=HH(b,c,d,a,x[k+10],S34,0xBEBFBC70); |
|||
a=HH(a,b,c,d,x[k+13],S31,0x289B7EC6); |
|||
d=HH(d,a,b,c,x[k+0], S32,0xEAA127FA); |
|||
c=HH(c,d,a,b,x[k+3], S33,0xD4EF3085); |
|||
b=HH(b,c,d,a,x[k+6], S34,0x4881D05); |
|||
a=HH(a,b,c,d,x[k+9], S31,0xD9D4D039); |
|||
d=HH(d,a,b,c,x[k+12],S32,0xE6DB99E5); |
|||
c=HH(c,d,a,b,x[k+15],S33,0x1FA27CF8); |
|||
b=HH(b,c,d,a,x[k+2], S34,0xC4AC5665); |
|||
a=II(a,b,c,d,x[k+0], S41,0xF4292244); |
|||
d=II(d,a,b,c,x[k+7], S42,0x432AFF97); |
|||
c=II(c,d,a,b,x[k+14],S43,0xAB9423A7); |
|||
b=II(b,c,d,a,x[k+5], S44,0xFC93A039); |
|||
a=II(a,b,c,d,x[k+12],S41,0x655B59C3); |
|||
d=II(d,a,b,c,x[k+3], S42,0x8F0CCC92); |
|||
c=II(c,d,a,b,x[k+10],S43,0xFFEFF47D); |
|||
b=II(b,c,d,a,x[k+1], S44,0x85845DD1); |
|||
a=II(a,b,c,d,x[k+8], S41,0x6FA87E4F); |
|||
d=II(d,a,b,c,x[k+15],S42,0xFE2CE6E0); |
|||
c=II(c,d,a,b,x[k+6], S43,0xA3014314); |
|||
b=II(b,c,d,a,x[k+13],S44,0x4E0811A1); |
|||
a=II(a,b,c,d,x[k+4], S41,0xF7537E82); |
|||
d=II(d,a,b,c,x[k+11],S42,0xBD3AF235); |
|||
c=II(c,d,a,b,x[k+2], S43,0x2AD7D2BB); |
|||
b=II(b,c,d,a,x[k+9], S44,0xEB86D391); |
|||
a=AddUnsigned(a,AA); |
|||
b=AddUnsigned(b,BB); |
|||
c=AddUnsigned(c,CC); |
|||
d=AddUnsigned(d,DD); |
|||
} |
|||
var temp = WordToHex(a)+WordToHex(b)+WordToHex(c)+WordToHex(d); |
|||
return temp.toLowerCase(); |
|||
} |
} |
||
// 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 = { |
|||
function Quick_Editor() { |
|||
'imageFile': 'https://static.miraheze.org/nonciclopediawiki/f/f7/Button_align_center.png', |
|||
var sect = document.getElementsByName("wpSection"); |
|||
'speedTip': 'Centrato', |
|||
if (!/&?undo=\d+/.test(location.search) && ((sect.length && !sect[0].value) || !sect.length)) quicksave_load(); |
|||
'tagOpen': '{{Allinea|center|', |
|||
if (!(/\.(j|cs)s$/.test(wgTitle) && wgNamespaceNumber % 2 == 0)) quickpreview_load(); |
|||
'tagClose': '}' + '}', |
|||
var t = document.getElementById("wpTextbox1"); |
|||
'sampleText': 'Inserisci qui il testo' |
|||
if (!t) return; |
|||
}; |
|||
if (t.addEventListener) { |
|||
t.addEventListener('mouseup', quickedit_switch, false); |
|||
t.addEventListener('keyup', quickedit_switch, false); |
|||
} |
|||
else if (t.attachEvent) { |
|||
t.attachEvent('onmouseup', quickedit_switch); |
|||
t.attachEvent('onmouseup', quickedit_switch); |
|||
} |
|||
return; |
|||
} |
|||
var |
var pulsanteAllineaDX = { |
||
"imageFile": "https://upload.wikimedia.org/wikipedia/commons/a/a5/Button_align_right.png", |
|||
function quicksave_load() { |
|||
"speedTip": "Align right", |
|||
var buttons = getElementsByClass(document, "editButtons", 'div')[0]; |
|||
"tagOpen": '{{Allinea|right|', |
|||
var b = document.createElement('input'); |
|||
"tagClose": "}}", |
|||
b.type = 'button'; |
|||
"sampleText": "Testo allineato a destra" |
|||
b.value = "Salva"; |
|||
}; |
|||
b.id = "quicksaveButton"; |
|||
if (b.addEventListener) b.addEventListener('click', quicksave, false); |
|||
else if (b.attachEvent) b.attachEvent('onclick', quicksave); |
|||
b.accessKey = '1'; |
|||
b.title = "Salva e resta nell'editor [alt-shift-1]"; |
|||
buttons.insertBefore(b, document.getElementById("wpPreview")); |
|||
quicksave_checktext = document.getElementById("wpTextbox1").value; |
|||
return; |
|||
} |
|||
var pulsanteAllineaSX = { |
|||
function quicksave () { |
|||
"imageFile": "https://upload.wikimedia.org/wikipedia/commons/e/ea/Button_align_left.png", |
|||
var textbox = document.getElementById("wpTextbox1"); |
|||
"speedTip": "Align left", |
|||
textbox.disabled = true; |
|||
"tagOpen": '{{Allinea|left|', |
|||
document.getElementById("wpSave").disabled = true; |
|||
"tagClose": "}}", |
|||
document.getElementById("quicksaveButton").disabled = true; |
|||
"sampleText": "Testo allineato a sinistra" |
|||
var temp = null; |
|||
}; |
|||
temp = document.getElementById("quickpreviewButton"); |
|||
if (temp) temp.disabled = true; |
|||
var Source = encodeURIComponent(textbox.value); |
|||
var msg_box = document.getElementById("quicksave_msgbox"); |
|||
if (msg_box == null) { |
|||
msg_box = document.createElement('div'); |
|||
msg_box.id = "quicksave_msgbox"; |
|||
document.getElementById('content').insertBefore(msg_box, document.getElementById('firstHeading')); |
|||
} |
|||
else msg_box.innerHTML = ''; |
|||
var httpRequest = createRequest(); |
|||
var id = setTimeout(function() { httpRequest.abort(); msg_box.innerHTML = "Salvataggio fallito: il server non risponde.".fontcolor('Red'); Finish(false); }, 30000); |
|||
httpRequest.onreadystatechange = function () { Response(httpRequest, id); return;}; |
|||
var url = wgServer + wgScriptPath + "/api.php"; |
|||
var param = "action=edit&format=xml&title=" + encodeURIComponent(wgPageName); |
|||
param += "&token=" + document.getElementsByName("wpEditToken")[0].value.replace(/\+\\/, '%2' + "B%5" + 'C'); |
|||
temp = document.getElementById("wpSummary"); |
|||
if (temp) param += "&summary=" + encodeURIComponent(temp.value); |
|||
temp = document.getElementById("wpCaptchaId"); |
|||
if (temp) { |
|||
param += "&captchaid=" + temp.value + "&captchaword=" + encodeURIComponent(document.getElementById("wpCaptchaWord").value); |
|||
document.getElementById('editform').removeChild(document.getElementById("captcha_box")); |
|||
} |
|||
temp = document.getElementById("wpMinoredit"); |
|||
if (temp && temp.checked) param += "&minor="; |
|||
temp = document.getElementById("wpWatchthis"); |
|||
if (temp) { |
|||
var Watched = temp.checked; |
|||
if (document.getElementById('ca-watch') && Watched) param += "&watch="; |
|||
if (document.getElementById('ca-unwatch') && !Watched) param += "&unwatch="; |
|||
} |
|||
param += "&basetimestamp=" + document.getElementsByName("wpEdittime")[0].value; |
|||
param += "&starttimestamp=" + document.getElementsByName("wpStarttime")[0].value; |
|||
param += "&text=" + Source; |
|||
param += "&md5=" + MD5(textbox.value); |
|||
httpRequest.open('POST', url, true); |
|||
httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); |
|||
httpRequest.setRequestHeader('Content-Length', param.length); |
|||
document.getElementsByTagName('body')[0].style.cursor = 'progress'; |
|||
httpRequest.send(param); |
|||
return; |
|||
function Response (o, id) { |
|||
if (o.readyState != 4) return; |
|||
clearTimeout(id); |
|||
msg_box.scrollIntoView(); |
|||
if (o.status != 200) { |
|||
if (o.status && (o.status < 199 || o.status > 300)) { |
|||
msg_box.innerHTML = "Salvataggio fallito. Risposta del server: ".fontcolor('Red') + o.status.fontcolor('Red'); |
|||
Finish(false); |
|||
} |
|||
return; |
|||
} |
|||
if (o.responseXML == null) { |
|||
msg_box.innerHTML = "Errore nella risposta del server. Controlla nella cronologia se il salvataggio è avvenuto".fontcolor('Red'); |
|||
Finish(false); |
|||
return; |
|||
} |
|||
if (o.responseXML.normalize) o.responseXML.normalize(); |
|||
var result = o.responseXML.getElementsByTagName('edit'); |
|||
if (result && result[0] != undefined) { |
|||
if (result[0].getAttribute('result') == "Success") { |
|||
msg_box.innerHTML = "Salvataggio completato."; |
|||
wgCurRevisionId = result[0].getAttribute('newrevid'); |
|||
var request_ts = createRequest(); |
|||
var ts_id = setTimeout(function() { request_ts.abort(); appendText(msg_box, " Impossibile procedere ad ulteriori salvataggi."); return; }, 30000); |
|||
request_ts.onreadystatechange = function () { Get_Timestamp(request_ts, ts_id); return; } |
|||
var param = "action=query&format=xml&" + "prop=revisions&meta=userinfo&uiprop=hasmsg&rvprop=timestamp%" + "7Cuser&rvlimit=1&rvdir=older&titles=" + encodeURIComponent(wgPageName); |
|||
request_ts.open('POST', url, true); |
|||
request_ts.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); |
|||
request_ts.setRequestHeader('Content-Length', param.length); |
|||
request_ts.send(param); |
|||
Finish(true); |
|||
return; |
|||
} |
|||
if (result[0].getAttribute('result') == "Failure") { |
|||
var captcha = result[0].getElementsByTagName('captcha')[0]; |
|||
if (captcha == null) { |
|||
msg_box.innerHTML = "Salvataggio fallito: errore ignoto".fontcolor('Red'); |
|||
Finish(false); |
|||
return; |
|||
} |
|||
var captcha_id = document.createElement('input'); |
|||
captcha_id.type = 'hidden'; |
|||
captcha_id.id = "wpCaptchaId"; |
|||
captcha_id.value = captcha.getAttribute('id'); |
|||
var captcha_word = document.createElement('input'); |
|||
captcha_word.id = "wpCaptchaWord"; |
|||
captcha_word.style.marginBottom = "10px"; |
|||
var captcha_img = document.createElement('img'); |
|||
captcha_img.src = wgServer + wgScriptPath + "/index.php?title=Special:Captcha/image&wpCaptchaId=" + captcha_id.value; |
|||
var captcha_msg = document.createElement('p'); |
|||
captcha_msg.innerHTML = '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 (<' + 'a href="/wiki/Speciale:Captcha/help" title="Speciale:Captcha/help">come funziona?</' + 'a>)'; |
|||
var captcha_box = document.createElement('div'); |
|||
captcha_box.id = "captcha_box"; |
|||
document.getElementById('editform').insertBefore(captcha_box, document.getElementById('toolbar')); |
|||
captcha_box.appendChild(captcha_msg); |
|||
captcha_box.appendChild(captcha_img); |
|||
captcha_box.appendChild(captcha_word); |
|||
captcha_box.appendChild(captcha_id); |
|||
Finish(false); |
|||
return; |
|||
} |
|||
} |
|||
var error = o.responseXML.getElementsByTagName('error'); |
|||
if (error == null) { |
|||
msg_box.innerHTML = "Errore nella risposta del server. Controlla nella cronologia se il salvataggio è avvenuto".fontcolor('Red'); |
|||
Finish(false); |
|||
return; |
|||
} |
|||
switch (error[0].getAttribute('code')) { |
|||
case 'editconflict': |
|||
document.getElementById("wpSave").disabled = false; |
|||
setTimeout(function () {document.getElementById('wpSave').click(); return;}, 1000); |
|||
return; |
|||
var pulsanteApice = { |
|||
case 'noedit': |
|||
'imageFile': 'http://upload.wikimedia.org/wikipedia/en/8/80/Button_upper_letter.png', |
|||
case 'noedit-anon': |
|||
'speedTip': 'Apice', |
|||
msg_box.innerHTML = "Non sei autorizzato a modificare questa pagina.".fontcolor('Red'); |
|||
'tagOpen': '<sup>', |
|||
Finish(false); |
|||
'tagClose': '</sup>', |
|||
return; |
|||
'sampleText': 'Inserire qui il testo' |
|||
}; |
|||
default: |
|||
msg_box.innerHTML = "Salvataggio fallito: ".fontcolor('Red') + error[0].getAttribute('info').fontcolor('Red'); |
|||
Finish(false); |
|||
return; |
|||
} |
|||
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 = { |
|||
function Get_Timestamp (o, id) { |
|||
'imageFile': 'https://upload.wikimedia.org/wikipedia/en/c/c9/Button_strike.png', |
|||
if (o.readyState != 4) return; |
|||
'speedTip': 'Barrato', |
|||
clearTimeout(id); |
|||
'tagOpen': '{{s|', |
|||
if (o.status != 200) { |
|||
'tagClose': '}' + '}', |
|||
if (o.status && (o.status < 199 || o.status > 300)) { |
|||
'sampleText': 'Inserire qui il testo' |
|||
appendText(msg_box, " Impossibile procedere ad ulteriori salvataggi."); |
|||
}; |
|||
} |
|||
return; |
|||
} |
|||
if (o.responseXML == null) { |
|||
appendText(msg_box, " Impossibile procedere ad ulteriori salvataggi."); |
|||
return; |
|||
} |
|||
if (o.responseXML.normalize) o.responseXML.normalize(); |
|||
var rev = o.responseXML.getElementsByTagName('rev'); |
|||
if (!rev || rev[0] == undefined) { |
|||
appendText(msg_box, " Impossibile procedere ad ulteriori salvataggi."); |
|||
return; |
|||
} |
|||
var t = rev[0].getAttribute('timestamp'); |
|||
document.getElementsByName("wpEdittime")[0].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); |
|||
appendText(msg_box, " Ultima modifica: " + rev[0].getAttribute('user') + ' ' + d.toLocaleString()); |
|||
d = new Date(); |
|||
document.getElementsByName("wpStarttime")[0].value = d.getUTCFullYear().toString() + addzero(d.getUTCMonth()) + addzero(d.getUTCDate()) + addzero(d.getUTCHours()) + addzero(d.getUTCMinutes())+ addzero(d.getUTCSeconds() + 1); |
|||
document.getElementById("wpSave").disabled = false; |
|||
var pulsanteBig = { |
|||
temp = o.responseXML.getElementsByTagName('userinfo'); |
|||
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/5/56/Button_big.png', |
|||
if (!temp || temp[0] == undefined) return; |
|||
'speedTip': 'Grande', |
|||
var orange = getElementsByClass(document.getElementById('bodyContent'), 'usermessage', 'div'); |
|||
'tagOpen': '{{Dimensione|125%|', |
|||
if (orange) orange = orange[0]; |
|||
'tagClose': '}' + '}', |
|||
if (!temp[0].hasAttribute('messages')) { |
|||
'sampleText': 'Inserisci qui il testo' |
|||
if (orange) orange.style.display = 'none'; |
|||
}; |
|||
return; |
|||
} |
|||
var name = (wgUserName)? wgUserName : temp[0].getAttribute('name'); |
|||
if (!orange) { |
|||
orange = document.createElement('div'); |
|||
orange.className = 'usermessage'; |
|||
document.getElementById('bodyContent').insertBefore(orange, document.getElementById('wikiPreview')); |
|||
} |
|||
else orange.style.display = 'block'; |
|||
orange.innerHTML = 'Hai <a title="Discussioni utente:' + name + '" href="/index.php?title=Discussioni_utente:' + encodeURI(name) + '&redirect=no">nuovi messaggi</a' + '> (<a title="Discussioni utente:' + name + '" href="/index.php?title=Discussioni_utente:' + encodeURI(name) + '&diff=cur">differenza con la revisione precedente</a' + '>).'; |
|||
return; |
|||
} |
|||
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 = { |
|||
function Finish(success) { |
|||
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/0/0c/Button_Chuck.png', |
|||
if (success) { |
|||
'speedTip': 'Cancellazione immediata (USARE CON CAUTELA!)', |
|||
document.getElementById("wpSummary").value = ''; |
|||
'tagOpen': '{{Cancellazione|motivo=', |
|||
quicksave_checktext = textbox.value; |
|||
'tagClose': '|firma=--~~' + '~~}' + '}\n\n', |
|||
if (!(/\.(j|cs)s$/.test(wgTitle) && wgNamespaceNumber % 2 == 0)) { |
|||
'sampleText': 'Inserire qui il motivo' |
|||
textbox.selectionStart = 0; |
|||
}; |
|||
textbox.selectionEnd = 0; |
|||
quickpreview(true); |
|||
} |
|||
else { |
|||
document.getElementsByTagName('body')[0].style.cursor = 'auto'; |
|||
} |
|||
if (wgUserName) { |
|||
if (Watched) { |
|||
temp = document.getElementById('ca-watch'); |
|||
if (temp) { |
|||
temp.id = 'ca-unwatch'; |
|||
temp = temp.firstChild; |
|||
temp.href = temp.href.replace(/=watch$/, "=unwatch"); |
|||
setText(temp, "non seguire"); |
|||
temp.title = temp.title.replace(/^Aggiungi/, "Rimuovi"); |
|||
appendText(msg_box, " Pagina aggiunta agli osservati speciali.") |
|||
} |
|||
} |
|||
else { |
|||
temp = document.getElementById('ca-unwatch'); |
|||
if (temp) { |
|||
temp.id = 'ca-watch'; |
|||
temp = temp.firstChild; |
|||
temp.href = temp.href.replace(/=unwatch$/, "=watch"); |
|||
setText(temp, "segui"); |
|||
temp.title = temp.title.replace(/^Rimuovi/, "Aggiungi"); |
|||
appendText(msg_box, " Pagina rimossa dagli osservati speciali.") |
|||
} |
|||
} |
|||
} |
|||
} |
|||
else { |
|||
document.getElementById("wpSave").disabled = false; |
|||
document.getElementById("quicksaveButton").disabled = false; |
|||
temp = document.getElementById("quickpreviewButton"); |
|||
if (temp) temp.disabled = false; |
|||
document.getElementById("wikiPreview").innerHTML = ''; |
|||
document.getElementsByTagName('body')[0].style.cursor = 'auto'; |
|||
} |
|||
textbox.disabled = false; |
|||
return; |
|||
} |
|||
} // <-quicksave() |
|||
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 |
var pulsanteCassetto = { |
||
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/3/38/Button_cassetto.png', |
|||
var QP_hiddencatlist; |
|||
'speedTip': 'Cassetto', |
|||
var QP_cat_ns = "Categoria:"; |
|||
'tagOpen': '{{Cassetto|titolo=Titolo cassetto|testo=', |
|||
var QP_hiddencats_cat = "Categorie nascoste"; |
|||
'tagClose': '}}', |
|||
function quickpreview_load() { |
|||
'sampleText': 'Inserire qui il testo' |
|||
if (/\.(j|cs)s$/.test(wgTitle)) return; |
|||
}; |
|||
var buttons = getElementsByClass(document, "editButtons", 'div')[0]; |
|||
if (buttons == null) return; |
|||
var b = document.createElement('input'); |
|||
b.type = 'button'; |
|||
b.value = "Visualizza anteprima"; |
|||
b.id = "quickpreviewButton"; |
|||
if (b.addEventListener) b.addEventListener('click', quickpreview1, false); |
|||
else if (b.attachEvent) b.attachEvent('onclick', quickpreview1); |
|||
b.accessKey = '2'; |
|||
b.title = "Anteprima delle modifiche (consigliata prima di salvare) [alt-shift-2]"; |
|||
var wpButton = document.getElementById('wpPreview'); |
|||
wpButton.style.margin = '0px'; |
|||
wpButton.style.padding = '0px'; |
|||
wpButton.style.fontSize = '0'; |
|||
wpButton.style.width = '0px'; |
|||
wpButton.style.borderWidth = '0pt'; |
|||
buttons.insertBefore(b, wpButton); |
|||
var hotkey = document.getElementById("quickpreview-hotkeysuggest"); |
|||
hotkey.style.left = (b.offsetLeft - 15) + 'px'; |
|||
hotkey.style.visibility = 'visible'; |
|||
var pulsanteCatImg = { |
|||
QP_hiddencatlist = getCookie("QPhc"); |
|||
'imageFile': '', |
|||
if (QP_hiddencatlist == null) { |
|||
'speedTip': 'Categoria immagini', |
|||
var request_hc = createRequest(); |
|||
'tagOpen': '[[Categoria:Immagini ', |
|||
request_hc.onreadystatechange = function () { set_hc_cookie(request_hc); return;}; |
|||
'tagClose': ']]', |
|||
request_hc.open('GET', wgServer + wgScriptPath + "/api.php?action=query&list=categorymembers&cmtitle=Category:" + encodeURI(QP_hiddencats_cat) + "&cmlimit=500&format=xml", true); |
|||
'sampleText': '' |
|||
request_hc.send(null); |
|||
}; |
|||
return; |
|||
var pulsanteCC = { |
|||
function set_hc_cookie (o) { |
|||
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/0/04/Button_Creative_Commons.png', |
|||
if (o.readyState != 4) return false; |
|||
'speedTip': 'Creative Commons', |
|||
if (o.status != 200) return false; |
|||
'tagOpen': '{{Creative Commons|by=y|nc=y|sa=y|versione=3.0}' + '}\n', |
|||
if (o.responseXML == null) return false; |
|||
'tagClose': '', |
|||
if(o.responseXML.normalize) o.responseXML.normalize(); |
|||
'sampleText': '' |
|||
var cm = o.responseXML.getElementsByTagName('categorymembers')[0].getElementsByTagName('cm'); |
|||
}; |
|||
var tmp = new Array(); |
|||
var i = 0; |
|||
for (i; i < cm.length; i++) tmp.push(cm[i].getAttribute('title')); |
|||
QP_hiddencatlist = tmp.join('|'); |
|||
document.cookie = "QPhc=" + escape(QP_hiddencatlist); |
|||
return true; |
|||
} |
|||
} |
|||
var pulsanteCensura = { |
|||
function quickpreview1() { quickpreview(false); return; } |
|||
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/2/20/Button_censura2.png', |
|||
'speedTip': 'Censura', |
|||
'tagOpen': '{{Censura|', |
|||
'tagClose': '}}', |
|||
'sampleText': 'testo da censurare' |
|||
}; |
|||
var pulsanteCit2 = { |
|||
function quickpreview (after_save) { |
|||
'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 = { |
|||
/* Pulizia dell'area di anteprima */ |
|||
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/f/f6/Button_Citnec.png', |
|||
var previewArea = document.getElementById("wikiPreview"); |
|||
'speedTip': 'Citazione necessaria', |
|||
if (previewArea == null) return false; |
|||
'tagOpen': '{{Citnec|', |
|||
previewArea.innerHTML = ''; |
|||
'tagClose': '}}', |
|||
var temp; |
|||
'sampleText': 'Inserire qui la citazione' |
|||
if (quickpreview_firstLoad) { |
|||
}; |
|||
previewArea.style.display = 'block'; |
|||
temp = document.getElementById("editintro"); |
|||
if (temp) temp.style.display = 'none'; |
|||
temp = getElementsByClass(document, "mw-newarticletext")[0]; |
|||
if (temp) temp.style.display = 'none'; |
|||
temp = getElementsByClass(document, "mw-newarticletextanon")[0]; |
|||
if (temp) temp.style.display = 'none'; |
|||
temp = document.getElementById(document, "mw-anon-edit-warning"); |
|||
if (temp) temp.style.display = 'none'; |
|||
temp = getElementsByClass(document, "mw-warning-with-logexcerpt")[0]; |
|||
if (temp) temp.style.display = 'none'; |
|||
temp = document.getElementById("contentSub2"); |
|||
if (temp) temp.style.display = 'none'; |
|||
temp = document.getElementById("wpTalkPageText"); |
|||
if (temp) temp.style.display = 'none'; |
|||
temp = document.getElementById("explainconflict"); |
|||
if (temp) temp.style.display = 'none'; |
|||
quickpreview_firstLoad = false; |
|||
} |
|||
else { |
|||
/* Rimuove eventuali css importati precedentemente; */ |
|||
temp = document.getElementById("add-css-link"); |
|||
if (temp) document.getElementsByTagName('head')[0].removeChild(temp); |
|||
} |
|||
var pulsanteColonne = { |
|||
/* Imposta il titolo */ |
|||
'imageFile': 'https://images.wikia.nocookie.net/__cb20100806112827/nonciclopedia/images/1/15/Button_colonne.png', |
|||
document.getElementById("firstHeading").innerHTML = wgPageName.replace(/_/g, ' '); |
|||
'speedTip': 'Testo in colonne', |
|||
'tagOpen': '{{Colonne|col=2|', |
|||
'tagClose': '}}\n', |
|||
'sampleText': 'Inserire qui il testo per le colonne' |
|||
}; |
|||
var pulsanteColore = { |
|||
document.getElementById("quickpreviewButton").disabled = true; |
|||
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/0/0f/Bottone_colore.png', |
|||
document.getElementsByTagName('body')[0].style.cursor = 'progress'; |
|||
'speedTip': 'Colore', |
|||
'tagOpen': '{{Colore|#Codice esadecimale|', |
|||
'tagClose': '}}', |
|||
'sampleText': 'testo da colorare' |
|||
}; |
|||
var pulsanteDimensione = { |
|||
var httpRequest = createRequest(); |
|||
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/2/2f/Bottone_dimensione.png', |
|||
var id = setTimeout(function() { httpRequest.abort(); alert("Errore: il server non risponde"); Finish(false); }, 30000); |
|||
'speedTip': 'Dimensione', |
|||
httpRequest.onreadystatechange = function () { Write(httpRequest, id); return;}; |
|||
'tagOpen': '{{Dimensione|dim%|', |
|||
var url = wgServer + wgScriptPath + "/api.php"; |
|||
'tagClose': '}}', |
|||
var param = "action=parse&format=xml&" + "prop=text%7" + "Ccategories"; |
|||
'sampleText': 'testo' |
|||
if (after_save) { |
|||
}; |
|||
param += "&page=" + encodeURIComponent(wgPageName); |
|||
} |
|||
else { |
|||
var textbox = document.getElementById("wpTextbox1"); |
|||
var Source; |
|||
var start = textbox.selectionStart, end = textbox.selectionEnd; |
|||
if (start < end) Source = textbox.value.slice(start, end); |
|||
else { |
|||
Source = textbox.value + '\n'; |
|||
if (document.getElementsByName("wpSection")[0].value == 'new') Source = "== " + document.getElementById('wpSummary').value + " ==\n" + Source; |
|||
} |
|||
Source = encodeURIComponent(Source); |
|||
param += "&pst=&title=" + encodeURIComponent(wgPageName) + "&text=" + Source; |
|||
} |
|||
httpRequest.open('POST', url, true); |
|||
httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); |
|||
httpRequest.setRequestHeader('Content-Length', param.length); |
|||
httpRequest.send(param); |
|||
return; /* fine quickpreview */ |
|||
var pulsanteFormattazione1 = { |
|||
function Write(o, id) { |
|||
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/d/d6/E%27fiamme.png', |
|||
if (o.readyState != 4) return; |
|||
'speedTip': 'Formattazione', |
|||
clearTimeout(id); |
|||
'tagOpen': '{{Formattazione|note=', |
|||
if (o.status != 200) { |
|||
'tagClose': '|firma=--~~' + '~~}' + '}\n\n', |
|||
if (o.status && (o.status < 199 || o.status > 300)) { |
|||
'sampleText': 'Inserire qui cosa fare' |
|||
alert("Anteprima non riuscita. Risposta del server: " + o.status); |
|||
}; |
|||
Finish(false); |
|||
} |
|||
return; |
|||
} |
|||
if (o.responseXML == null) { |
|||
alert("Anteprima non riuscita (errore del parser?)"); |
|||
Finish(false); |
|||
return; |
|||
} |
|||
if(o.responseXML.normalize) o.responseXML.normalize(); |
|||
var R = o.responseXML.getElementsByTagName('text')[0].firstChild; |
|||
var code = R.data; |
|||
previewArea.innerHTML += code; |
|||
var pulsanteFormattazione2 = { |
|||
/* aggiungi categorie */ |
|||
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/e/e1/E%27mat.png', |
|||
var show_cat = false; |
|||
'speedTip': 'Formattazione', |
|||
var catlinksBox = document.getElementById("catlinks"); |
|||
'tagOpen': '{{Formattazione|note=', |
|||
R = o.responseXML.getElementsByTagName('categories')[0].getElementsByTagName('cl'); |
|||
'tagClose': '|firma=--~~' + '~~}' + '}\n\n', |
|||
if (R.length > 0) { |
|||
'sampleText': 'Inserire qui cosa fare' |
|||
if (catlinksBox != null) catlinksBox.innerHTML = ''; |
|||
}; |
|||
else { |
|||
catlinksBox = document.createElement('div'); |
|||
catlinksBox.id = "catlinks"; |
|||
catlinksBox.className = "catlinks"; |
|||
document.getElementById("bodyContent").insertBefore(catlinksBox, getElementsByClass(document.getElementById("bodyContent"), "visualClear", 'div')[0]); |
|||
} |
|||
var catname; |
|||
var normalcatlinks = new Array(); |
|||
var hiddencatlinks = new Array(); |
|||
for (i=0; i<R.length; i++) { |
|||
catname = R.item(i).firstChild.nodeValue; |
|||
if (RegExp(catname.replace(/_/g, ' ')).test(QP_hiddencatlist)) hiddencatlinks.push('<span dir="ltr"><a href="/wiki/' + QP_cat_ns + encodeURI(catname) + '" title="' + QP_cat_ns + catname.replace(/_/g, ' ') + '">' + catname.replace(/_/g, ' ') + '</a></span>'); |
|||
else normalcatlinks.push('[[:' + QP_cat_ns + catname + '|' + catname.replace(/_/g, ' ') + ']]'); |
|||
} |
|||
var tmp = ''; |
|||
if (hiddencatlinks.length > 0) { |
|||
var hiddencatlinksBox = document.createElement('div'); |
|||
hiddencatlinksBox.id = "mw-hidden-catlinks"; |
|||
hiddencatlinksBox.className = "mw-hidden-cats-hidden"; |
|||
if (normalcatlinks.length == 0) catlinksBox.className += " catlinks-allhidden"; |
|||
catlinksBox.appendChild(hiddencatlinksBox); |
|||
tmp = "Categori" + ((hiddencatlinks.length > 1)? "e nascoste: " + hiddencatlinks.join(" | ") : "a nascosta: " + hiddencatlinks[0]); |
|||
hiddencatlinksBox.innerHTML = tmp; |
|||
} |
|||
if (normalcatlinks.length > 0) { |
|||
show_cat = true; |
|||
var normalcatscode = '<div id="mw-normal-catlinks">[[Speciale:Categorie|Categori' + ((normalcatlinks.length > 1)? 'e]]: ' + normalcatlinks.join(' | ') : 'a]]: ' + normalcatlinks[0]) + '</div>'; |
|||
var request_cat = createRequest(); |
|||
var cat_id = setTimeout(function() { request_cat.abort(); alert("Errore del server. Impossibile visualizzare le categorie"); Finish(true); }, 30000); |
|||
normalcatscode = normalcatscode.replace(/&/g, "%2" + "6"); |
|||
normalcatscode = normalcatscode.replace(/\+/g, "%2" + "B"); |
|||
normalcatscode = "action=parse&format=xml&" + "prop=text&text=" + normalcatscode; |
|||
request_cat.onreadystatechange = function () { Show_Cat(request_cat, cat_id, catlinksBox); return;}; |
|||
request_cat.open('POST', wgServer + wgScriptPath + "/api.php", true); |
|||
request_cat.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); |
|||
request_cat.setRequestHeader('Content-Length', normalcatscode.length); |
|||
request_cat.send(normalcatscode); |
|||
} |
|||
} |
|||
else { |
|||
if (catlinksBox != null) document.getElementById("bodyContent").removeChild(catlinksBox); |
|||
} |
|||
if (!show_cat) Finish(true) // caricamento terminato |
|||
return; |
|||
} /* <- Write */ |
|||
var pulsanteGallery = { |
|||
function Show_Cat (o, id, box) { |
|||
'imageFile': 'https://images.wikia.nocookie.net/central/images/1/12/Button_gallery.png', |
|||
if (o.readyState != 4) return; |
|||
'speedTip': 'Galleria di immagini', |
|||
clearTimeout(id); |
|||
'tagOpen': '\n<gallery>\n', |
|||
if (o.status != 200) { |
|||
'tagClose': '\n</gallery>\n', |
|||
if (o.status && (o.status < 199 || o.status > 300)) { |
|||
'sampleText': 'File:Example.jpg|Caption1\nFile:Example.jpg|Caption2' |
|||
alert("Impossibile visualizzare le categorie: errore del server " + o.status); |
|||
}; |
|||
} |
|||
Finish(true); |
|||
return; |
|||
} |
|||
if (o.responseXML == null) { |
|||
alert("Impossibile visualizzare le categorie: errore del parser?"); |
|||
} |
|||
if (o.responseXML.normalize) o.responseXML.normalize(); |
|||
box.innerHTML = o.responseXML.getElementsByTagName('text')[0].firstChild.data + box.innerHTML; |
|||
Finish(true); |
|||
return; |
|||
} |
|||
var pulsanteManuali = { |
|||
function Finish(success) { |
|||
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/f/fe/Bottone_Man.png', |
|||
document.getElementById("quickpreviewButton").disabled = false; |
|||
'speedTip': 'Link ai manuali', |
|||
if (success) { |
|||
'tagOpen': '{{Man|', |
|||
document.getElementById('p-logo').scrollIntoView(); |
|||
'tagClose': '}}', |
|||
// mostra il toggle dell'indice |
|||
'sampleText': 'Manuale (iniziale)' |
|||
if (window.showTocToggle) { window.tocShowText = "mostra"; window.tocHideText = "nascondi"; showTocToggle();} |
|||
}; |
|||
var pulsanteNomedimmerda = { |
|||
// carica onloadhooks |
|||
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/3/33/Sguardone.png', |
|||
hooks_common_render(); |
|||
'speedTip': 'Immagine da rinominare ', |
|||
hooks_monobook_render(); |
|||
'tagOpen': '{{Nomedimmerda|scadenza={{subst:7g}' + '}|motivo=', |
|||
var i = 0; |
|||
'tagClose': '|firma=--~~' + '~~}' + '}\n\n', |
|||
for (i; i < hooks_custom.length; i++) hooks_custom[i](); |
|||
'sampleText': 'Inserisci un suggerimento' |
|||
}; |
|||
var pulsantePedice = { |
|||
} |
|||
'imageFile': 'http://upload.wikimedia.org/wikipedia/en/7/70/Button_lower_letter.png', |
|||
document.getElementsByTagName('body')[0].style.cursor = 'auto'; |
|||
'speedTip': 'Pedice', |
|||
return; |
|||
'tagOpen': '<sub>', |
|||
} |
|||
'tagClose': '</sub>', |
|||
'sampleText': 'Inserire qui il testo' |
|||
}; |
|||
var pulsanteRedirect = { |
|||
} // <- quickpreview(); |
|||
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/7/73/Bottone_redirect.png', |
|||
'speedTip': 'Redirect', |
|||
'tagOpen': '#REDIRECT [[', |
|||
'tagClose': ']]', |
|||
'sampleText': 'Nome pagina' |
|||
}; |
|||
var pulsanteReflink = { |
|||
function quickedit_switch() { |
|||
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/6/6e/Bottone_reflink.png', |
|||
var bs = document.getElementById("quicksaveButton"); |
|||
'speedTip': 'Inserisci la nota nel testo', |
|||
if (bs) { |
|||
'tagOpen': '<ref>', |
|||
if (this.value == quicksave_checktext) bs.disabled = true; |
|||
'tagClose': '</ref>', |
|||
else bs.disabled = false; |
|||
'sampleText': 'Inserisci qui il testo della nota' |
|||
} |
|||
}; |
|||
var bp = document.getElementById("quickpreviewButton"); |
|||
if (bp) { |
|||
if (this.selectionStart < this.selectionEnd) bp.value = "Anteprima selezione"; |
|||
else bp.value = "Visualizza anteprima"; |
|||
} |
|||
return; |
|||
} |
|||
var pulsanteRestauro = { |
|||
/* Aggiunge link di modifica per la sezione 0 */ |
|||
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/6/6c/Button_restauro.png', |
|||
var nosectionzeroedit = false; |
|||
'speedTip': 'Articolo da sistemare', |
|||
function sectionzero_editlink() { |
|||
'tagOpen': '{{Restauro|motivo=', |
|||
if (wgNamespaceNumber == -1) return; |
|||
'tagClose': '|firma=--~~' + '~~}' + '}\n\n', |
|||
if (nosectionzeroedit) return; |
|||
'sampleText': 'Inserire qui la descrizione' |
|||
if (getElementsByClass(document.getElementById('bodyContent'), 'editsection', 'span').length == 0) return; |
|||
}; |
|||
if (document.getElementById('no-sec0-edit')) return; |
|||
// var title = document.getElementById('firstHeading'); |
|||
var subtitle = document.getElementById('siteSub'); |
|||
var link = document.createElement('a'); |
|||
link.rel = 'nofollow'; |
|||
link.title = "Modifica la sezione introduttiva"; |
|||
link.href = wgServer + wgScriptPath + '/index.php?title=' + encodeURI(wgPageName) + '&action=edit§ion=0&editintro=MediaWiki:Editintro'; |
|||
link.innerHTML = "modifica"; |
|||
var span = document.createElement('span'); |
|||
span.className = "editsection"; |
|||
subtitle.insertBefore(span,subtitle.firstChild); |
|||
span.appendChild(link); |
|||
span.innerHTML = '[' + span.innerHTML + ']'; |
|||
return; |
|||
} |
|||
var pulsanteRiquadro1 = { |
|||
/* Perfeziona i link di condivisione nella sidebar */ |
|||
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/f/f9/Button_box.png', |
|||
function sharelinks() { |
|||
'speedTip': 'Box', |
|||
var box = document.getElementById("p-condividi"); |
|||
'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', |
|||
if (box == null) return false; |
|||
'tagClose': '', |
|||
var links = box.getElementsByTagName('a'); |
|||
'sampleText': '' |
|||
for (var i=0; i < links.length; i++) links[i].target = '_blank'; |
|||
}; |
|||
return; |
|||
} |
|||
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 = { |
|||
/* Mostra thumbnail delle immagini nella ricerca */ |
|||
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/a/a5/Button_Samara.png', |
|||
function search_thumb() { |
|||
'speedTip': 'Articolo in scadenza', |
|||
if (wgPageName != "Speciale:Ricerca") return false; |
|||
'tagOpen': '{{Scadenza|scadenza=' + '{{subst:7g}' + '}|note=', |
|||
var ul = getElementsByClass(document, 'mw-search-results', 'ul'); |
|||
'tagClose': '|firma=--~~' + '~~}' + '}\n\n', |
|||
if (ul == null || ul[0] == undefined) return false; |
|||
'sampleText': 'Note' |
|||
var li = ul[0].getElementsByTagName('li'); |
|||
}; |
|||
if (li.length == 0) return false; |
|||
var a, title, i; |
|||
for (i = 0; i < li.length; i++) { |
|||
a = li[i].getElementsByTagName('a')[0]; |
|||
if (/^File:/i.test(a.title) && !/\.ogg$/i.test(a.title)) addThumb(a, a.title); |
|||
} |
|||
return; |
|||
var pulsanteSmall = { |
|||
function addThumb (link, file) { |
|||
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/5/58/Button_small.png', |
|||
var httpRequest = createRequest(); |
|||
'speedTip': 'Piccolo', |
|||
var id = setTimeout(function() { httpRequest.abort();}, 30000); |
|||
'tagOpen': '{{Dimensione|80%|', |
|||
httpRequest.onreadystatechange = function () { Do(httpRequest, id, link, file); return; } |
|||
'tagClose': '}' + '}', |
|||
httpRequest.open('GET', wgServer + wgScriptPath + "/api.php?action=imagethumb&format=xml&tiwidth=50&tiimage=" + encodeURIComponent(file.replace(/^File:/i, '')), true); |
|||
'sampleText': 'Inserisci qui il testo' |
|||
httpRequest.send(''); |
|||
}; |
|||
return; |
|||
} |
|||
var pulsanteSottolineato = { |
|||
function Do(o, id, link, file) { |
|||
'imageFile': 'https://images.wikia.nocookie.net/nonciclopedia/images/f/fd/Button_underline.png', |
|||
if (o.readyState != 4) return; |
|||
'speedTip': 'Sottolineato', |
|||
clearTimeout(id); |
|||
'tagOpen': '{{u|', |
|||
if (o.status != 200) return; |
|||
'tagClose': '}' + '}', |
|||
if (o.responseXML == null) return; |
|||
'sampleText': 'Inserire qui il testo' |
|||
if (o.responseXML.normalize) o.responseXML.normalize(); |
|||
}; |
|||
if (o.responseXML.getElementsByTagName('thumb')[0] == undefined) return false; |
|||
var url = o.responseXML.getElementsByTagName('thumb')[0].getAttribute("url"); |
|||
if (url == null) return false; |
|||
var img = document.createElement('img'); |
|||
img.src = url; |
|||
img.alt = file; |
|||
img.width = o.responseXML.getElementsByTagName('thumb')[0].getAttribute("width"); |
|||
img.height = o.responseXML.getElementsByTagName('thumb')[0].getAttribute("height"); |
|||
img.style.marginRight = "3px"; |
|||
link.insertBefore(img, link.firstChild); |
|||
return; |
|||
} |
|||
} |
|||
var pulsanteTabella = { |
|||
/* Aggiunge l'editintro nei link di modifica anche per gli utenti registrati */ |
|||
'imageFile': 'https://upload.wikimedia.org/wikipedia/en/6/60/Button_insert_table.png', |
|||
function addeditintro() |
|||
'speedTip': 'Tabella', |
|||
{ |
|||
'tagOpen': '{| class="wikitable"\n|-\n', |
|||
if (wgUserName == null) return false; |
|||
'tagClose': '\n|}\n', |
|||
if (document.getElementById('ca-talk')) { |
|||
'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' |
|||
if (document.getElementById('ca-talk').getAttribute('class')=='new') |
|||
}; |
|||
{ |
|||
document.getElementById('ca-talk').getElementsByTagName('a')[0].href = document.getElementById('ca-talk').getElementsByTagName('a')[0].href.concat('&editintro=MediaWiki:Editintro'); |
|||
} |
|||
} |
|||
if (document.getElementById('ca-edit')) |
|||
{ |
|||
var link = document.getElementById('ca-edit').getElementsByTagName('a')[0]; |
|||
if(link==null) return false; /*non sono sicuro che serva, ma nel dubbio lo lascio*/ |
|||
} |
|||
else |
|||
{ |
|||
return false; |
|||
} |
|||
if (wgCurRevisionId) |
|||
{ |
|||
if(link==null) return false; |
|||
link.href = link.href.concat('&editintro=MediaWiki:Editintro'); |
|||
} |
|||
function sections () { |
|||
var spans = document.getElementsByTagName('span'); |
|||
var i = 0, l; |
|||
for (i in spans) { |
|||
if (/editsection/.test(spans[i].className)) { |
|||
l = spans[i].getElementsByTagName('a')[0]; |
|||
if (l == null) continue; |
|||
l.href = l.href.concat('&editintro=MediaWiki:Editintro'); |
|||
} |
|||
} |
|||
return; |
|||
} |
|||
sections(); |
|||
} |
|||
var pulsanteVideo = { |
|||
function communitya () { |
|||
'imageFile': 'https://images.wikia.nocookie.net/__cb20100915172123/nonciclopedia/images/f/ff/Bottone_video.png', |
|||
setText(document.getElementById('p-community').getElementsByTagName('h5')[0], "comunità"); |
|||
'speedTip': 'Inserisci un video - Per i parametri aggiuntivi leggi la pagina del template', |
|||
return; |
|||
'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", |
|||
/* Template:Caricamento */ |
|||
"speedTip": "Evidenziatore", |
|||
function jsLoading () { |
|||
"tagOpen": "{{Evidenzia|giallo|", |
|||
var i = 0, array1 = document.getElementsByClass('jsloading-pre'), array2 = document.getElementsByClass('jsloading-post'); |
|||
"tagClose": "}}", |
|||
for (i; i < array1.length; i++) |
|||
"sampleText": "Testo" |
|||
array1[i].style.display = 'none'; |
|||
}; |
|||
for (i=0; i < array1.length; i++) |
|||
array2[i].style.display = ''; |
|||
return; |
|||
} |
|||
/* Rende il link di modifica sezione identico a quello di wikipedia italiana */ |
|||
function moveeditsection () { |
|||
var el = getElementsByClass(document, 'editsection', 'span'); |
|||
if (el.length == 0) return; |
|||
var tmp, parent; |
|||
for (var i=0; i < el.length; i++) { |
|||
el[i].className += " editsection-it_wiki"; |
|||
parent = el[i].parentNode; |
|||
tmp = parent.removeChild(el[i]); |
|||
parent.appendChild(tmp); |
|||
} |
|||
return; |
|||
} |
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"
};