User:Leo leo 768/common.js

//wikiplus mw.loader.load('https://wikiplus-app.com/Main.min.js'); //InPageEdit-v2 mw.loader.load('https://cdn.jsdelivr.net/gh/dragon-fish/inpageedit-v2@master/script.min.js'); mw.hook('InPageEdit.toolbox').add(function {  $('#ipe-edit-toolbox .btn-group.group1').append( $('', { class: 'btn-tip-group' }).append(     $(' ', { class: 'btn-tip', text: '编辑指定页面' }),      $(' ', { class: 'ipe-toolbox-btn material-icons', text: 'edit' }).click(function  { ssi_modal.show({         className: 'in-page-edit',          sizeClass: 'dialog',          center: true,          outSideClose: false,          title: '快速編輯頁面',          content: $(' ').append( $(' ').append(             $('', { text: '請指定頁面名' }),              $(' '),              $(' ', { id: 'which-page', style: 'width: 96%', value: mw.config.get('wgPageName') }).click(function  { $(this).css('box-shadow', ''); })            ) ),         buttons: [{            label: '確定',            className: 'btn btn-primary IPE-anypage-ok',            keyPress: 13, // Enter            method: function (a, modal) {              var page = $('#which-page').val;              if (page === '' || page === undefined) {                $('#which-page').css('box-shadow', '0 0 4px red');                return false;              }              modal.close;              InPageEdit.quickEdit({ page: page, reload: false });           }          }, {            label: '取消',            className: 'btn btn-secondary IPE-anypage-cancel',            keyPress: 27, // Esc            method: function (a, modal) {              modal.close;            }          }]        }); })   )  ); }); mw.hook("InPageEdit").add(function  {  if (mw.config.get("wgIsArticle")) {    mw.hook("dfgh.i18n").add(function (i18no) { i18no.loadMessages("InPageEdit-v2").then(function (i18n) {       $("#ca-edit").after( $("", {           id: "ca-quick-edit",            class: "collapsible"          }).append(            $(" ").append( $("", {               href: "javascript:void(0)",                text: "IPE"              }).click(function  {                InPageEdit.quickEdit({ page: mw.config.get("wgPageName"), revision: mw.config.get("wgRevisionId") });             })            )          )        );      });    });  } }); //HotCat window.hotcat_translations_from_commons = true; window.hotcat_use_category_links = false; window.hotcat_dont_add_to_watchlist = true; (function{function setShortCuts{if (!window.HotCat.addShortcuts) return; window.HotCat.addShortcuts({ // Do not modify above. Add your shortcuts below // Shortcut : Replacement, both inside single quotes. If the replacement shall contain a single quote, write it as \'

// ADD YOUR SHORTCUTS HERE. DO NOT FORGET THE COMMA AT THE END OF EACH LINE. 'p':'截图', 'dp':'Dungeons截图', 'ep':'Earth截图', // Do not modify below ' ':""});} if (window.HotCat && window.HotCat.runWhenReady) window.HotCat.runWhenReady(setShortCuts); else $('body').on('hotcatSetupCompleted',setShortCuts);}); mw.loader.load( '//commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-HotCat.js&action=raw&ctype=text/javascript' ); //貢獻顯示編輯數 mw.loader.load('https://zh.wikipedia.org/w/index.php?title=User:Bluedeck/serve/edit-count.js&action=raw&ctype=text/javascript'); //编辑栏便捷按钮 mw.loader.load('https://minecraft-zh.gamepedia.com/index.php?title=User:SteveZihang/edittools.js&action=raw&ctype=text/javascript'); //一键清除缓存、複製標題 mw.loader.using('jquery.cookie',function {  /* 按钮 */  $('.action-view .firstHeading').after( ' ' +   '清除頁面緩存 ' + '複製標題 ' + ' ' );  /* 複製標題 */    $('#title-copy-all').click(function { var text = mw.config.get('wgPageName'); var copyEl = document.createElement('textarea'); copyEl.value = text; document.body.appendChild(copyEl); copyEl.select; document.execCommand('copy'); document.body.removeChild(copyEl); document.execCommand('copy'); $('#title-copy-all').css('color','green'); setTimeout(function {		$('#title-copy-all').css('color','');	}, 2000); }); /* 清除缓存 */  $('#purge-btn').click(function  { var $this = $(this); if ($.cookie('wasPerged') > 0) { $this.html('太快了! (' + Math.floor(($.cookie('wasPerged') - new Date.getTime) / 1000) + ' )').attr('disabled', 'disabled'); var endTime = $.cookie('wasPerged'); setInterval(function {        var timeleft = Math.floor((endTime - new Date.getTime) / 1000);        if (timeleft < 1) {          $this.html('清除頁面缓存').attr('disabled', false);          clearInterval;        } else {          $('#purge-btn_countdown').html(timeleft);        }      }, 1000); } else { $this.html('正在清除 ').attr('disabled', 'disabled'); // 设置5秒CD时间 mw.loader.using(['jquery.cookie'], function {        var timeLeft = new Date;        timeLeft.setTime(timeLeft.getTime + 5 * 1000);        $.cookie('wasPerged', new Date.getTime + (5 * 1000), { expires: timeLeft });     });      new mw.Api.post({        action: 'purge',        titles: wgPageName,      }).done(function  {        $this.html('清除成功!');        window.location.reload;      }).fail(function  {        $this.html('清除失败，请重试').attr('disabled', false);      }); } }); }); //返回顶部 var GoToTop='返回頂部'; $(window).scroll(function {       if ( $(this).scrollTop > 1500){            $('#wpGoToTop').fadeIn;        } else {            $('#wpGoToTop').fadeOut;        } });

var GoToTopBtn='' + GoToTop +' '; $('#mw-content-text').before(GoToTopBtn); $('#wpGoToTop').addClass('mw-ui-button'); $('#wpGoToTop').css('position','fixed').css('top','0%').css('left','50px'); $('#wpGoToTop').hide; $('#wpGoToTop').click(function{       $("html, body").animate({scrollTop: 0}, 1000);	});