User:AoV2/interwiki stuff.js

importScript("User:AoV2/parsertricks.js"); importScript("User:AoV2/mkredir.js");

function interwiki_stuff{ appendCSS("#p-lang a { font-family:monospace; }\n#p-lang li { font-size:smaller; }\n"); e = document.getElementById("p-lang"); if(!e) return; li = e.getElementsByTagName("li"); for(i = 0; i < li.length; i++){ a = li[i].getElementsByTagName("a")[0]; title = decodeURIComponent(a.href.split("/wiki/")[1]).replace(/_/g, " "); a.title = a.innerHTML; a.innerHTML = li[i].className.replace(/^[^\-]+\-/, ""); li[i].innerHTML = parsertricks.wlink(title, wgContentLanguage) + "|" + li[i].innerHTML + ": " + title; if(i % 20 == 0) parsertricks.refresh; }	parsertricks.refresh; setTimeout("append_mkredir;", 5000); // msec } addOnloadHook(interwiki_stuff);

function append_mkredir{ a = document.getElementById("p-lang").getElementsByTagName("a"); for(i = 0; i < a.length; i++) if(a[i].className.match(/\bnew\b/)) a[i].href += "&mkredir=" + encodeURIComponent(mw.config.get('wgPageName')); }