“MediaWiki:Gadget-ShowAvatar.js”的版本间的差异
星海-interfacebot(讨论 | 贡献) (跨站同步) (1个标签:Bot) |
(本地化) |
||
第9行: | 第9行: | ||
"use strict"; | "use strict"; | ||
$(function () { | $(function () { | ||
− | var commonsUrl = new mw.Uri("".concat(mw.config.get("wgServer").replace(" | + | var commonsUrl = new mw.Uri("".concat(mw.config.get("wgServer").replace("lbirary.moegirl", "commons.moegirl")).concat(mw.config.get("wgScriptPath"), "/")); |
commonsUrl.query.user = mw.config.get("wgPageName").replace(/^user:/i, ""); | commonsUrl.query.user = mw.config.get("wgPageName").replace(/^user:/i, ""); | ||
commonsUrl.path = "/extensions/Avatar/avatar.php"; | commonsUrl.path = "/extensions/Avatar/avatar.php"; | ||
第15行: | 第15行: | ||
imgUrl.query.user = mw.config.get("wgUserName"); | imgUrl.query.user = mw.config.get("wgUserName"); | ||
var img = $("<img>").attr("src", imgUrl); | var img = $("<img>").attr("src", imgUrl); | ||
− | var link = $("<a>").attr("href", "".concat(mw.config.get("wgServer").replace(" | + | var link = $("<a>").attr("href", "".concat(mw.config.get("wgServer").replace("lbirary.moegirl", "commons.moegirl"), "/Special:UploadAvatar")).append(img); |
$("#pt-userpage").before($('<li id="pt-avatar"></li>').append(link)); | $("#pt-userpage").before($('<li id="pt-avatar"></li>').append(link)); | ||
if (mw.config.get("wgNamespaceNumber") === 2 && !mw.config.get("wgPageName").includes("/")) { | if (mw.config.get("wgNamespaceNumber") === 2 && !mw.config.get("wgPageName").includes("/")) { |
2022年11月30日 (三) 17:25的版本
/* <pre> */ /** * ------------------------------------------------------------------------- * !!! DON'T MODIFY THIS PAGE MANUALLY, YOUR CHANGES WILL BE OVERWRITTEN !!! * ------------------------------------------------------------------------- */ var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/ShowAvatar/MediaWiki:Gadget-ShowAvatar.js|user=[[U:AnnAngela]]|longId=b660181c119c561ff763bc1ed249eaa2325fafeb|shortId=b660181|message=gadget s-t}}'; "use strict"; $(function () { var commonsUrl = new mw.Uri("".concat(mw.config.get("wgServer").replace("lbirary.moegirl", "commons.moegirl")).concat(mw.config.get("wgScriptPath"), "/")); commonsUrl.query.user = mw.config.get("wgPageName").replace(/^user:/i, ""); commonsUrl.path = "/extensions/Avatar/avatar.php"; var imgUrl = new mw.Uri(commonsUrl); imgUrl.query.user = mw.config.get("wgUserName"); var img = $("<img>").attr("src", imgUrl); var link = $("<a>").attr("href", "".concat(mw.config.get("wgServer").replace("lbirary.moegirl", "commons.moegirl"), "/Special:UploadAvatar")).append(img); $("#pt-userpage").before($('<li id="pt-avatar"></li>').append(link)); if (mw.config.get("wgNamespaceNumber") === 2 && !mw.config.get("wgPageName").includes("/")) { var hrefUrl = new mw.Uri(commonsUrl); hrefUrl.path = "/Special:Viewavatar"; var srcUrl = new mw.Uri(commonsUrl); $(".ns-2 #firstHeading").prepend($("<a/>").attr({ href: hrefUrl, title: "查看头像" }).prepend($("<img/>").attr("src", srcUrl).css({ width: "1.2em", height: "1.2em", "border-radius": "10px", padding: "4px" }))); } }); /* </pre> */