MediaWiki:Skin/Epilepsie.js: Unterschied zwischen den Versionen

aus Kamelopedia, der wüsten Enzyklopädie
Zur Navigation springen Zur Suche springen
K (Die Seite wurde neu angelegt.)
 
K (mw.config.get( 'wgAction' ))
 
(Eine dazwischenliegende Version von einem anderen Benutzer wird nicht angezeigt)
Zeile 1: Zeile 1:
 
window.onload = function ()
 
window.onload = function ()
 
{
 
{
 +
if( mw.config.get( 'wgAction' ) != 'view') return;
 
div = document.getElementsByTagName("div");
 
div = document.getElementsByTagName("div");
 
span = document.getElementsByTagName("span");
 
span = document.getElementsByTagName("span");

Aktuelle Version vom 11. April 2012, 18:07 Uhr

window.onload = function ()
	{
	if( mw.config.get( 'wgAction' ) != 'view') return;
	div = document.getElementsByTagName("div");
	span = document.getElementsByTagName("span");
	p = document.getElementsByTagName("p");
	a = document.getElementsByTagName("a");
	ul = document.getElementsByTagName("ul");
	li = document.getElementsByTagName("li");
	h5 = document.getElementsByTagName("h5");
	getMostTextNodes = new Array();
	colors = new Array ("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f");
	fontsizes = new Array ("8px", "9px", "10px", "11px", "12px", "13px", "14px", "15px", "16px", "17px", "18px", "19px", "20px", "21px", "22px", "23px");
	bordersizes = new Array ("0px", "0px", "0px", "0px", "1px", "1px", "2px", "3px");
	borderstyles = new Array ("solid", "inset", "outset", "ridge", "dashed", "double", "dotted", "groove");
	faces = new Array("Arial", "Tahoma", "Times", "serif", "sans-serif", "cursive", "fantasy", "monospace");
	decorations = new Array ("none", "none", "none", "blink", "blink", "line-through", "overline", "underline");
	j = 0;
	for(var i = 0; i < div.length; i++) 
		{
		getMostTextNodes[j] = div[i];
		j++;
		};
	for(var i = 0; i < span.length; i++) 
		{
		getMostTextNodes[j] = span[i];
		j++;
		};
	for(var i = 0; i < p.length; i++) 
		{
		getMostTextNodes[j] = p[i];
		j++;
		};
	for(var i = 0; i < a.length; i++) 
		{
		getMostTextNodes[j] = a[i];
		j++;
		};
	for(var i = 0; i < ul.length; i++) 
		{
		getMostTextNodes[j] = ul[i];
		j++;
		};
	for(var i = 0; i < li.length; i++) 
		{
		getMostTextNodes[j] = li[i];
		j++;
		};
	for(var i = 0; i < h5.length; i++) 
		{
		getMostTextNodes[j] = h5[i];
		j++;
		};
	epilepsy();
	randomColor();
	};

function epilepsy()
	{
	for(i = 0; i < getMostTextNodes.length; i++)
		{
		getMostTextNodes[i].style.backgroundColor = randomColor();
		getMostTextNodes[i].style.color           = randomColor();
		getMostTextNodes[i].style.fontSize        = randomFontSize();
		getMostTextNodes[i].style.fontFamily      = randomFontFace();
		getMostTextNodes[i].style.textDecoration  = randomTextDecoration();
		getMostTextNodes[i].style.borderWidth     = randomBorderWidth();
		getMostTextNodes[i].style.borderColor     = randomColor();
		getMostTextNodes[i].style.borderStyle     = randomBorderStyle();
		}
	window.setTimeout("epilepsy()", 1);
	}

function randomColor()
	{
	var k = "";
	for(var i = 0; i < 6; i++)
		{
		var j = parseInt((Math.random() * 100) % 16);
		var k = k + colors[j];
		}
	return "#" + k;
	}

function randomFontSize()
	{
	return fontsizes[parseInt((Math.random() * 100) % 16)];
	}

function randomBorderWidth()
	{
	return bordersizes[parseInt((Math.random() * 100) % 8)];
	}

function randomBorderStyle()
	{
	return borderstyles[parseInt((Math.random() * 100) % 8)];
	}

function randomFontFace()
	{
	return faces[parseInt((Math.random() * 100) % 8)];
	}

function randomTextDecoration()
	{
	return decorations[parseInt((Math.random() * 100) % 8)];
	}