MediaWiki:Gadget-mwPanel.js:修订间差异

来自Vocawiki
跳转到导航 跳转到搜索
SaoMikoto留言 | 贡献
导入1个版本:​来源于萌娘百科,依CC BY-NC-SA 3.0 CN导入,原贡献者请参见来源页面历史
SaoMikoto留言 | 贡献
// Edit via InPageEdit
 
(未显示同一用户的1个中间版本)
第8行: 第8行:
/* <pre> */
/* <pre> */


"use strict";$(()=>{const e=mw.config.get("wgRelevantPageName"),t={"#t-upload":{"t-expandtemplates":`<li id="t-expandtemplates" class="mw-list-item"><a href="/Special:展开模板?wpRemoveComments=1&wpInput={{${e}}}">${wgULS("展开模板","展開模板")}</a></li>`,"t-prefixindex":`<li id="t-prefixindex" class="mw-list-item"><a href="/Special:前缀索引?prefix=${e}">${wgULS("前缀页面","按詞頭查詢頁面")}</a></li>`,"t-pagelog":`<li id="t-pagelog" class="mw-list-item"><a href="/Special:日志?page=${e}">${wgULS("页面日志","頁面日誌")}</a></li>`,"t-replacetext":`<li id="t-replacetext" 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 e in t){const l=$(e);for(const a in t[e])document.getElementById(a)||l.after(t[e][a])}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,"用戶日誌"))});  
$(() => {
    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> */
/* </pre> */

2025年9月14日 (日) 14:00的最新版本

/**
 * -------------------------------------------------------------------------
 * !!! 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> */