User:Emojiwiki/module/SubstMyPage.js
外观
< User:Emojiwiki | module
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google Chrome、Firefox、Microsoft Edge及Safari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
// Special:MyPage Substitution tool
// Substitute Special:MyPage Links to their username
// Suitable for slow internet connections
(function() {
let SMP_log = (function(t) {
console.log("[SubstMyPage] " + t);
});
var uname = mw.config.get("wgUserName");
if (uname == null) {
SMP_log("Not logged in, interrupt!");
return;
}
var upage = "User:" + uname;
var r = /^\/wiki\/Special:%E6%88%91%E7%9A%84%E7%94%A8%E6%88%B7%E9%A1%B5/i;
$( "a" ).each(function() {
var href = $( this ).attr('href');
if (href != undefined) {
$( this ).attr('href',href.replace(r,"/wiki/User:" + uname));
}
});
})();