User:Gerbrant/edit/linksInDiff.js

hookEvent("load", function {	var d = document.getElementById("wikiDiff"), i, t;	if(!d && document.getElementById("difference"))		d = document.getElementById("bodyContent");	if(d)	{		d = d.getElementsByTagName("TABLE").item(0);		if(d && d.className == "diff")		{			d = d.getElementsByTagName("TD");			for(i = 0; i < d.length; i++)			{				t = d.item(i);				switch(t.className)				{				case "diff-context":				case "diff-deletedline":				case "diff-addedline":					t.innerHTML = t.innerHTML.replace(/\[\[((.*?)(?:\|.*?)?)\]\]/g,	function(a, b, p)					{ var h = /<[^>]*>/g; var o = ''; var c = ''; return "" + o + b.replace(h, c + "[[" + o + b.replace(h, c + "$&" + o) + c + "]]" + o) + c + ""; });				}			}		}	} });