User:Leo leo 768/common.js

//InPageEdit-v2 mw.loader.load('https://cdn.jsdelivr.net/gh/dragon-fish/inpageedit-v2@master/script.min.js'); //编辑栏便捷按钮 mw.loader.load('https://minecraft-zh.gamepedia.com/index.php?title=User:SteveZihang/edittools.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.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'); // 设置30秒CD时间 mw.loader.using(['jquery.cookie'], function {        var timeLeft = new Date;        timeLeft.setTime(timeLeft.getTime + 30 * 1000);        $.cookie('wasPerged', new Date.getTime + (30 * 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);	});