MediaWiki:Skin/Adventure2.0.js

window.onload = function { var actions = document.getElementById('action-table').getElementsByTagName('td'); for(var i = 0; i < actions.length; i++) { actions[i].setAttribute("onclick", "unselect, " + 						  "this.className = 'selectedaction', " + 						   "selectedaction = this.id.replace(/action-/, ''), " +						   "newtitles, " +						   "newclicks"); }	klickable     = new Array; originaltitles = new Array; var i = document.getElementById('gamefield').getElementsByTagName('*'); var k = 0; for(var j = 0; j < i.length; j++) { if(i[j].className == 'klickable') { klickable[k] = i[j]; originaltitles[k] = i[j].title; k++; }		}	}

function unselect { var actions = document.getElementById('action-table').getElementsByTagName('td'); for(var i = 0; i < actions.length; i++) { actions[i].className = ""; }	for(var i = 0; i < klickable.length; i++) { klickable[i].title = originaltitles[i]; }	}

function newtitles { for(var i = 0; i < klickable.length; i++) { switch(selectedaction) { case "view": klickable[i].title = 'Sieh ' + originaltitles[i] + ' an'; break; case "take": klickable[i].title = 'Nimm ' + originaltitles[i]; break; case "use": klickable[i].title = 'Benutze ' + originaltitles[i]; break; case "talk": klickable[i].title = 'Rede mit ' + originaltitles[i]; break; case "give": klickable[i].title = 'Gib an ' + originaltitles[i]; break; default: originaltitles[i]; break; }		}	}

function newclicks { for(var i = 0; i < klickable.length; i++) { var j = klickable[i].getElementsByTagName('*'); for(var k = 0; k < j.length; k++) { if(j[k].className == selectedaction) { klickable[i].setAttribute("onclick", j[k].innerHTML); }			}		}	}

function showtext(textid, text) { var gametext = document.getElementById('gametext'); gametext.innerHTML += '' + text + ' ' window.setTimeout("hidetext('" + textid + "')", text.length * 70); }

function hidetext(textid) { var gametext = document.getElementById('gametext'); var text = document.getElementById(textid); hide = gametext.removeChild(text); }