Kamel:WiMu/Geldautomat.js

window.onload = function { if(document.getElementById('startscript')) { actualpage = 'chooselang'; pages = new Array; max = ""; prepare; }	}

function prepare { var content = document.getElementById('content'); var tags   = content.getElementsByTagName('*'); var expr   = /page\(.*\)/; for (var i = 0; i < tags.length; i++) { if(tags[i].className != '') { var classes = tags[i].className.split(' '); for (var j = 0; j < classes.length; j++) { if(classes[j] == 'noscript') { tags[i].innerHTML = ""; }				if(classes[j] == 'leftpanel') { var linkurl  = checkhref(tags[i].innerHTML); var linktitle = tags[i].title; var newlink  = '' tags[i].innerHTML = newlink; }				if(classes[j] == 'rightpanel') { var linkurl  = checkhref(tags[i].innerHTML); var linktitle = tags[i].title; var newlink  = '' tags[i].innerHTML = newlink; }				if(classes[j] == 'button') { var buttontitle = tags[i].title; var buttonclick = tags[i].innerHTML; var newbutton  = ''; tags[i].innerHTML = newbutton; }				if(classes[j].search(/page\(.*\)/) != -1) { var pagename   = classes[j].search(/page\((.*)\)/, '$1'); var pagename   = RegExp.$1; if(typeof pages[pagename] == 'undefined') { pages[pagename] = new Array; }					pages[pagename][pages[pagename].length] = tags[i]; }				}			}		}	show(actualpage); };

function checkhref(linkurl) { if(linkurl.substring(0, 1) == '&') { var checkedurl = wgScript + '?title=' + wgPageName + linkurl; } else { var checkedurl = "#"; }		return checkedurl; };

function show(pagetoshow) { for (var i = 0; i < pages[pagetoshow].length; i++) { pages[pagetoshow][i].style.display = 'block'; }	};

function hide(pagetohide) { for (var i = 0; i < pages[pagetohide].length; i++) { pages[pagetohide][i].style.display = 'none'; }	};

function nextpage(pagetoshow) { window.setTimeout("hide('" + actualpage + "')", 1000); window.setTimeout("show('" + pagetoshow + "')", 1000); actualpage = pagetoshow; }

function progressbar(pagetoshow) { var progress = Number(document.getElementById('load').style.width.replace(/px/, '')); if(max == "") { document.getElementById('load').style.width = '0px'; max = "2" + Math.floor(Math.random * 100) % 50; if(max.length < 3) { max = max + "0"; }		max = max - 20; window.setTimeout("progressbar('" + pagetoshow + "')", 2000); } else { if(progress >= max) { window.setTimeout("nextpage('" + pagetoshow + "')", 1000); max = ""; } else { var resize = Math.floor(Math.random * 15) % 15 - 5; if(progress + resize > 0) { document.getElementById('load').style.width = (progress + resize) + 'px'; document.getElementById('percent').innerHTML = Math.floor((progress + resize + (Math.random * 5)) / 2) + '%'; } else { document.getElementById('load').style.width = (progress - resize) + 'px'; document.getElementById('percent').innerHTML = Math.floor((progress - resize + (Math.random * 5)) / 2) + '%'; };			window.setTimeout("progressbar('" + pagetoshow + "')", Math.floor(Math.random * 500)); }		}	}