MediaWiki:Gadget-avatar.js:修订间差异
跳转到导航
跳转到搜索
(// Edit via Wikiplus) |
小无编辑摘要 |
||
第28行: | 第28行: | ||
) |
) |
||
); |
); |
||
}); |
|||
$(".context-userlink").each(function (_, item) { |
|||
item = $(item); |
|||
item.prepend( |
|||
$("<img/>") |
|||
.addClass("userlink-avatar") |
|||
.attr( |
|||
"src", |
|||
mw.config.get("wgScriptPath") + |
|||
"/index.php?title=Special:Avatar&wpUsername=" + |
|||
item.attr('data-u') |
|||
) |
|||
); |
|||
}); |
|||
}); |
2024年1月25日 (四) 15:50的最新版本
$(function(){
if (!mw.user.isAnon()) {
var img = $("<img>").attr(
"src",
mw.config.get("wgScriptPath") +
"/index.php?title=Special:Avatar&wpUsername=" +
mw.user.id()
).attr("width",28).attr("height",28);
var link = $("<a>")
.attr("href", mw.util.getUrl("Special:UploadAvatar"))
.append(img);
if (!document.body.classList.contains("skin-vector-legacy")) {
$("#pt-userpage-2").before($('<li id="pt-avatar"></li>').append(link));
} else {
$("#pt-userpage").before($('<li id="pt-avatar"></li>').append(link));
}
}
$(".mw-userlink").each(function (_, item) {
item = $(item);
item.prepend(
$("<img/>")
.addClass("userlink-avatar")
.attr(
"src",
mw.config.get("wgScriptPath") +
"/index.php?title=Special:Avatar&wpUsername=" +
item.text()
)
);
});
$(".context-userlink").each(function (_, item) {
item = $(item);
item.prepend(
$("<img/>")
.addClass("userlink-avatar")
.attr(
"src",
mw.config.get("wgScriptPath") +
"/index.php?title=Special:Avatar&wpUsername=" +
item.attr('data-u')
)
);
});
});