MediaWiki:Gadget-mwPanel.js

来自Vocawiki
跳转到导航 跳转到搜索

注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的更改的影响。

  • Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5Ctrl-R(Mac为⌘-R
  • Google Chrome:Ctrl-Shift-R(Mac为⌘-Shift-R
  • Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5
/**
 * -------------------------------------------------------------------------
 * !!! DON'T MODIFY THIS PAGE MANUALLY, YOUR CHANGES WILL BE OVERWRITTEN !!!
 * -------------------------------------------------------------------------
 */
var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/mwPanel/Gadget-mwPanel.js|user=[[U:LJL]]|co-authors=|longId=0f6845a5dc35c99ed4cb0477be0e168291329c91|shortId=0f6845a5|summary=fix:修复“扩充侧边栏”样式问题 (#674)}}'; 

/* <pre> */

$(() => {
    const wgPageName = mw.config.get("wgRelevantPageName");
    const items = {
        "#t-upload": {
            "t-expandtemplates": `<li id="t-expandtemplates" class="mw-list-item"><a href="/Special:展开模板?wpRemoveComments=1&wpInput={{${wgPageName}}}">${wgULS("展开模板", "展開模板")}</a></li>`,
            "t-prefixindex": `<li id="t-prefixindex" class="mw-list-item"><a href="/Special:前缀索引?prefix=${wgPageName}">${wgULS("前缀页面", "按詞頭查詢頁面")}</a></li>`,
            "t-pagelog": `<li id="t-pagelog" class="mw-list-item"><a href="/Special:日志?page=${wgPageName}">${wgULS("页面日志", "頁面日誌")}</a></li>`,
            "t-replacetext": `<li id="t-replacetext" class="sysop-show mw-list-item"><a href="/Special:替换文本">${wgULS("替换文本", "取代文字")}</a></li>`,
            "t-import": `<li id="t-import" class="sysop-show mw-list-item"><a href="/Special:导入页面">${wgULS("导入页面", "匯入頁面")}</a></li>`,
        },
        "#n-recentchanges": {
            "n-log": `<li id="n-log" class="mw-list-item"><a href="/Special:日志" title="所有日志">${wgULS("所有日志", "所有日誌")}</a></li>`,
        },
    };
    for (const t in items) {
        const target = $(t);
        for (const i in items[t]) {
            if (!document.getElementById(i)) {
                target.after(items[t][i]);
            }
        }
    }
    mw.loader.addStyleTag("#t-expandtemplates, #t-userlog, .ns-2 #t-pagelog, .ns-3 #t-pagelog, .ns--1 #t-pagelog {display:none;}.ns-10 #t-expandtemplates, .ns-2 #t-userlog, .ns-3 #t-userlog {display:list-item!important;}");
    $("#t-log a").text(wgULS("用户日志", "使用者日誌", null, null, "用戶日誌"));
});

/* </pre> */