Utente:Magicbox/monobook.js: differenze tra le versioni
Vai alla navigazione
Vai alla ricerca
Contenuto aggiunto Contenuto cancellato
Magicbox (rosica | curriculum) Nessun oggetto della modifica |
Magicbox (rosica | curriculum) Nessun oggetto della modifica |
||
Riga 1: | Riga 1: | ||
annullaMorphCommon = 1; |
|||
/* Hook that enables collapsing objects. |
|||
* Added 11/5/2007 by WhiteMystery (misterioblanco@gmail.com) |
|||
* on Encyclopedia Dramatica, stolen by Sua Zanzità Zazy |
|||
* Uses publicly available code in one function, where noted. */ |
|||
addOnloadHook(createToggleLinks); |
|||
/* Function that toggles collapsing objects. |
|||
* Added 11/5/2007 by WhiteMystery (misterioblanco@gmail.com) |
|||
* on Encyclopedia Dramatica, stolen by Sua Zanzità Zazy |
|||
* Uses publicly available code in one function, where noted. */ |
|||
function toggleCollapse(objToToggle, collapseText, expandText) { |
|||
var linkText = ""; |
|||
var targetObject = returnObjById(objToToggle); |
|||
if ( targetObject ) { |
|||
if ( targetObject.style.display == "none" ) { |
|||
targetObject.style.display = "block"; |
|||
linkText = collapseText; |
|||
} |
|||
else { |
|||
targetObject.style.display = "none"; |
|||
linkText = expandText; |
|||
} |
|||
var toggleLink = document.createElement("span"); |
|||
toggleLink.appendChild(document.createTextNode(linkText)); |
|||
toggleLink.setAttribute("onclick", "javascript:toggleCollapse('" + objToToggle + "','" + collapseText + "','" + expandText + "')"); |
|||
toggleLink.setAttribute('onmouseover', 'style.textDecoration="underline"'); |
|||
toggleLink.setAttribute('onmouseout', 'style.textDecoration="none"'); |
|||
toggleLink.setAttribute("style", "color:blue;"); |
|||
returnObjById(objToToggle + "Link").innerHTML = ""; |
|||
returnObjById(objToToggle + "Link").appendChild(toggleLink); |
|||
} |
|||
} |
|||
/* Functions that performs the morph operation. |
|||
* Added 11/5/2007 by WhiteMystery (misterioblanco@gmail.com) |
|||
* on Encyclopedia Dramatica, stolen by Sua Zanzità Zazy |
|||
* Uses publicly available code in one function, where noted. */ |
|||
function performMorph(targetID, targetNumber) { |
|||
var counter = 1; |
|||
while ( returnObjById(targetID + "Content" + counter) ) { |
|||
if ( counter == targetNumber ) |
|||
returnObjById(targetID + "Content" + counter).style.display = "block"; |
|||
else |
|||
returnObjById(targetID + "Content" + counter).style.display = "none"; |
|||
counter++; |
|||
} |
|||
returnObjById(targetID + "Master").innerHTML = targetNumber; |
|||
} |
|||
function morphForward(targetID) { |
|||
var nextPane = parseInt(returnObjById(targetID + "Master").innerHTML) + 1; |
|||
if ( returnObjById(targetID + "Content" + nextPane) ) |
|||
performMorph(targetID, nextPane); |
|||
else |
|||
performMorph(targetID, "1"); |
|||
} |
|||
function morphBackward(targetID) { |
|||
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); |
|||
} |
|||
} |
|||
/* Function that creates ED's collapsing objects and toggle links. |
|||
* Added 11/5/2007 by WhiteMystery (misterioblanco@gmail.com) |
|||
* on Encyclopedia Dramatica, stolen by Sua Zanzità Zazy |
|||
* Uses publicly available code in one function, where noted. |
|||
* |
|||
* Updated: 1/11/2008 by WhiteMystery to add new Morphing Objects |
|||
* functionality. */ |
|||
function createToggleLinks() { |
|||
var spanCollection = document.getElementsByTagName("span"); |
|||
for ( i = 0; i < spanCollection.length; i++ ) { |
|||
if ( spanCollection[i].className == "toggleLink" ) { |
|||
var spanID = spanCollection[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("span"); |
|||
if ( initialState == "0" ) { |
|||
returnObjById(targetID).style.display = "none"; |
|||
toggleLink.appendChild(document.createTextNode(expandText)); |
|||
} |
|||
else { |
|||
returnObjById(targetID).style.display = "block"; |
|||
toggleLink.appendChild(document.createTextNode(collapseText)); |
|||
} |
|||
toggleLink.setAttribute("onclick", "javascript:toggleCollapse('" + targetID + "','" + collapseText + "','" + expandText + "')"); |
|||
toggleLink.setAttribute('onmouseover', 'style.textDecoration="underline"'); |
|||
toggleLink.setAttribute('onmouseout', 'style.textDecoration="none"'); |
|||
toggleLink.setAttribute("style", "color:blue;"); |
|||
spanCollection[i].appendChild(toggleLink); |
|||
} |
|||
else if ( spanCollection[i].className == "morphMaster" ) { |
|||
var spanID = spanCollection[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("span"); |
|||
nextLink.innerHTML = returnObjById(targetID + "LinkNext").innerHTML; |
|||
nextLink.setAttribute("onclick", "javascript:morphForward('" + targetID + "')"); |
|||
nextLink.setAttribute('onmouseover', 'style.textDecoration="underline"'); |
|||
nextLink.setAttribute('onmouseout', 'style.textDecoration="none"'); |
|||
nextLink.setAttribute("style", "color:blue;"); |
|||
returnObjById(targetID + "LinkNext").innerHTML = ""; |
|||
returnObjById(targetID + "LinkNext").appendChild(nextLink, 0); |
|||
// Create the backward link |
|||
var prevLink = document.createElement("span"); |
|||
prevLink.innerHTML = returnObjById(targetID + "LinkPrev").innerHTML; |
|||
prevLink.setAttribute("onclick", "javascript:morphBackward('" + targetID + "')"); |
|||
prevLink.setAttribute('onmouseover', 'style.textDecoration="underline"'); |
|||
prevLink.setAttribute('onmouseout', 'style.textDecoration="none"'); |
|||
prevLink.setAttribute("style", "color:blue;"); |
|||
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 = "block"; |
|||
else |
|||
returnObjById(targetID + "Content" + counter).style.display = "none"; |
|||
counter++; |
|||
} |
|||
} |
|||
counter = 1; |
|||
// Whether or not there is paging, generate normal links |
|||
while ( returnObjById(targetID + "Link" + counter) && returnObjById(targetID + "Content" + counter) ) { |
|||
var morphLink = document.createElement("span"); |
|||
morphLink.innerHTML = returnObjById(targetID + "Link" + counter).innerHTML; |
|||
morphLink.setAttribute("onclick", "javascript:performMorph('" + targetID + "','" + counter + "')"); |
|||
morphLink.setAttribute('onmouseover', 'style.textDecoration="underline"'); |
|||
morphLink.setAttribute('onmouseout', 'style.textDecoration="none"'); |
|||
morphLink.setAttribute("style", "color:blue;"); |
|||
returnObjById(targetID + "Link" + counter).innerHTML = ""; |
|||
returnObjById(targetID + "Link" + counter).appendChild(morphLink, 0); |
|||
// Initialize content panes |
|||
if ( counter == 1 ) |
|||
returnObjById(targetID + "Content" + counter).style.display = "block"; |
|||
else |
|||
returnObjById(targetID + "Content" + counter).style.display = "none"; |
|||
counter++; |
|||
} |
|||
spanCollection[i].innerHTML = "1"; |
|||
spanCollection[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 Sua Zanzità Zazy |
|||
* 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; |
|||
} |
|||
disablealertLoad=1; |
disablealertLoad=1; |
||
Versione delle 20:19, 6 mag 2009
annullaMorphCommon = 1;
/* Hook that enables collapsing objects.
* Added 11/5/2007 by WhiteMystery (misterioblanco@gmail.com)
* on Encyclopedia Dramatica, stolen by Sua Zanzità Zazy
* Uses publicly available code in one function, where noted. */
addOnloadHook(createToggleLinks);
/* Function that toggles collapsing objects.
* Added 11/5/2007 by WhiteMystery (misterioblanco@gmail.com)
* on Encyclopedia Dramatica, stolen by Sua Zanzità Zazy
* Uses publicly available code in one function, where noted. */
function toggleCollapse(objToToggle, collapseText, expandText) {
var linkText = "";
var targetObject = returnObjById(objToToggle);
if ( targetObject ) {
if ( targetObject.style.display == "none" ) {
targetObject.style.display = "block";
linkText = collapseText;
}
else {
targetObject.style.display = "none";
linkText = expandText;
}
var toggleLink = document.createElement("span");
toggleLink.appendChild(document.createTextNode(linkText));
toggleLink.setAttribute("onclick", "javascript:toggleCollapse('" + objToToggle + "','" + collapseText + "','" + expandText + "')");
toggleLink.setAttribute('onmouseover', 'style.textDecoration="underline"');
toggleLink.setAttribute('onmouseout', 'style.textDecoration="none"');
toggleLink.setAttribute("style", "color:blue;");
returnObjById(objToToggle + "Link").innerHTML = "";
returnObjById(objToToggle + "Link").appendChild(toggleLink);
}
}
/* Functions that performs the morph operation.
* Added 11/5/2007 by WhiteMystery (misterioblanco@gmail.com)
* on Encyclopedia Dramatica, stolen by Sua Zanzità Zazy
* Uses publicly available code in one function, where noted. */
function performMorph(targetID, targetNumber) {
var counter = 1;
while ( returnObjById(targetID + "Content" + counter) ) {
if ( counter == targetNumber )
returnObjById(targetID + "Content" + counter).style.display = "block";
else
returnObjById(targetID + "Content" + counter).style.display = "none";
counter++;
}
returnObjById(targetID + "Master").innerHTML = targetNumber;
}
function morphForward(targetID) {
var nextPane = parseInt(returnObjById(targetID + "Master").innerHTML) + 1;
if ( returnObjById(targetID + "Content" + nextPane) )
performMorph(targetID, nextPane);
else
performMorph(targetID, "1");
}
function morphBackward(targetID) {
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);
}
}
/* Function that creates ED's collapsing objects and toggle links.
* Added 11/5/2007 by WhiteMystery (misterioblanco@gmail.com)
* on Encyclopedia Dramatica, stolen by Sua Zanzità Zazy
* Uses publicly available code in one function, where noted.
*
* Updated: 1/11/2008 by WhiteMystery to add new Morphing Objects
* functionality. */
function createToggleLinks() {
var spanCollection = document.getElementsByTagName("span");
for ( i = 0; i < spanCollection.length; i++ ) {
if ( spanCollection[i].className == "toggleLink" ) {
var spanID = spanCollection[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("span");
if ( initialState == "0" ) {
returnObjById(targetID).style.display = "none";
toggleLink.appendChild(document.createTextNode(expandText));
}
else {
returnObjById(targetID).style.display = "block";
toggleLink.appendChild(document.createTextNode(collapseText));
}
toggleLink.setAttribute("onclick", "javascript:toggleCollapse('" + targetID + "','" + collapseText + "','" + expandText + "')");
toggleLink.setAttribute('onmouseover', 'style.textDecoration="underline"');
toggleLink.setAttribute('onmouseout', 'style.textDecoration="none"');
toggleLink.setAttribute("style", "color:blue;");
spanCollection[i].appendChild(toggleLink);
}
else if ( spanCollection[i].className == "morphMaster" ) {
var spanID = spanCollection[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("span");
nextLink.innerHTML = returnObjById(targetID + "LinkNext").innerHTML;
nextLink.setAttribute("onclick", "javascript:morphForward('" + targetID + "')");
nextLink.setAttribute('onmouseover', 'style.textDecoration="underline"');
nextLink.setAttribute('onmouseout', 'style.textDecoration="none"');
nextLink.setAttribute("style", "color:blue;");
returnObjById(targetID + "LinkNext").innerHTML = "";
returnObjById(targetID + "LinkNext").appendChild(nextLink, 0);
// Create the backward link
var prevLink = document.createElement("span");
prevLink.innerHTML = returnObjById(targetID + "LinkPrev").innerHTML;
prevLink.setAttribute("onclick", "javascript:morphBackward('" + targetID + "')");
prevLink.setAttribute('onmouseover', 'style.textDecoration="underline"');
prevLink.setAttribute('onmouseout', 'style.textDecoration="none"');
prevLink.setAttribute("style", "color:blue;");
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 = "block";
else
returnObjById(targetID + "Content" + counter).style.display = "none";
counter++;
}
}
counter = 1;
// Whether or not there is paging, generate normal links
while ( returnObjById(targetID + "Link" + counter) && returnObjById(targetID + "Content" + counter) ) {
var morphLink = document.createElement("span");
morphLink.innerHTML = returnObjById(targetID + "Link" + counter).innerHTML;
morphLink.setAttribute("onclick", "javascript:performMorph('" + targetID + "','" + counter + "')");
morphLink.setAttribute('onmouseover', 'style.textDecoration="underline"');
morphLink.setAttribute('onmouseout', 'style.textDecoration="none"');
morphLink.setAttribute("style", "color:blue;");
returnObjById(targetID + "Link" + counter).innerHTML = "";
returnObjById(targetID + "Link" + counter).appendChild(morphLink, 0);
// Initialize content panes
if ( counter == 1 )
returnObjById(targetID + "Content" + counter).style.display = "block";
else
returnObjById(targetID + "Content" + counter).style.display = "none";
counter++;
}
spanCollection[i].innerHTML = "1";
spanCollection[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 Sua Zanzità Zazy
* 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;
}
disablealertLoad=1;
if (mwCustomEditButtons) {
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://images.wikia.com/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"};
}
if (mwCustomEditButtons) {
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://images.wikia.com/nonciclopedia/images/a/a5/Button_Samara.png",
"speedTip": "Articolo in scadenza",
"tagOpen": "{{scadenza|{{subst:7g}" + "}|note=",
"tagClose": "|firma=~~" + "~~}" + "}\n\n",
"sampleText": "Note"};
}
if (mwCustomEditButtons) {
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://images.wikia.com/nonciclopedia/images/9/93/Button_Jessica.png",
"speedTip": "Articolo in dubbio",
"tagOpen": "{{Accusa|accusa=",
"tagClose": "|firma=~~" + "~~}" + "}\n\n",
"sampleText": "Inserire qui l'accusa"};
}
if (mwCustomEditButtons) {
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://images4.wikia.nocookie.net/nonciclopedia/images/3/33/Sguardone.png",
"speedTip": "Immagine da rinominare ",
"tagOpen": "{{Nomedimmerda|{{subst:7g}" + "}|motivo=",
"tagClose": "|firma=~~" + "~~}" + "}\n\n",
"sampleText": ""};
}
if (mwCustomEditButtons) {
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/c/c9/Button_strike.png",
"speedTip": "Barrato",
"tagOpen": "<s>",
"tagClose": "</s>",
"sampleText": "Barrato"};
}
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://images2.wikia.nocookie.net/nonciclopedia/images/9/99/Fuckatomico_button.jpg",
"speedTip": "Riservato ESCLUSIVAMENTE ai vandali!",
"tagOpen": "{{Vandalo"+"}}~~"+"~~",
"tagClose": "}}",
"sampleText": "{{Utente:Marcopete87/blocco"}