“MediaWiki:Gadget-ShowAvatar.js”的版本间的差异
小 (修正笔误) |
|||
第5行: | 第5行: | ||
* ------------------------------------------------------------------------- | * ------------------------------------------------------------------------- | ||
*/ | */ | ||
− | var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/ShowAvatar/MediaWiki:Gadget-ShowAvatar.js|user=[[U: | + | var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/ShowAvatar/MediaWiki:Gadget-ShowAvatar.js|user=[[U:屠麟傲血]]|longId=4b1de2510314971dbb478c813a2e0000189d2dd2|shortId=4b1de25|message=fix: showavatar styles and upload title (#71)}}'; |
"use strict"; | "use strict"; | ||
$(function () { | $(function () { | ||
− | var commonsUrl = new mw.Uri(" | + | var commonsUrl = new mw.Uri("https://commons.moegirl.org.cn/"); |
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"; | ||
var imgUrl = new mw.Uri(commonsUrl); | var imgUrl = new mw.Uri(commonsUrl); | ||
imgUrl.query.user = mw.config.get("wgUserName"); | imgUrl.query.user = mw.config.get("wgUserName"); | ||
− | var img = $("<img>").attr(" | + | var img = $("<img>").attr({ |
− | var link = $("<a>").attr("href", " | + | src: imgUrl, |
+ | title: "上传头像" | ||
+ | }); | ||
+ | var link = $("<a>").attr("href", "https://commons.moegirl.org.cn/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年12月18日 (日) 18:08的最新版本
/* <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:屠麟傲血]]|longId=4b1de2510314971dbb478c813a2e0000189d2dd2|shortId=4b1de25|message=fix: showavatar styles and upload title (#71)}}'; "use strict"; $(function () { var commonsUrl = new mw.Uri("https://commons.moegirl.org.cn/"); 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, title: "上传头像" }); var link = $("<a>").attr("href", "https://commons.moegirl.org.cn/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> */