User:Jclemens/monobook.js

$(function {	if (wgServer != 'https://secure.wikimedia.org') return;	var re = /^http\:\/\/(.*?)\.wik(ipedia|isource|ktionary|ispecies|iquote|ibooks|imedia|inews|iversity)\.org(\/.*?)$/;       var remw = /^http\:\/\/(www\.)?mediawiki.org(\/.*?)$/;	var links = document.getElementsByTagName('a');	for (var i = links.length; i--;) {		var link = links[i];		if (matches = link.href.match(re)) {			if (matches[1] == 'mail') continue;			if (matches[1] == 'lists') continue;                        if (matches[1] == 'upload') continue;			if (matches[3] == '/') matches[3] = '/wiki/';			if (matches[1] == 'meta') {                                var n = 'https://secure.wikimedia.org/wikipedia/meta' + matches[3];                        } else {                                if (matches[1] == 'commons') {                                        var n = 'https://secure.wikimedia.org/wikipedia/commons' + matches[3]; } else { var n = 'https://secure.wikimedia.org/wik' + matches[2] + '/' + matches[1] + matches[3]; }                       }			link.href = n; link.title = n;			if (link.innerHTML.match(re)) link.innerHTML = n;                        continue; }               if (matches = link.href.match(remw)) { var n = 'https://secure.wikimedia.org/wikipedia/mediawiki' + matches[2]; link.href = n; link.title = n;                       if (link.innerHTML.match(remw)) link.innerHTML = n;                } } });