MediaWiki:Gadget-avatar.js:修订间差异
跳转到导航
跳转到搜索
(// Edit via Wikiplus) |
小无编辑摘要 |
||
(未显示另一用户的1个中间版本) | |||
第1行: | 第1行: | ||
$(function(){ |
$(function(){ |
||
⚫ | |||
var img = $("<img>").attr( |
|||
"src", |
"src", |
||
mw.config.get("wgScriptPath") + |
mw.config.get("wgScriptPath") + |
||
第8行: | 第10行: | ||
.attr("href", mw.util.getUrl("Special:UploadAvatar")) |
.attr("href", mw.util.getUrl("Special:UploadAvatar")) |
||
.append(img); |
.append(img); |
||
⚫ | |||
if (!document.body.classList.contains("skin-vector-legacy")) { |
if (!document.body.classList.contains("skin-vector-legacy")) { |
||
$("#pt-userpage-2").before($('<li id="pt-avatar"></li>').append(link)); |
$("#pt-userpage-2").before($('<li id="pt-avatar"></li>').append(link)); |
||
第27行: | 第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')
)
);
});
});