“MediaWiki:Gadget-ShowAvatar.js”的版本间的差异

来自萌娘共享
跳转至: 导航搜索
1个标签由机器人或全自动脚本执行的操作
1个标签由机器人或全自动脚本执行的操作
第4行: 第4行:
 
  * -------------------------------------------------------------------------
 
  * -------------------------------------------------------------------------
 
  */
 
  */
var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/ShowAvatar/MediaWiki:Gadget-ShowAvatar.js|user=[[U:屠麟傲血]]|co-authors=|longId=ae0f6c553a1d3b19f43cbdcbd7ece7557ccbfc12|shortId=ae0f6c55|summary=fix: using 📧types/mediawiki and mw.uri.clone()}}';  
+
var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/ShowAvatar/MediaWiki:Gadget-ShowAvatar.js|user=[[U:屠麟傲血]]|co-authors=|longId=ae0f6c553a1d3b19f43cbdcbd7ece7557ccbfc12|shortId=ae0f6c5|summary=fix: using 📧types/mediawiki and mw.uri.clone()}}';  
  
 
/* <pre> */
 
/* <pre> */

2024年4月8日 (一) 18:23的版本

/**
 * -------------------------------------------------------------------------
 * !!! 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:屠麟傲血]]|co-authors=|longId=ae0f6c553a1d3b19f43cbdcbd7ece7557ccbfc12|shortId=ae0f6c5|summary=fix: using 📧types/mediawiki and mw.uri.clone()}}'; 

/* <pre> */

"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 = commonsUrl.clone();
    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 = commonsUrl.clone();
        hrefUrl.path = "/Special:Viewavatar";
        var srcUrl = commonsUrl.clone();
        $(".ns-2 #firstHeading").prepend($("<a/>").attr({
            href: hrefUrl,
            title: "查看头像"
        }).prepend($("<img/>").attr({
            src: srcUrl,
            id: "user-rootpage-avatar"
        }).css({
            width: "1.2em",
            height: "1.2em"
        })));
    }
}); 

/* </pre> */