Widget:TalkToc:修订间差异

H萌娘,万物皆可H的百科全书!
跳到导航 跳到搜索
imported>=海豚=
无编辑摘要
(已还原Redayano讨论)的编辑至最后由BakeWater修订的版本)
标签回退
 
(未显示4个用户的60个中间版本)
第1行: 第1行:
<noinclude>Only for [[讨论:讨论版]] & [[讨论:提问求助区]]</noinclude><includeonly><!--{if !isset($wgTalkToc) || !$wgTalkToc}--><!--{assign var="wgTalkToc" value=true scope="global"}--><script>
<noinclude>Only for Talk</noinclude><includeonly><!--{if !isset($wgTalkToc) || !$wgTalkToc}--><!--{assign var="wgTalkToc" value=true scope="global"}--><script>
window.RLQ = window.RLQ || [];
window.addEventListener('jquery-ready', function() {
window.RLQ.push(function() {
    if (location.hostname.includes("m.hmoegirl.info")) return;
    if (location.hostname.includes("m.hmoegirl.com")) return;
    mw.loader.using(["oojs-ui"]).then(function() {
    mw.loader.using(["oojs-ui"]).then(function() {
      if (!mw.config.get('talkTocLoaded', false)) {
      if (!mw.config.get('talkTocLoaded', false)) {
第135行: 第134行:
          containers.first().before('<' + 'div id="talkTocBox"><' + 'table><' + '/table><' + '/div>');
          containers.first().before('<' + 'div id="talkTocBox"><' + 'table><' + '/table><' + '/div>');
          var self = $('#talkTocBox table'),
          var self = $('#talkTocBox table'),
            a = $('<' + 'a/>').text(' 显示已存档讨论串标题');
            a = $('<' + 'a/>').text('');
          self.append('<' + 'caption/>').find('caption').append(mw.config.get('wgTitle') + '现有讨论串').append(' [').append(a).append(']<' + 'br>').append('(这里的讨论串不会被存档,无用及已解决的即时讨论会被定期删除)')
          self.append('<' + 'caption/>').find('caption').append('<br/>').append('').append(a).append('')
            .end().append('<' + 'tbody/>');
            .end().append('<' + 'tbody/>');
          containers.not('.savedDiscussion').each(function(i) {
          containers.not('.savedDiscussion').each(function(i) {
第172行: 第171行:
            var userTalkPage = [];
            var userTalkPage = [];
            content.find('.userTalkPage').each(function() {
            content.find('.userTalkPage').each(function() {
              var timestamp = $(this).data('userTalkTime').replace(/ \([A-Z]{3,4}\)$|\([日一二三四五六]\)/g, ),
              var timestamp = $(this).data('userTalkTime').replace(/ \([A-Z]{3,4}\)$|\([日一二三四五六]\)/g, ''),
                date = new Date(),
                date = new Date(),
                time = timestamp.split(/[年月日\s\(\)\:]+/).map(function(n) {
                time = timestamp.split(/[年月日\s\(\)\:]+/).map(function(n) {
第199行: 第198行:
              );
              );
            /* .append(
            /* .append(
              $('<' + 'div/>').addClass('signInfo').append('话题发起:' + (firstName[0] === 'Unsigned user/Nonstandard sign' ? 'Unsigned user/Nonstandard sign' : '<' + 'a href="/ 用户_讨论:' + firstName[0] + '" title="' + firstName[0] + '的讨论页" target="_blank">' + firstName[0].replace(/_/g, ' ') + '<' + '/a>'))
              $('<' + 'div/>').addClass('signInfo').append('话题发起:' + (firstName[0] === 'Unsigned user/Nonstandard sign' ? 'Unsigned user/Nonstandard sign' : '<' + 'a href="/User_talk:' + firstName[0] + '" title="' + firstName[0] + '的讨论页" target="_blank">' + firstName[0].replace(/_/g, ' ') + '<' + '/a>'))
              .append('<' + 'br>最后回复:' + (lastName[0] === 'Unsigned user/Nonstandard sign' ? 'Unsigned user/Nonstandard sign' : '<' + 'a href="/ 用户_讨论:' + lastName[0] + '" title="' + lastName[0] + '的讨论页" target="_blank">' + lastName[0].replace(/_/g, ' ') + '<' + '/a>') + '(' + lastName[1] + ')')
              .append('<' + 'br>最后回复:' + (lastName[0] === 'Unsigned user/Nonstandard sign' ? 'Unsigned user/Nonstandard sign' : '<' + 'a href="/User_talk:' + lastName[0] + '" title="' + lastName[0] + '的讨论页" target="_blank">' + lastName[0].replace(/_/g, ' ') + '<' + '/a>') + '(' + lastName[1] + ')')
            ); */
            ); */
          });
          });
第219行: 第218行:
            that.append(("<" + "td>&#32;<" + "/td>").repeat(4 - that.find("td").length));
            that.append(("<" + "td>&#32;<" + "/td>").repeat(4 - that.find("td").length));
          });
          });
          $('#talkTocBox caption').append('<' + 'br>[').append($('<' + 'a/>').addClass('cbutton')).append(']');
          $('#talkTocBox caption').append('').append($('<' + 'a/>').addClass('cbutton')).append('');
          $('#tocText').append('<' + 'br>[').append($('<' + 'a/>').addClass('cbutton')).append(']');
          $('#tocText').append('<' + 'br>').append($('<' + 'a/>').addClass('cbutton')).append('');
          $('.cbutton').on('click', function() {
          $('.cbutton').on('click', function() {
            if (!localStorage.wgTocStyle || localStorage.wgTocStyle !== 'list') {
            if (!localStorage.wgTocStyle || localStorage.wgTocStyle !== 'list') {
第226行: 第225行:
              $('#tocBox').show();
              $('#tocBox').show();
              localStorage.setItem('wgTocStyle', 'list');
              localStorage.setItem('wgTocStyle', 'list');
              $('.cbutton').text(' 点击切换至表格格式');
              $('.cbutton').text('');
              $(toclist.filter(function(l) {
              $(toclist.filter(function(l) {
                return l !== "tocBox";
                return l !== "tocBox";
              }).map(function(l) {
              }).map(function(l) {
                return 'a[href="#' + l + '"]';
                return 'a[href="#' + l + '"';
              }).join(', ')).attr("href", "#tocBox");
              }).join(', ')).attr("href", "#tocBox");
            } else {
            } else {
第236行: 第235行:
              $('#tocBox').hide();
              $('#tocBox').hide();
              localStorage.setItem('wgTocStyle', 'table');
              localStorage.setItem('wgTocStyle', 'table');
              $('.cbutton').text(' 点击切换至列表格式');
              $('.cbutton').text('');
              $(toclist.filter(function(l) {
              $(toclist.filter(function(l) {
                return l !== "talkTocBox";
                return l !== "talkTocBox";
              }).map(function(l) {
              }).map(function(l) {
                return 'a[href="#' + l + '"]';
                return 'a[href="#' + l + '"';
              }).join(', ')).attr("href", "#talkTocBox");
              }).join(', ')).attr("href", "#talkTocBox");
            }
            }
第246行: 第245行:
          if (!localStorage.wgTocStyle || localStorage.wgTocStyle !== 'list') {
          if (!localStorage.wgTocStyle || localStorage.wgTocStyle !== 'list') {
            $('#talkTocBox').show();
            $('#talkTocBox').show();
            $('.cbutton').text(' 点击切换至列表格式');
            $('.cbutton').text('');
            $(toclist.filter(function(l) {
            $(toclist.filter(function(l) {
              return l !== "talkTocBox";
              return l !== "talkTocBox";
            }).map(function(l) {
            }).map(function(l) {
              return 'a[href="#' + l + '"]';
              return 'a[href="#' + l + '"';
            }).join(', ')).attr("href", "#talkTocBox");
            }).join(', ')).attr("href", "#talkTocBox");
          } else {
          } else {
            $('#tocBox').show();
            $('#tocBox').show();
            $('.cbutton').text(' 点击切换至表格格式');
            $('.cbutton').text('');
            $(toclist.filter(function(l) {
            $(toclist.filter(function(l) {
              return l !== "tocBox";
              return l !== "tocBox";
            }).map(function(l) {
            }).map(function(l) {
              return 'a[href="#' + l + '"]';
              return 'a[href="#' + l + '"';
            }).join(', ')).attr("href", "#tocBox");
            }).join(', ')).attr("href", "#tocBox");
          }
          }
         $('.cbutton').parent().append(' [<' + 'a class="disableWidgetTalkToc">禁用讨论页面整理工具<' + '/a>]');
         $('.disableWidgetTalkToc').on('click', function() {
           localStorage.setItem('widgetTalkToc', 'disable');
           $(this).text('禁用成功!刷新页面中……');
           setTimeout(location.reload.bind(location), 150);
         });
          $tocBox.css({
          $tocBox.css({
            position: 'relative',
            position: 'relative',
第299行: 第292行:
          }).trigger('hashchange');
          }).trigger('hashchange');
          const g = ["sysop", "patroller"];
          const g = ["sysop", "patroller"];
         if (mw.config.get("wgUserGroups").filter(n => g.includes(n)).length === 0) {
           switch (mw.config.get("wgArticleId")) {
             case 256948:
             case 17801:
               $("#right-navigation").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);">请勿编辑全文</a></span></li>').find("#ca-no-need-to-edit-whole-page-notice a").on("click", function() {
                 var messageDialog = new OO.ui.MessageDialog();
                 var windowManager = new OO.ui.WindowManager();
                 $("body").append(windowManager.$element);
                 windowManager.addWindows([messageDialog]);
                 messageDialog.title.$label.html("萌娘百科提醒您<br>公共讨论页无需编辑全文");
                 messageDialog.message.$label.html("<br>提问求助区、讨论版属于公共讨论页,一般来说无须编辑全文,故我们隐藏了入口。<hr>您可以点击下方标题旁的<b>【编辑】链接</b>来编辑对应段落,也可以点击右上方<b>【添加话题】链接</b>来新增话题。");
                 windowManager.openWindow(messageDialog, {
                   actions: [{
                     action: 'accept',
                     label: '我知道了',
                     flags: 'primary'
                   }]
                 });
               });
               break;
           }
         }
        }
        }
      }
      }
第327行: 第298行:
</script><style>
</script><style>
/* <pre> */
/* <pre> */
@media screen and (min-width: 600px) {
body {
   opacity: 0.95;
   background-image:url(https://www.hmoegirl.info/images/a/af/%E8%AE%A8%E8%AE%BA%E7%89%88%E8%AF%8D%E4%BA%91.jpg);
   background-repeat:no-repeat;
}
}
#ca-nstab-project {  
display: none;
}
.widgetTalkTocEnable #tocBox {
.widgetTalkTocEnable #tocBox {
    max-width: 37%;
    max-width: 37%;
第335行: 第316行:
    display: table;
    display: table;
}
}
.widgetTalkTocEnable div.toc#toc {
.widgetTalkTocEnable div.toc#toc:not(.toc-custom) {
    min-width: 300px;
    min-width: 300px;
    box-sizing: border-box;
    box-sizing: border-box;
第385行: 第366行:
    display: inline-block;
    display: inline-block;
}
}
.widgetTalkTocEnable
#toc:not(.toc-custom),
/* 节操酱的beg */
.widgetTalkTocEnable #content ol,
.widgetTalkTocEnable #content ul {
   margin: 0 !important;
   padding: 0.3em 0 0 1.6em !important;
}
.widgetTalkTocEnable #toc .toclevel-1>ul {
   padding-left: 0 !important;
}
.widgetTalkTocEnable
/* 由于节操酱的beg导致分类那边有秘制空白 */
.widgetTalkTocEnable #content #catlinks ol,
.widgetTalkTocEnable #content #catlinks ul {
   padding: 0 !important;
}
#toc,
#tocBox,
#tocBox,
#talkTocBox {
#talkTocBox {
    display: none;
    display: none;
}
}
.widgetTalkTocDisable #toc {
.widgetTalkTocDisable #toc:not(.toc-custom) {
    display: table;
    display: table;
}
}
第431行: 第396行:
.widgetTalkTocEnable .cbutton {
.widgetTalkTocEnable .cbutton {
    cursor: pointer;
    cursor: pointer;
}
#ca-edit, #ca-editTopSection .mw-editsection {
   display: none !important;
}
}
.signInfo {
.signInfo {
第455行: 第423行:
#right-navigation.no-need-to-edit-whole-page ul>li#Wikiplus-Edit-TopBtn,
#right-navigation.no-need-to-edit-whole-page ul>li#Wikiplus-Edit-TopBtn,
#right-navigation.no-need-to-edit-whole-page ul>li#ca-edit,
#right-navigation.no-need-to-edit-whole-page ul>li#ca-edit,
#right-navigation.no-need-to-edit-whole-page ul>li#ca-editTopSection {
#right-navigation.no-need-to-edit-whole-page ul>li#ca-editTopSection{
    display: none;
    display: none;
}
}
.cloaked-element.transparent-shield {
.cloaked-element.transparent-shield {
    z-index: 9999999;
    z-index: 9999999;
}
.navpopup {
   z-index: 1000000;
}
}
/* </pre> */
/* </pre> */
</style><!--{/if}--></includeonly>
</style><!--{/if}--></includeonly>

2023年8月18日 (五) 10:14的最新版本

Only for Talk