Benutzer:Rikku/monobook.js: Unterschied zwischen den Versionen

test iconbar;
K (test spoilerbutton;)
(test iconbar;)
Zeile 1:
//global variables for spoilerbutton and iconbar;
function spoilAll() {
//will be used in the initIconbar()-function;
var els = document.getElementsByTagName('*');
var glSpoilerbutton;
var spoiler = new Array();
var patternglIconbar = new RegExpArray("(^|\\s)spoiler(\\s|$)");
 
for (i = 0; i < els.length; i++) {
function createSpoilerbutton(){
if(pattern.test(els[i].className)){
//baue link...
spoiler.push(els[i]);
 
}
var link = document.createElement("a");
}
link.href = "javascript:spoilAll()";
for (j = 0; j < spoiler.length; j++){
var text = document.createTextNode("zeige alle Spoiler");
if(pattern.test(spoiler[j].className)){
link.appendChild(text);
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";
}
}
}
}
}
 
var value = document.createAttribute("name");
function spoil(j) {
value.nodeValue = "spoilerbutton";
var els = document.getElementsByTagName('*');
link.setAttributeNode(value);
var spoiler = new Array();
 
var pattern = new RegExp("(^|\\s)spoiler(\\s|$)");
var value = document.createAttribute("id");
for (i = 0; i < els.length; i++) {
value.nodeValue = "spoilerbutton";
if(pattern.test(els[i].className)){
link.setAttributeNode(value);
spoiler.push(els[i]);
 
}
var value = document.createAttribute("value");
}
value.nodeValue = "closed";
if(j < spoiler.length){
link.setAttributeNode(value);
if("closed" == spoiler[j].getAttribute("value")){
 
spoiler[j].style.display = 'block';
return link;
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";
}
}
}
}
 
//testfunction...
function spoilReset() {
function addIcon(){
var els = document.getElementsByTagName('*');
var spoilerimg = new Arraydocument.createElement('img');
img.src = './images/20px-Qsicon_gesprochen.png';
var pattern = new RegExp("(^|\\s)spoiler(\\s|$)");
img.alt = "gesprochen Version";
for (i = 0; i < els.length; i++) {
var value = document.createAttribute("class");
if(pattern.test(els[i].className)){
value.nodeValue = "icon";
spoiler.push(els[i]);
img.close;
}
img.setAttributeNode(value);
}
glIconbar.push(img);
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 spoilOpenAllfindIcons() {
var elsaudio = document.getElementsByTagNamegetElementById('*'"Gesprochene Version");
if (null!=audio){
var spoiler = new Array();
addIcon();
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";
}
//var lesenswert = document.getElementById("lesenswert");
//var exzellent = document.getElementById("exzellent");
}
 
function findLinkinitIconbar(j) {
var iconbar = new Array();
var linksAll = document.getElementsByName("spoilerlink-"+j);
var ul = document.createElement("ul");
if(0<linksAll.length){
var value = document.createAttribute("id");
return linksAll[0];
value.nodeValue = "iconbar";
ul.setAttributeNode(value);
 
//find icons;
findIcons();
 
//add icons;
for(i=0; i< glIconbar.length; i++){
var li = document.createElement("li");
li.appendChild(glIconbar[i]);
ul.appendChild(li);
}
var h1 = document.getElementsByTagName("h1")[0];
return null;
h1.parentNode.insertBefore(ul, h1);
}
 
function buildSpoitertagsinitSpoiler(){
var els = document.getElementsByTagName('*');
var spoiler = new Array();
//var pattern = new RegExp("(^|\\s)spoiler(\\s|$)");
var pattern = new RegExp("(^|\\s)jp(\\s|$)");
 
for (i = 0; i < els.length; i++) {
if(pattern.test(els[i].className)){
spoiler.push(els[i]);
els[i].style.display = "none";
}
}
 
for(j=0;j < spoiler.length;j++){
/*for(j=0;j < spoiler.length;j++){
//document.writeln(spoiler[j].nodeName);
var value = document.createAttribute("value");
value.nodeValue = "openclosed";
spoiler[j].setAttributeNode(value);
//baue link...
var link = createSpoilerlink(j, spoiler[j].nodeName);
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...
if(!modifySpoilerhinweis(j, spoiler[j], link)){
par.appendChild(link);
spoiler[j].parentNode.insertBefore(parlink, spoiler[j]);
}
}
}*/
 
if(0 < spoiler.length){
//baue link...
glSpoilerbutton = createSpoilerbutton();
var par = document.createElement("p");
glIconbar.push(glSpoilerbutton);
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();
 
}
initIconbar();
}
 
addOnloadHook(buildSpoitertagsinitSpoiler);
5.367

Bearbeitungen