Widget:TalkToc:修订间差异

添加628字节 、​ 2022年11月26日 (六) 16:50
试试
无编辑摘要
(试试)
第2行: 第2行:
"use strict";
"use strict";
window.RLQ = window.RLQ || [];
window.RLQ = window.RLQ || [];
window.RLQ.push([["ext.gadget.site-lib","jquery","ext.gadget.libOOUIDialog"],function () {
window.RLQ.push([["ext.gadget.site-lib","jquery","ext.gadget.libOOUIDialog"],function (){
    if (location.hostname.includes("mzh.moegirl.org")) { return; }
    if (location.hostname.includes("mzh.moegirl.org")) { return; }
    if (!mw.config.get("talkTocLoaded", false)) {
    if (!mw.config.get("talkTocLoaded", false)) {
第38行: 第38行:
            $toc.find(`a[href="#${head.find(".mw-headline")[0].id.replace(/"/g, '\\"')}"]`).parent().addClass("savedDiscussion hiddenDiscussion");
            $toc.find(`a[href="#${head.find(".mw-headline")[0].id.replace(/"/g, '\\"')}"]`).parent().addClass("savedDiscussion hiddenDiscussion");
            container.addClass("savedDiscussion");
            container.addClass("savedDiscussion");
         } else if(container.find(".movedToNotice")[0] && head.nextUntil(".movedToNotice").length === 0){
           $toc.find(`a[href="#${head.find(".mw-headline")[0].id.replace(/"/g, '\\"')}"]`).parent().addClass("movedDiscussion hiddenDiscussion");
           container.addClass("movedDiscussion");
          } else if (window.CSS && CSS.supports && CSS.supports("position", "sticky")) {
          } else if (window.CSS && CSS.supports && CSS.supports("position", "sticky")) {
            head.css({
            head.css({
第43行: 第46行:
              top: 0,
              top: 0,
              "background-color": bgcolor,
              "background-color": bgcolor,
              "z-index": 114514,
              "z-index": 999999,
            });
            });
            container.css("position", "relative");
            container.css("position", "relative");
第65行: 第68行:
        const $level2 = $toc.find(".toclevel-2").hide();
        const $level2 = $toc.find(".toclevel-2").hide();
        const $svdDcs = $toc.find(".savedDiscussion");
        const $svdDcs = $toc.find(".savedDiscussion");
       const $movedDcs = $toc.find(".movedDiscussion");
        const $title = $toc.find(".toctitle").css("margin-right", "1em").append("<" + 'span id="toctoggle"><' + "/span>");
        const $title = $toc.find(".toctitle").css("margin-right", "1em").append("<" + 'span id="toctoggle"><' + "/span>");
        const $toggle = $title.append("<" + 'div id="toggle"><' + "/div>").find("#toggle");
        const $toggle = $title.append("<" + 'div id="toggle"><' + "/div>").find("#toggle");
第94行: 第98行:
        /* 业务处理*/
        /* 业务处理*/
        //添加存档讨论串标题toggle按钮
        //添加存档讨论串标题toggle按钮
        if ($svdDcs[0]) {
        if ($svdDcs[0] || $movedDcs[0]) {
          $toggle.append($("<" + "a/>", {
          $toggle.append($("<" + "a/>", {
            text: wgUVS("显示已被存档标题", "顯示已被存檔標題"),
            text: wgUVS("显示已被存档标题", "顯示已被存檔標題"),
第296行: 第300行:
        const g = ["sysop", "patroller"];
        const g = ["sysop", "patroller"];
        if (mw.config.get("wgUserGroups").filter(n => g.includes(n)).length === 0 && mw.config.get("wgPageName").startsWith("萌娘百科_talk:讨论版/")) {
        if (mw.config.get("wgUserGroups").filter(n => g.includes(n)).length === 0 && mw.config.get("wgPageName").startsWith("萌娘百科_talk:讨论版/")) {
         mw.loader.using("ext.gadget.libOOUIDialog");
          $("#right-navigation, #moe-page-tools-container").addClass("no-need-to-edit-whole-page").find("#p-views > ul").append('<li id="ca-no-need-to-edit-whole-page-notice" class="collapsible"><span><a href="javascript:void(0);">' + wgULS("请勿编辑全文", "請勿編輯全文") + '</a></span></li>').find("#ca-no-need-to-edit-whole-page-notice a").on("click", async () => {
          $("#right-navigation, #moe-page-tools-container").addClass("no-need-to-edit-whole-page").find("#p-views > ul").append('<li id="ca-no-need-to-edit-whole-page-notice" class="collapsible"><span><a href="javascript:void(0);">' + wgULS("请勿编辑全文", "請勿編輯全文") + '</a></span></li>').find("#ca-no-need-to-edit-whole-page-notice a").on("click", async () => {
           await mw.loader.using("ext.gadget.libOOUIDialog");
            oouiDialog.alert(wgULS("讨论版属于公共讨论页,一般来说无须编辑全文,故我们隐藏了入口。<hr>您可以点击下方标题旁的<b>【编辑】链接</b>来编辑对应段落,也可以点击右上方<b>【添加话题】链接</b>来新增话题。", "討論版屬於公共討論頁,一般來說無須編輯全文,故我們隱藏了入口。<hr>您可以點選下方標題旁的<b>【編輯】連結</b>來編輯對應段落,也可以點選右上方<b>【新增話題】連結</b>來新增話題。", null, null, "討論版屬於公共討論頁,一般來説無須編輯全文,故我們隱藏了入口。<hr>您可以點擊下方標題旁的<b>【編輯】連結</b>來編輯對應段落,也可以點擊右上方<b>【新增話題】連結</b>來新增話題。"), {
            oouiDialog.alert(wgULS("讨论版属于公共讨论页,一般来说无须编辑全文,故我们隐藏了入口。<hr>您可以点击下方标题旁的<b>【编辑】链接</b>来编辑对应段落,也可以点击右上方<b>【添加话题】链接</b>来新增话题。", "討論版屬於公共討論頁,一般來說無須編輯全文,故我們隱藏了入口。<hr>您可以點選下方標題旁的<b>【編輯】連結</b>來編輯對應段落,也可以點選右上方<b>【新增話題】連結</b>來新增話題。", null, null, "討論版屬於公共討論頁,一般來説無須編輯全文,故我們隱藏了入口。<hr>您可以點擊下方標題旁的<b>【編輯】連結</b>來編輯對應段落,也可以點擊右上方<b>【新增話題】連結</b>來新增話題。"), {
              title: "萌娘百科提醒您",
              title: "萌娘百科提醒您",
第364行: 第370行:
.widgetTalkTocEnable div.toc#toc li.savedDiscussion a {
.widgetTalkTocEnable div.toc#toc li.savedDiscussion a {
    text-decoration: underline;
    text-decoration: underline;
}
.widgetTalkTocEnable div.toc#toc li.movedDiscussion a {
   text-decoration: line-through;
}
}
.widgetTalkTocEnable #toc div#tocText {
.widgetTalkTocEnable #toc div#tocText {
返回顶部