Benutzer:Jah/rhic.js

aus Wikipedia, der freien Enzyklopädie
Zur Navigation springen Zur Suche springen

Hinweis: Leere nach dem Veröffentlichen den Browser-Cache, um die Änderungen sehen zu können.

  • Firefox/Safari: Umschalttaste drücken und gleichzeitig Aktualisieren anklicken oder entweder Strg+F5 oder Strg+R (⌘+R auf dem Mac) drücken
  • Google Chrome: Umschalttaste+Strg+R (⌘+Umschalttaste+R auf dem Mac) drücken
  • Internet Explorer/Edge: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
  • Opera: Strg+F5
var pageEnc = encodeURIComponent(mw.config.get('wgPageName'));
var rhicSrc = "http://localhost/cgi-bin/histInfo?lang=de&project=wikipedia&page="+pageEnc;
var lws = 5; // length of word sequences
var user = "Benutzer";
var rhicNewSince = "neu seit";
var rhicOther = "andere";

var nColAu = 6;			// number of authors whose contributions are to be colored

var rhicTiPath = new Array(	// rgb values
	0xff, 0x00, 0x00,	// newest versions
	0x00, 0xbf, 0x00,
	0x00, 0x00, 0xff	// oldest versions
);

function initRhic() {
	if(wgNamespaceNumber!=0)
		return;

	var rhicNLink = document.createElement("a");
	rhicNLink.setAttribute("onclick", "rhicReset()");
	var rhicNLinkText =  document.createTextNode("N");
	rhicNLink.appendChild(rhicNLinkText);
	var rhicAuLink = document.createElement("a");
	rhicAuLink.setAttribute("onclick", "rhicAuF()");
	var rhicAuLinkText =  document.createTextNode("Au");
	rhicAuLink.appendChild(rhicAuLinkText);
	var rhicTiLink = document.createElement("a");
	rhicTiLink.setAttribute("onclick", "rhicTiF()");
	var rhicTiLinkText =  document.createTextNode("Ti");
	rhicTiLink.appendChild(rhicTiLinkText);
	rhicNode = document.createElement("li");
	rhicNode.appendChild(rhicNLink);
	rhicNode.appendChild(rhicAuLink);
	rhicNode.appendChild(rhicTiLink);
	rhicNode.setAttribute("id", "ca-rhic");

	pCactionsUl = document.getElementById("p-cactions").getElementsByTagName("ul")[0];
        liHistory = document.getElementById("ca-history");
        pCactionsUl.insertBefore(rhicNode, liHistory.nextSibling);
}

function rhicAuF() {
	rhicRequest = "Au";
	rhic();
}

function rhicTiF() {
	rhicRequest = "Ti";
	rhic();
}

function rhic() {
	if(typeof histInfo == 'undefined') {
		var head = document.getElementsByTagName('head').item(0);
		var js = document.createElement('script');
		js.setAttribute('type', 'text/javascript');
		js.setAttribute('src', rhicSrc);
		js.setAttribute('charset', 'utf-8');
		head.appendChild(js);
		// rhic2() is called at the end of the server response
	} else {
		rhic2();
	}
}

function rhic2() {
	initArrays();
	if(typeof originalBodyContent == 'undefined') {
		bodyContent = document.getElementById('bodyContent');
	} else {
		rhicReset();
	}
	originalBodyContent = bodyContent.cloneNode(true);
	removeLinks(bodyContent);
	extractWords(bodyContent);
	matchSequences();
	rhicPos = 0;
	markWords();
	if(rhicRequest=="Au")
		rhicStat();
}

function initArrays() {
	initHexLUT();
	rhicTextNodes = new Array();
	rhicAu = new Array();
	rhicTi = new Array();
	rhicTiMs = new Array();
	rhicTiColor = new Array();
	rhicNewestRev = 0;
	rhicNewestTi = "";
	rhicRev = new Object();
	rhicRevOrig = new Array();
	var now = new Date().getTime();
	var tiRe = /^(....)-(..)-(..)T(..):(..):(..)Z$/;
	for(var j=0, pos=0; j<histInfo.length; j++) {
		var rhicRevTiAuHsh = histInfo[j];
		for(var i=0; i<rhicRevTiAuHsh.length/4; i++, pos++) {
			rhicNewestRev = rhicRevOrig[pos] = rhicRevTiAuHsh[4*i];
			var ti = rhicRevTiAuHsh[4*i+1];
			rhicNewestTi = rhicTi[pos] = ti.substring(0, ti.length-1).replace(/T/, ' ');
			tiRe.exec(ti);
			rhicTiMs[pos] = new Date(RegExp.$1, RegExp.$2-1, RegExp.$3, RegExp.$4, RegExp.$5, RegExp.$6).getTime();
			var tiDiffNorm = Math.min(0.9999, Math.log(
					Math.max(1, (now-rhicTiMs[pos])/(1000*86400*7))
				)/5);
			var c1 = Math.floor(tiDiffNorm*(rhicTiPath.length/3-1));
			var cFrac = tiDiffNorm*(rhicTiPath.length/3-1) - c1;
			var r = Math.floor((1-cFrac)*rhicTiPath[3*c1  ]+cFrac*rhicTiPath[3*(c1+1)  ]);
			var g = Math.floor((1-cFrac)*rhicTiPath[3*c1+1]+cFrac*rhicTiPath[3*(c1+1)+1]);
			var b = Math.floor((1-cFrac)*rhicTiPath[3*c1+2]+cFrac*rhicTiPath[3*(c1+1)+2]);
			rhicTiColor[pos]= "color:#"+hexLUT[r]+hexLUT[g]+hexLUT[b]+";";
			var au = rhicRevTiAuHsh[4*i+2];
			rhicAu[pos] = au;
			var hashes = rhicRevTiAuHsh[4*i+3];
			for(var k=0; k<hashes.length/8; k++)
				rhicRev[hashes.substr(8*k, 8)] = pos;
		}
	}
	rhicAuName = new Array();
	rhicAuSorted = new Array();
	rhicAuNWords = new Object();	// number of words contributed to this article by the respective authors
	for(var i=0; i<histAuInfo.length; i++) {
		rhicAuName[i] = histAuInfo[i];
		rhicAuNWords[i] = 0;
		rhicAuSorted[i] = i;
	}
	rhicLinks = new Array();
	rhicRevByWIdx = new Array();
}

function rhicStat() {
	var bcc0 = bodyContent.childNodes[0];
	var i;
	for(i=0; i<Math.min(nColAu,rhicAuSorted.length); i++) {
		var au = rhicAuName[rhicAuSorted[i]];
		if(rhicAuNWords[rhicAuSorted[i]]==0)
			break;
		if(i>0)
			bodyContent.insertBefore(document.createTextNode("; "), bcc0);
		var auLink = document.createElement("a");
		if(au.match(/^\d+\.\d+\.\d+\.\d+$/))
			auLink.setAttribute("href", "/wiki/Special:Contributions/"+au);
		else
			auLink.setAttribute("href", "/wiki/"+user+":"+au);
		auLink.setAttribute("class", "rhicAu"+i);
		auLink.appendChild(document.createTextNode(au));
		bodyContent.insertBefore(auLink, bcc0);
		bodyContent.insertBefore(document.createTextNode(" ("+rhicAuNWords[rhicAuSorted[i]]+")"), bcc0);
	}

	var nWordsOther = 0;
	for(; i<rhicAuSorted.length; i++)
		nWordsOther += rhicAuNWords[rhicAuSorted[i]];
	if(nWordsOther>0) {
		bodyContent.insertBefore(document.createTextNode("; "), bcc0);
		var auLink = document.createElement("a");
		auLink.setAttribute("href", "");
		auLink.setAttribute("class", "rhicAuX");
		auLink.appendChild(document.createTextNode(rhicOther));
		bodyContent.insertBefore(auLink, bcc0);
		bodyContent.insertBefore(document.createTextNode(" ("+nWordsOther+")"), bcc0);
	}

	var hr = document.createElement("hr");
	bodyContent.insertBefore(hr, bcc0);
}

function DJBHash(input) {
	var hash = 5381;
	for(var n=0; n<input.length; n++) {
		var c = input.charCodeAt(n);
		if (c<128)
			hash = (33*hash+c)&0xffffffff;
		else if(c<2048) {
			hash = (33*hash+((c>>6)|0xc0))&0xffffffff;
			hash = (33*hash+((c&0x3f)|0x80))&0xffffffff;
		} else if(c<65536) {
			hash = (33*hash+((c>>12)|0xe0))&0xffffffff;
			hash = (33*hash+(((c>>6)&0x3f)|0x80))&0xffffffff;
			hash = (33*hash+((c&0x3f)|0x80))&0xffffffff;
		} else {
			hash = (33*hash+((c>>18)|0xf0))&0xffffffff;
			hash = (33*hash+((c>>12)&0x3f|0x80))&0xffffffff;
			hash = (33*hash+(((c>>6)&0x3f)|0x80))&0xffffffff;
			hash = (33*hash+((c&0x3f)|0x80))&0xffffffff;
		}
	}
	return ""+
		hexLUT[(hash>>24)&0xff]+
		hexLUT[(hash>>16)&0xff]+
		hexLUT[(hash>> 8)&0xff]+
		hexLUT[hash&0xff];
}

function initHexLUT() {
	var hex = "0123456789abcdef";
	hexLUT = new Array();
	for(var i=0; i<256; i++)
		hexLUT[i] = hex.charAt((i>>4)&0xf)+hex.charAt(i&0xf);
}

function matchSequences() {
	for(var i=0; i<rhicLinks.length-lws+1; i++) {
		var seq = "";
		for(var j=0; j<lws; j++)
			seq += (j==0?"":" ")+rhicLinks[i+j].firstChild.data;
		var hash = DJBHash(seq);
		if(!(typeof rhicRev[hash] == "undefined")) {
			for(var j=0; j<lws; j++)
				if(typeof rhicRevByWIdx[i+j] == "undefined" || rhicRevByWIdx[i+j]>rhicRev[hash])
					rhicRevByWIdx[i+j] = rhicRev[hash];
		}
	}
	for(var i=0; i<rhicRevByWIdx.length-lws+1; i++)
		rhicAuNWords[rhicAu[rhicRevByWIdx[i]]]++;
	rhicAuSorted.sort(auSort);
}

function auSort(au1, au2) {
	return rhicAuNWords[au2]-rhicAuNWords[au1];
}

function extractWords(node) {
	for(var child=node.firstChild; child!=null; child=child.nextSibling) {
		if(child.nodeType==1) { // element node
			var tagName = child.tagName.toLowerCase();
			if(
				!(tagName=="table")
				&& !(tagName=="span" && child.getAttribute("class")=="editsection")
				&& !(tagName=="div" && child.getAttribute("id")=="catlinks")
				&& !(tagName=="div" && child.getAttribute("id")=="contentSub")
				&& !(tagName=="div" && child.getAttribute("class")=="NavFrame")
				&& !(tagName=="span" && child.getAttribute("class")=="rhicDontFollow")
				&& !(tagName=="sup" && child.getAttribute("class")=="reference")
				&& !(tagName=="span" && child.getAttribute("class")=="texhtml")
//				&& !(tagName=="span" && child.getAttribute("class")=="mw-headline")
			)
				extractWords(child);
		} else if(child.nodeType==3) { // text node
			child = addLinks(child);
		}
	}
}

function addLinks(textNode) {
	parent = textNode.parentNode;
	var txt = textNode.data;
	if(txt.length==0)
		return textNode;
	var lastOfNewNodes;
	var inWord=0, inCJK=0, wStart=0, wEnd=0;
	for(var i=0, lastWEnd=0; i<=txt.length; i++) {
		var c = i<txt.length?txt.charCodeAt(i):-1;
		var isAlNum =
			(c>=0x30 && c<=0x39)
			|| (c>=0x41 && c<=0x5a)
			|| (c>=0x61 && c<=0x7a)
			|| c==0xaa
			|| (c>=0xb2 && c<=0xb3)
			|| c==0xb5
			|| (c>=0xb9 && c<=0xba)
			|| (c>=0xbc && c<=0xbe)
			|| (c>=0xc0 && c<=0xd6)
			|| (c>=0xd8 && c<=0xf6)
			|| (c>=0xf8 && c<=0x2c1)
			|| (c>=0x2c6 && c<=0x2d1)
			|| (c>=0x2e0 && c<=0x2e4)
			|| c==0x2ee
			|| (c>=0x37a && c<=0x37d)
			|| c==0x386
			|| (c>=0x388 && c<=0x38a)
			|| c==0x38c
			|| (c>=0x38e && c<=0x3a1)
			|| (c>=0x3a3 && c<=0x3ce)
			|| (c>=0x3d0 && c<=0x3f5)
			|| (c>=0x3f7 && c<=0x481)
			|| (c>=0x48a && c<=0x513)
			|| (c>=0x531 && c<=0x556)
			|| c==0x559
			|| (c>=0x561 && c<=0x587)
			|| (c>=0x5d0 && c<=0x5ea)
			|| (c>=0x5f0 && c<=0x5f2)
			|| (c>=0x621 && c<=0x63a)
			|| (c>=0x640 && c<=0x64a)
			|| (c>=0x660 && c<=0x669)
			|| (c>=0x66e && c<=0x66f)
			|| (c>=0x671 && c<=0x6d3)
			|| c==0x6d5
			|| (c>=0x6e5 && c<=0x6e6)
			|| (c>=0x6ee && c<=0x6fc)
			|| c==0x6ff
			|| c==0x710
			|| (c>=0x712 && c<=0x72f)
			|| (c>=0x74d && c<=0x76d)
			|| (c>=0x780 && c<=0x7a5)
			|| c==0x7b1
			|| (c>=0x7c0 && c<=0x7ea)
			|| (c>=0x7f4 && c<=0x7f5)
			|| c==0x7fa
			|| (c>=0x904 && c<=0x939)
			|| c==0x93d
			|| c==0x950
			|| (c>=0x958 && c<=0x961)
			|| (c>=0x966 && c<=0x96f)
			|| (c>=0x97b && c<=0x97f)
			|| (c>=0x985 && c<=0x98c)
			|| (c>=0x98f && c<=0x990)
			|| (c>=0x993 && c<=0x9a8)
			|| (c>=0x9aa && c<=0x9b0)
			|| c==0x9b2
			|| (c>=0x9b6 && c<=0x9b9)
			|| c==0x9bd
			|| c==0x9ce
			|| (c>=0x9dc && c<=0x9dd)
			|| (c>=0x9df && c<=0x9e1)
			|| (c>=0x9e6 && c<=0x9f1)
			|| (c>=0x9f4 && c<=0x9f9)
			|| (c>=0xa05 && c<=0xa0a)
			|| (c>=0xa0f && c<=0xa10)
			|| (c>=0xa13 && c<=0xa28)
			|| (c>=0xa2a && c<=0xa30)
			|| (c>=0xa32 && c<=0xa33)
			|| (c>=0xa35 && c<=0xa36)
			|| (c>=0xa38 && c<=0xa39)
			|| (c>=0xa59 && c<=0xa5c)
			|| c==0xa5e
			|| (c>=0xa66 && c<=0xa6f)
			|| (c>=0xa72 && c<=0xa74)
			|| (c>=0xa85 && c<=0xa8d)
			|| (c>=0xa8f && c<=0xa91)
			|| (c>=0xa93 && c<=0xaa8)
			|| (c>=0xaaa && c<=0xab0)
			|| (c>=0xab2 && c<=0xab3)
			|| (c>=0xab5 && c<=0xab9)
			|| c==0xabd
			|| c==0xad0
			|| (c>=0xae0 && c<=0xae1)
			|| (c>=0xae6 && c<=0xaef)
			|| (c>=0xb05 && c<=0xb0c)
			|| (c>=0xb0f && c<=0xb10)
			|| (c>=0xb13 && c<=0xb28)
			|| (c>=0xb2a && c<=0xb30)
			|| (c>=0xb32 && c<=0xb33)
			|| (c>=0xb35 && c<=0xb39)
			|| c==0xb3d
			|| (c>=0xb5c && c<=0xb5d)
			|| (c>=0xb5f && c<=0xb61)
			|| (c>=0xb66 && c<=0xb6f)
			|| c==0xb71
			|| c==0xb83
			|| (c>=0xb85 && c<=0xb8a)
			|| (c>=0xb8e && c<=0xb90)
			|| (c>=0xb92 && c<=0xb95)
			|| (c>=0xb99 && c<=0xb9a)
			|| c==0xb9c
			|| (c>=0xb9e && c<=0xb9f)
			|| (c>=0xba3 && c<=0xba4)
			|| (c>=0xba8 && c<=0xbaa)
			|| (c>=0xbae && c<=0xbb9)
			|| (c>=0xbe6 && c<=0xbf2)
			|| (c>=0xc05 && c<=0xc0c)
			|| (c>=0xc0e && c<=0xc10)
			|| (c>=0xc12 && c<=0xc28)
			|| (c>=0xc2a && c<=0xc33)
			|| (c>=0xc35 && c<=0xc39)
			|| (c>=0xc60 && c<=0xc61)
			|| (c>=0xc66 && c<=0xc6f)
			|| (c>=0xc85 && c<=0xc8c)
			|| (c>=0xc8e && c<=0xc90)
			|| (c>=0xc92 && c<=0xca8)
			|| (c>=0xcaa && c<=0xcb3)
			|| (c>=0xcb5 && c<=0xcb9)
			|| c==0xcbd
			|| c==0xcde
			|| (c>=0xce0 && c<=0xce1)
			|| (c>=0xce6 && c<=0xcef)
			|| (c>=0xd05 && c<=0xd0c)
			|| (c>=0xd0e && c<=0xd10)
			|| (c>=0xd12 && c<=0xd28)
			|| (c>=0xd2a && c<=0xd39)
			|| (c>=0xd60 && c<=0xd61)
			|| (c>=0xd66 && c<=0xd6f)
			|| (c>=0xd85 && c<=0xd96)
			|| (c>=0xd9a && c<=0xdb1)
			|| (c>=0xdb3 && c<=0xdbb)
			|| c==0xdbd
			|| (c>=0xdc0 && c<=0xdc6)
			|| (c>=0xe01 && c<=0xe30)
			|| (c>=0xe32 && c<=0xe33)
			|| (c>=0xe40 && c<=0xe46)
			|| (c>=0xe50 && c<=0xe59)
			|| (c>=0xe81 && c<=0xe82)
			|| c==0xe84
			|| (c>=0xe87 && c<=0xe88)
			|| c==0xe8a
			|| c==0xe8d
			|| (c>=0xe94 && c<=0xe97)
			|| (c>=0xe99 && c<=0xe9f)
			|| (c>=0xea1 && c<=0xea3)
			|| c==0xea5
			|| c==0xea7
			|| (c>=0xeaa && c<=0xeab)
			|| (c>=0xead && c<=0xeb0)
			|| (c>=0xeb2 && c<=0xeb3)
			|| c==0xebd
			|| (c>=0xec0 && c<=0xec4)
			|| c==0xec6
			|| (c>=0xed0 && c<=0xed9)
			|| (c>=0xedc && c<=0xedd)
			|| c==0xf00
			|| (c>=0xf20 && c<=0xf33)
			|| (c>=0xf40 && c<=0xf47)
			|| (c>=0xf49 && c<=0xf6a)
			|| (c>=0xf88 && c<=0xf8b)
			|| (c>=0x1000 && c<=0x1021)
			|| (c>=0x1023 && c<=0x1027)
			|| (c>=0x1029 && c<=0x102a)
			|| (c>=0x1040 && c<=0x1049)
			|| (c>=0x1050 && c<=0x1055)
			|| (c>=0x10a0 && c<=0x10c5)
			|| (c>=0x10d0 && c<=0x10fa)
			|| c==0x10fc
			|| (c>=0x1100 && c<=0x1159)
			|| (c>=0x115f && c<=0x11a2)
			|| (c>=0x11a8 && c<=0x11f9)
			|| (c>=0x1200 && c<=0x1248)
			|| (c>=0x124a && c<=0x124d)
			|| (c>=0x1250 && c<=0x1256)
			|| c==0x1258
			|| (c>=0x125a && c<=0x125d)
			|| (c>=0x1260 && c<=0x1288)
			|| (c>=0x128a && c<=0x128d)
			|| (c>=0x1290 && c<=0x12b0)
			|| (c>=0x12b2 && c<=0x12b5)
			|| (c>=0x12b8 && c<=0x12be)
			|| c==0x12c0
			|| (c>=0x12c2 && c<=0x12c5)
			|| (c>=0x12c8 && c<=0x12d6)
			|| (c>=0x12d8 && c<=0x1310)
			|| (c>=0x1312 && c<=0x1315)
			|| (c>=0x1318 && c<=0x135a)
			|| (c>=0x1369 && c<=0x137c)
			|| (c>=0x1380 && c<=0x138f)
			|| (c>=0x13a0 && c<=0x13f4)
			|| (c>=0x1401 && c<=0x166c)
			|| (c>=0x166f && c<=0x1676)
			|| (c>=0x1681 && c<=0x169a)
			|| (c>=0x16a0 && c<=0x16ea)
			|| (c>=0x16ee && c<=0x16f0)
			|| (c>=0x1700 && c<=0x170c)
			|| (c>=0x170e && c<=0x1711)
			|| (c>=0x1720 && c<=0x1731)
			|| (c>=0x1740 && c<=0x1751)
			|| (c>=0x1760 && c<=0x176c)
			|| (c>=0x176e && c<=0x1770)
			|| (c>=0x1780 && c<=0x17b3)
			|| c==0x17d7
			|| c==0x17dc
			|| (c>=0x17e0 && c<=0x17e9)
			|| (c>=0x17f0 && c<=0x17f9)
			|| (c>=0x1810 && c<=0x1819)
			|| (c>=0x1820 && c<=0x1877)
			|| (c>=0x1880 && c<=0x18a8)
			|| (c>=0x1900 && c<=0x191c)
			|| (c>=0x1946 && c<=0x196d)
			|| (c>=0x1970 && c<=0x1974)
			|| (c>=0x1980 && c<=0x19a9)
			|| (c>=0x19c1 && c<=0x19c7)
			|| (c>=0x19d0 && c<=0x19d9)
			|| (c>=0x1a00 && c<=0x1a16)
			|| (c>=0x1b05 && c<=0x1b33)
			|| (c>=0x1b45 && c<=0x1b4b)
			|| (c>=0x1b50 && c<=0x1b59)
			|| (c>=0x1d00 && c<=0x1dbf)
			|| (c>=0x1e00 && c<=0x1e9b)
			|| (c>=0x1ea0 && c<=0x1ef9)
			|| (c>=0x1f00 && c<=0x1f15)
			|| (c>=0x1f18 && c<=0x1f1d)
			|| (c>=0x1f20 && c<=0x1f45)
			|| (c>=0x1f48 && c<=0x1f4d)
			|| (c>=0x1f50 && c<=0x1f57)
			|| c==0x1f59
			|| c==0x1f5b
			|| c==0x1f5d
			|| (c>=0x1f5f && c<=0x1f7d)
			|| (c>=0x1f80 && c<=0x1fb4)
			|| (c>=0x1fb6 && c<=0x1fbc)
			|| c==0x1fbe
			|| (c>=0x1fc2 && c<=0x1fc4)
			|| (c>=0x1fc6 && c<=0x1fcc)
			|| (c>=0x1fd0 && c<=0x1fd3)
			|| (c>=0x1fd6 && c<=0x1fdb)
			|| (c>=0x1fe0 && c<=0x1fec)
			|| (c>=0x1ff2 && c<=0x1ff4)
			|| (c>=0x1ff6 && c<=0x1ffc)
			|| (c>=0x2070 && c<=0x2071)
			|| (c>=0x2074 && c<=0x2079)
			|| (c>=0x207f && c<=0x2089)
			|| (c>=0x2090 && c<=0x2094)
			|| c==0x2102
			|| c==0x2107
			|| (c>=0x210a && c<=0x2113)
			|| c==0x2115
			|| (c>=0x2119 && c<=0x211d)
			|| c==0x2124
			|| c==0x2126
			|| c==0x2128
			|| (c>=0x212a && c<=0x212d)
			|| (c>=0x212f && c<=0x2139)
			|| (c>=0x213c && c<=0x213f)
			|| (c>=0x2145 && c<=0x2149)
			|| c==0x214e
			|| (c>=0x2153 && c<=0x2184)
			|| (c>=0x2460 && c<=0x249b)
			|| (c>=0x24ea && c<=0x24ff)
			|| (c>=0x2776 && c<=0x2793)
			|| (c>=0x2c00 && c<=0x2c2e)
			|| (c>=0x2c30 && c<=0x2c5e)
			|| (c>=0x2c60 && c<=0x2c6c)
			|| (c>=0x2c74 && c<=0x2c77)
			|| (c>=0x2c80 && c<=0x2ce4)
			|| c==0x2cfd
			|| (c>=0x2d00 && c<=0x2d25)
			|| (c>=0x2d30 && c<=0x2d65)
			|| c==0x2d6f
			|| (c>=0x2d80 && c<=0x2d96)
			|| (c>=0x2da0 && c<=0x2da6)
			|| (c>=0x2da8 && c<=0x2dae)
			|| (c>=0x2db0 && c<=0x2db6)
			|| (c>=0x2db8 && c<=0x2dbe)
			|| (c>=0x2dc0 && c<=0x2dc6)
			|| (c>=0x2dc8 && c<=0x2dce)
			|| (c>=0x2dd0 && c<=0x2dd6)
			|| (c>=0x2dd8 && c<=0x2dde)
			|| (c>=0x3005 && c<=0x3007)
			|| (c>=0x3021 && c<=0x3029)
			|| (c>=0x3031 && c<=0x3035)
			|| (c>=0x3038 && c<=0x303c)
			|| (c>=0x3041 && c<=0x3096)
			|| (c>=0x309d && c<=0x309f)
			|| (c>=0x30a1 && c<=0x30fa)
			|| (c>=0x30fc && c<=0x30ff)
			|| (c>=0x3105 && c<=0x312c)
			|| (c>=0x3131 && c<=0x318e)
			|| (c>=0x3192 && c<=0x3195)
			|| (c>=0x31a0 && c<=0x31b7)
			|| (c>=0x31f0 && c<=0x31ff)
			|| (c>=0x3220 && c<=0x3229)
			|| (c>=0x3251 && c<=0x325f)
			|| (c>=0x3280 && c<=0x3289)
			|| (c>=0x32b1 && c<=0x32bf)
			|| (c>=0xa000 && c<=0xa48c)
			|| (c>=0xa717 && c<=0xa71a)
			|| (c>=0xa800 && c<=0xa801)
			|| (c>=0xa803 && c<=0xa805)
			|| (c>=0xa807 && c<=0xa80a)
			|| (c>=0xa80c && c<=0xa822)
			|| (c>=0xa840 && c<=0xa873)
			|| (c>=0xac00 && c<=0xd7a3)
			|| (c>=0xfb00 && c<=0xfb06)
			|| (c>=0xfb13 && c<=0xfb17)
			|| c==0xfb1d
			|| (c>=0xfb1f && c<=0xfb28)
			|| (c>=0xfb2a && c<=0xfb36)
			|| (c>=0xfb38 && c<=0xfb3c)
			|| c==0xfb3e
			|| (c>=0xfb40 && c<=0xfb41)
			|| (c>=0xfb43 && c<=0xfb44)
			|| (c>=0xfb46 && c<=0xfbb1)
			|| (c>=0xfbd3 && c<=0xfd3d)
			|| (c>=0xfd50 && c<=0xfd8f)
			|| (c>=0xfd92 && c<=0xfdc7)
			|| (c>=0xfdf0 && c<=0xfdfb)
			|| (c>=0xfe70 && c<=0xfe74)
			|| (c>=0xfe76 && c<=0xfefc)
			|| (c>=0xff10 && c<=0xff19)
			|| (c>=0xff21 && c<=0xff3a)
			|| (c>=0xff41 && c<=0xff5a)
			|| (c>=0xff66 && c<=0xffbe)
			|| (c>=0xffc2 && c<=0xffc7)
			|| (c>=0xffca && c<=0xffcf)
			|| (c>=0xffd2 && c<=0xffd7)
			|| (c>=0xffda && c<=0xffdc)
			|| (c>=0x10000 && c<=0x1000b)
			|| (c>=0x1000d && c<=0x10026)
			|| (c>=0x10028 && c<=0x1003a)
			|| (c>=0x1003c && c<=0x1003d)
			|| (c>=0x1003f && c<=0x1004d)
			|| (c>=0x10050 && c<=0x1005d)
			|| (c>=0x10080 && c<=0x100fa)
			|| (c>=0x10107 && c<=0x10133)
			|| (c>=0x10140 && c<=0x10178)
			|| c==0x1018a
			|| (c>=0x10300 && c<=0x1031e)
			|| (c>=0x10320 && c<=0x10323)
			|| (c>=0x10330 && c<=0x1034a)
			|| (c>=0x10380 && c<=0x1039d)
			|| (c>=0x103a0 && c<=0x103c3)
			|| (c>=0x103c8 && c<=0x103cf)
			|| (c>=0x103d1 && c<=0x103d5)
			|| (c>=0x10400 && c<=0x1049d)
			|| (c>=0x104a0 && c<=0x104a9)
			|| (c>=0x10800 && c<=0x10805)
			|| c==0x10808
			|| (c>=0x1080a && c<=0x10835)
			|| (c>=0x10837 && c<=0x10838)
			|| c==0x1083c
			|| c==0x1083f
			|| (c>=0x10900 && c<=0x10919)
			|| c==0x10a00
			|| (c>=0x10a10 && c<=0x10a13)
			|| (c>=0x10a15 && c<=0x10a17)
			|| (c>=0x10a19 && c<=0x10a33)
			|| (c>=0x10a40 && c<=0x10a47)
			|| (c>=0x12000 && c<=0x1236e)
			|| (c>=0x12400 && c<=0x12462)
			|| (c>=0x1d360 && c<=0x1d371)
			|| (c>=0x1d400 && c<=0x1d454)
			|| (c>=0x1d456 && c<=0x1d49c)
			|| (c>=0x1d49e && c<=0x1d49f)
			|| c==0x1d4a2
			|| (c>=0x1d4a5 && c<=0x1d4a6)
			|| (c>=0x1d4a9 && c<=0x1d4ac)
			|| (c>=0x1d4ae && c<=0x1d4b9)
			|| c==0x1d4bb
			|| (c>=0x1d4bd && c<=0x1d4c3)
			|| (c>=0x1d4c5 && c<=0x1d505)
			|| (c>=0x1d507 && c<=0x1d50a)
			|| (c>=0x1d50d && c<=0x1d514)
			|| (c>=0x1d516 && c<=0x1d51c)
			|| (c>=0x1d51e && c<=0x1d539)
			|| (c>=0x1d53b && c<=0x1d53e)
			|| (c>=0x1d540 && c<=0x1d544)
			|| c==0x1d546
			|| (c>=0x1d54a && c<=0x1d550)
			|| (c>=0x1d552 && c<=0x1d6a5)
			|| (c>=0x1d6a8 && c<=0x1d6c0)
			|| (c>=0x1d6c2 && c<=0x1d6da)
			|| (c>=0x1d6dc && c<=0x1d6fa)
			|| (c>=0x1d6fc && c<=0x1d714)
			|| (c>=0x1d716 && c<=0x1d734)
			|| (c>=0x1d736 && c<=0x1d74e)
			|| (c>=0x1d750 && c<=0x1d76e)
			|| (c>=0x1d770 && c<=0x1d788)
			|| (c>=0x1d78a && c<=0x1d7a8)
			|| (c>=0x1d7aa && c<=0x1d7c2)
			|| (c>=0x1d7c4 && c<=0x1d7cb)
			|| (c>=0x1d7ce && c<=0x1d7ff);
		var isCJK =
			(c>=0x2e80 && c<=0x2e99)
			|| (c>=0x2e9b && c<=0x2ef3)
			|| (c>=0x31c0 && c<=0x31cf)
			|| (c>=0x3400 && c<=0x4db5)
			|| (c>=0x4e00 && c<=0x9fbb)
			|| (c>=0xf900 && c<=0xfa2d)
			|| (c>=0xfa30 && c<=0xfa6a)
			|| (c>=0xfa70 && c<=0xfad9)
			|| (c>=0x20000 && c<=0x2a6d6)
			|| (c>=0x2f800 && c<=0x2fa1d);
		var newWord = 0;
 		if(inCJK) {
 			wEnd=i;
 			inCJK=0;
 			newWord=1;
 		} else if(inWord && !isAlNum) {
 			wEnd=i;
 			inWord=0;
 			newWord=1;
 		}
		if(newWord) {
			if(wStart>lastWEnd) {
				var textNodeTmp = document.createTextNode(txt.substring(lastWEnd, wStart));
				parent.insertBefore(textNodeTmp, textNode);
			}
			var wordTxt = document.createTextNode(txt.substring(wStart, wEnd));
			var wordLink = document.createElement("a");
			wordLink.appendChild(wordTxt);
			parent.insertBefore(wordLink, textNode);
			rhicLinks[rhicLinks.length] = wordLink;
			lastOfNewNodes = wordLink;
			inWord=0;
			lastWEnd=wEnd;
		}
		if(isCJK) {
			wStart = i;
			inCJK=1;
		} else if(isAlNum && !inWord) {
			wStart = i;
			inWord=1;
		}
	}
	if(lastWEnd<txt.length) {
		var textNodeTmp = document.createTextNode(txt.substring(lastWEnd, txt.length));
		parent.insertBefore(textNodeTmp, textNode);
		lastOfNewNodes = textNodeTmp;
	}
	parent.removeChild(textNode);
	return lastOfNewNodes;
}

function markWords() {
	for(var i=0; i<rhicLinks.length; i++) {
		var link = rhicLinks[i];
		if(typeof rhicRevByWIdx[i] == "undefined") {
			link.setAttribute("href", "/w/index.php?title="+pageEnc+"&oldid="+
				rhicNewestRev+"&diff");
			link.setAttribute("title", rhicNewSince+' '+rhicNewestTi);
			link.setAttribute("class", "rhicAuU");
		} else {
			link.setAttribute("href", "/w/index.php?title="+pageEnc+"&oldid="+
				rhicRevOrig[rhicRevByWIdx[i]]+"&diff=prev");
			link.setAttribute("title", rhicAuName[rhicAu[rhicRevByWIdx[i]]]+', '+
				rhicTi[rhicRevByWIdx[i]]);
			if(rhicRequest=="Au") {
				var auClass = "rhicAuX";
				for(var j=0; j<nColAu; j++)
					if(rhicAu[rhicRevByWIdx[i]]==rhicAuSorted[j])
						auClass = "rhicAu"+j;
				link.setAttribute("class", auClass);
			} else if(rhicRequest=="Ti") {
				link.setAttribute("style", rhicTiColor[rhicRevByWIdx[i]]);
			}
		}
	}
}

function removeLinks(node) {
	for(var child=node.firstChild; child!=null; child=child==null?node.firstChild:child.nextSibling) {
		if(child.nodeType==1) { // element node
			var tagName = child.tagName.toLowerCase();
			if(tagName=="a" && child.getAttribute("href")!=null) {
				child = removeLink(node, child);
			} else if(
					!(tagName=="table")
					&& !(tagName=="span" && child.getAttribute("class")=="editsection")
					&& !(tagName=="div" && child.getAttribute("id")=="catlinks")
					&& !(tagName=="div" && child.getAttribute("id")=="contentSub")
					&& !(tagName=="div" && child.getAttribute("class")=="NavFrame")
					&& !(tagName=="sup" && child.getAttribute("class")=="reference")
					&& !(tagName=="span" && child.getAttribute("class")=="texhtml")
//					&& !(tagName=="span" && child.getAttribute("class")=="mw-headline")

				) {
				removeLinks(child);
			}
		}
	}
}

function removeLink(node, child) {
	var newChild = null;
	if(child.getAttribute("class")=="external text") {
		newChild = document.createElement("span");
		newChild.setAttribute("class", "rhicDontFollow");
		for(var j=0; j<child.childNodes.length; j++) {
			var grandChild = child.childNodes[j];
			if(grandChild.nodeType!=2) // not an attribute
				newChild.appendChild(grandChild);
		}
		node.insertBefore(newChild, child);
	} else {
		for(var j=0; j<child.childNodes.length; j++) {
			var grandChild = child.childNodes[j];
			if(grandChild.nodeType!=2) // not an attribute
				node.insertBefore(grandChild, child);
		}
		newChild = child.previousSibling;
	}
	node.removeChild(child);
	return newChild;
}

function rhicReset() {
	if(typeof originalBodyContent != 'undefined') {
		content = document.getElementById('content');
		content.replaceChild(originalBodyContent, bodyContent);
		bodyContent = originalBodyContent;
	}
}

// funktioniert nur in de: aOnloadFunctions[aOnloadFunctions.length] = initRhic;
$(initRhic);