Benutzer:Rikku/monobook.js
Hinweis: Leere nach dem Veröffentlichen den Browser-Cache, um die Änderungen sehen zu können.
- Firefox/Safari: Umschalttaste drücken und gleichzeitig Aktualisieren anklicken oder entweder Strg+F5 oder Strg+R (⌘+R auf dem Mac) drücken
- Google Chrome: Umschalttaste+Strg+R (⌘+Umschalttaste+R auf dem Mac) drücken
- Internet Explorer/Edge: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
- Opera: Strg+F5
function spoilAll() { var els = document.getElementsByTagName('*'); var spoiler = new Array(); var pattern = new RegExp("(^|\\s)spoiler(\\s|$)"); for (i = 0; i < els.length; i++) { if(pattern.test(els[i].className)){ spoiler.push(els[i]); } } for (j = 0; j < spoiler.length; j++){ if(pattern.test(spoiler[j].className)){ if("closed" == spoiler[j].getAttribute("value")){ spoiler[j].style.display = 'block'; spoiler[j].setAttribute("value","open"); var link = findLink(j); if(null != link){ link.firstChild.data = "verstecke Spoiler"; } } else{ spoiler[j].style.display = 'none'; spoiler[j].setAttribute("value","closed"); var link = findLink(j); if(null != link){ link.firstChild.data = "zeige Spoiler"; } } } } } function spoil(j) { var els = document.getElementsByTagName('*'); var spoiler = new Array(); var pattern = new RegExp("(^|\\s)spoiler(\\s|$)"); for (i = 0; i < els.length; i++) { if(pattern.test(els[i].className)){ spoiler.push(els[i]); } } if(j < spoiler.length){ if("closed" == spoiler[j].getAttribute("value")){ spoiler[j].style.display = 'block'; spoiler[j].setAttribute("value","open"); var link = findLink(j); if(null != link){ link.firstChild.data = "verstecke Spoiler"; } } else{ spoiler[j].style.display = 'none'; spoiler[j].setAttribute("value","closed"); var link = findLink(j); if(null != link){ link.firstChild.data = "zeige Spoiler"; } } } } function spoilReset() { var els = document.getElementsByTagName('*'); var spoiler = new Array(); var pattern = new RegExp("(^|\\s)spoiler(\\s|$)"); for (i = 0; i < els.length; i++) { if(pattern.test(els[i].className)){ spoiler.push(els[i]); } } for (j = 0; j < spoiler.length; j++){ if(pattern.test(spoiler[j].className)){ spoiler[j].style.display = 'none'; spoiler[j].setAttribute("value","closed"); var link = findLink(j); if(null != link){ link.firstChild.data = "zeige Spoiler"; } } } var link = document.getElementsByName("spoilerbutton")[0]; if(null != link){ link.firstChild.data = "zeige alle Spoiler"; link.href = "javascript:spoilOpenAll()"; link.getAttribute("value").nodeValue = "closed"; } } function spoilOpenAll() { var els = document.getElementsByTagName('*'); var spoiler = new Array(); var pattern = new RegExp("(^|\\s)spoiler(\\s|$)"); for (i = 0; i < els.length; i++) { if(pattern.test(els[i].className)){ spoiler.push(els[i]); } } for (j = 0; j < spoiler.length; j++){ if(pattern.test(spoiler[j].className)){ spoiler[j].style.display = 'block'; spoiler[j].setAttribute("value","open"); var link = findLink(j); if(null != link){ link.firstChild.data = "verstecke Spoiler"; } } } var link = document.getElementsByName("spoilerbutton")[0]; if(null != link){ link.firstChild.data = "verstecke alle Spoiler"; link.href = "javascript:spoilReset()"; link.getAttribute("value").nodeValue = "open"; } } function findLink(j) { var linksAll = document.getElementsByName("spoilerlink-"+j); if(0<linksAll.length){ return linksAll[0]; } return null; } function buildSpoitertags(){ var els = document.getElementsByTagName('*'); var spoiler = new Array(); var pattern = new RegExp("(^|\\s)spoiler(\\s|$)"); for (i = 0; i < els.length; i++) { if(pattern.test(els[i].className)){ spoiler.push(els[i]); } } for(j=0;j < spoiler.length;j++){ var value = document.createAttribute("value"); value.nodeValue = "open"; spoiler[j].setAttributeNode(value); //baue link... var par = document.createElement("p"); var link = document.createElement("link"); link.href = "javascript:spoil("+j+")"; var text = document.createTextNode("verstecke spoiler"); var value = document.createAttribute("name"); value.nodeValue = "spoilerlink-"+j; link.setAttributeNode(value); link.appendChild(text); //insert link... par.appendChild(link); spoiler[j].parentNode.insertBefore(par, spoiler[j]); } if(0 < spoiler.length){ //baue link... var par = document.createElement("p"); var link = document.createElement("link"); link.href = "javascript:spoilAll()"; var text = document.createTextNode("spoilerbutton"); var value = document.createAttribute("name"); value.nodeValue = "spoilerbutton"; link.setAttributeNode(value); var value = document.createAttribute("value"); value.nodeValue = "open"; link.setAttributeNode(value); var style = document.createAttribute("style"); style.nodeValue = "float:right"; link.setAttributeNode(style); link.appendChild(text); //insert link... par.appendChild(link); var h1 = document.getElementsByTagName("h1")[0]; h1.parentNode.insertBefore(par, h1); spoilReset(); } } addOnloadHook(buildSpoitertags);