User:Jclemens/monobook.js
Jump to navigation
Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
The accompanying .css page for this skin can be added at User:Jclemens/monobook.css. |
addOnloadHook(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;
}
}
});