User:Earthengine/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:Earthengine/monobook.css. |
//<div><pre><nowiki>
//document.write(location);
if(getserver(location)=="secure.wikimedia.org")
setTimeout("aaa()",1000);
function aaa() {
for(i=0;i<document.links.length;++i)
{
with(document.links[i]) {
var url=geturl(href,location);
if(innerHTML==href)
innerHTML=url;
href=url;
}
}
}
function geturl(href,loc) {
var domain=getpath1(loc);
var host=getpath2(loc);
var h=new String(href);
if(h==hrefstart(h))
{
var url;
var server=getserver(href);
if(server=="secure.wikimedia.org") {
if(getpath1(h)!=domain || getpath2(h)!=host)
url="https://secure.wikimedia.org/"+domain+"/"+host+"/"+getpath(h);
else return h;
}
else
url=update(h);
return url;
}
else
return "/"+domain+"/"+host+h;
}
function hrefstart(url) {
var ret=new String(url);
var start=/^(\/)(.*)/;
return ret.replace(start,"$2");
}
function getpath1(url) {
var ret=new String(url);
var path1=/^([A-Za-z0-9_]+):\/\/([^\/]*)\/([^\/]*)\/(.*)/;
var tmp=new String(url);
ret=ret.replace(path1,"$3");
if(ret==tmp) {
return ret.replace(/^([A-Za-z0-9_]+):\/\/([^\/]*)\/(.*)/,"$3");
}
return ret;
}
function getpath2(url) {
var ret=new String(url);
var path2=/^([A-Za-z0-9_]+):\/\/([^\/]*)\/([^\/]*)\/([^\/]*)\/(.*)/;
var tmp=new String(url);
ret=ret.replace(path2,"$4");
if(ret==tmp){
return ret.replace(/^([A-Za-z0-9_]+):\/\/([^\/]*)\/([^\/]*)\/(.*)/,"$4");
};
return ret;
}
function getpath(url) {
var ret=new String(url);
var path3=/^([A-Za-z0-9_]+):\/\/([^\/]*)\/(.*)/;
return ret.replace(path3,"$3");
}
function update(url) {
var ret=new String(url);
var ud=/^http:\/\/([^\.\/]*).(wikimedia|wikipedia|wiktionary|wikibooks|wikiquote|wikisource|wikinews).org\/(.*)/;
return ret.replace(ud,"https://secure.wikimedia.org/$2/$1/$3");
}
function getserver(url) {
var ret=new String(url);
var server=/^([A-Za-z0-9_]+):\/\/([^\/]*)\/(.*)/;
return ret.replace(server,"$2");
}//</nowiki></pre></div>