Benutzer:WiMu/Geldautomat.js: Unterschied zwischen den Versionen

aus Kamelopedia, der wüsten Enzyklopädie
Zur Navigation springen Zur Suche springen
K (mal sehen ...)
 
K (nix lokalhost ... kamelo, WiMu, kamelo!)
 
Zeile 47: Zeile 47:
 
var buttonclick = tags[i].innerHTML;
 
var buttonclick = tags[i].innerHTML;
 
var newbutton  = '<input type="button" value="' + buttontitle + '" onclick="'
 
var newbutton  = '<input type="button" value="' + buttontitle + '" onclick="'
+ buttonclick + '" style="background: #727eb9 url(http://localhost/wiki/images/6/61/Sichtfenster.png) center center;">';
+
+ buttonclick + '" style="background: #727eb9 url(/images/6/61/Sichtfenster.png) center center;">';
 
tags[i].innerHTML = newbutton;
 
tags[i].innerHTML = newbutton;
 
}
 
}

Aktuelle Version vom 29. August 2009, 17:11 Uhr

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   = '<a href="' + linkurl + '" title="' + linktitle
						      + '" style="background-image: url(' + wgScriptPath 
						      + '/images/f/f8/Knopp_links.png)"' 
						      + 'onmousedown="this.style.backgroundImage = ' 
						      + "'url(" + wgScriptPath + "/images/6/6c/Linker_Knopp_press.png)'"
						      + '" onmouseup="this.style.backgroundImage = '
						      + "'url(" + wgScriptPath + "/images/f/f8/Knopp_links.png)'" + '"></a>'
					tags[i].innerHTML = newlink;
					}
				if(classes[j] == 'rightpanel') {
					var linkurl   = checkhref(tags[i].innerHTML);
					var linktitle = tags[i].title;
					var newlink   = '<a href="' + linkurl + '" title="' + linktitle
						      + '" style="background-image: url(' + wgScriptPath 
						      + '/images/5/59/Knopp_rechts.png)"' 
						      + 'onmousedown="this.style.backgroundImage = ' 
						      + "'url(" + wgScriptPath + "/images/c/cf/Rechter_Knopp_press.png)'"
						      + '" onmouseup="this.style.backgroundImage = '
						      + "'url(" + wgScriptPath + "/images/5/59/Knopp_rechts.png)'" + '"></a>'
					tags[i].innerHTML = newlink;
					}
				if(classes[j] == 'button') {
					var buttontitle = tags[i].title;
					var buttonclick = tags[i].innerHTML;
					var newbutton   = '<input type="button" value="' + buttontitle + '" onclick="'
							+ buttonclick + '" style="background: #727eb9 url(/images/6/61/Sichtfenster.png) center center;">';
					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));
			}
		}
	}