Benutzer:Curilias/monobook.js: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
K (Die Seite wurde geleert.) |
K |
||
Zeile 1: | Zeile 1: | ||
var HideInfobox = '[Verbergen]'; | |||
var ShowInfobox = '[Anzeigen]'; | |||
function toggleInfobox(indexInfobox) { | |||
var Infobox = document.getElementById("Infobox" + indexInfobox); | |||
var ToggleInfobox = document.getElementById("ToggleInfobox" + indexInfobox); | |||
if (!Infobox || !ToggleInfobox) { return false; } | |||
for (var i = 0; i < Infobox.rows.length; i++) { | |||
row = Infobox.rows[i]; | |||
if (row.className == 'ib_collapsable') { | |||
if (ToggleInfobox.firstChild.data == HideInfobox) { | |||
row.style.display = 'none'; | |||
} else if (ToggleInfobox.firstChild.data == ShowInfobox) { | |||
row.style.display = 'block'; | |||
} | |||
} | |||
} | |||
if (ToggleInfobox.firstChild.data == HideInfobox) { | |||
ToggleInfobox.firstChild.data = ShowInfobox; | |||
} else { | |||
ToggleInfobox.firstChild.data = HideInfobox; | |||
} | |||
} | |||
function addToggleInfoboxButton() { | |||
var indexInfobox = 0; | |||
for (var i=0; Infobox = document.getElementsByTagName("table")[i]; i++) { | |||
if (Infobox.className == "ib_table") { | |||
indexInfobox++; | |||
var ToggleInfobox = document.createElement("a"); | |||
ToggleInfobox.className = 'ToggleInfobox'; | |||
ToggleInfobox.setAttribute('id', 'ToggleInfobox' + indexInfobox ); | |||
ToggleInfobox.setAttribute('href', 'javascript:toggleInfobox(' + indexInfobox + ');'); | |||
var ToggleCaption = document.createTextNode(HideInfobox); | |||
ToggleInfobox.appendChild(ToggleCaption); | |||
Infobox.getElementsByTagName('th')[0].appendChild(ToggleInfobox); | |||
Infobox.setAttribute('id', 'Infobox' + indexInfobox); | |||
} | |||
} | |||
} | |||
addOnloadHook(addToggleInfoboxButton); |
Version vom 22. Juli 2008, 20:57 Uhr
var HideInfobox = '[Verbergen]'; var ShowInfobox = '[Anzeigen]'; function toggleInfobox(indexInfobox) { var Infobox = document.getElementById("Infobox" + indexInfobox); var ToggleInfobox = document.getElementById("ToggleInfobox" + indexInfobox); if (!Infobox || !ToggleInfobox) { return false; } for (var i = 0; i < Infobox.rows.length; i++) { row = Infobox.rows[i]; if (row.className == 'ib_collapsable') { if (ToggleInfobox.firstChild.data == HideInfobox) { row.style.display = 'none'; } else if (ToggleInfobox.firstChild.data == ShowInfobox) { row.style.display = 'block'; } } } if (ToggleInfobox.firstChild.data == HideInfobox) { ToggleInfobox.firstChild.data = ShowInfobox; } else { ToggleInfobox.firstChild.data = HideInfobox; } } function addToggleInfoboxButton() { var indexInfobox = 0; for (var i=0; Infobox = document.getElementsByTagName("table")[i]; i++) { if (Infobox.className == "ib_table") { indexInfobox++; var ToggleInfobox = document.createElement("a"); ToggleInfobox.className = 'ToggleInfobox'; ToggleInfobox.setAttribute('id', 'ToggleInfobox' + indexInfobox ); ToggleInfobox.setAttribute('href', 'javascript:toggleInfobox(' + indexInfobox + ');'); var ToggleCaption = document.createTextNode(HideInfobox); ToggleInfobox.appendChild(ToggleCaption); Infobox.getElementsByTagName('th')[0].appendChild(ToggleInfobox); Infobox.setAttribute('id', 'Infobox' + indexInfobox); } } } addOnloadHook(addToggleInfoboxButton);