|
|
| (未显示同一用户的29个中间版本) |
| 第1行: |
第1行: |
| var thisHref = window.location.href;
| | mw.loader.load("//mcbbs.wiki/index.php?title=用户:Salt_lovely/user.js&action=raw&ctype=text/javascript", "text/javascript"); |
| //使用wikiplus
| | // 受不了MW的**(粗口)JS压缩器了,是不是“ES2015”你们只支持了“ES”和“5”???????????? |
| mw.loader.load('https://wikiplus-app.com/Main.js'); | |
| //引入高亮
| |
| $('head').append('<script src="https://cdn.bootcdn.net/ajax/libs/prettify/r298/run_prettify.min.js"></script>'
| |
| +'<script src="https://cdn.bootcdn.net/ajax/libs/prettify/r298/lang-css.min.js"></script>'
| |
| +'<script src="https://cdn.bootcdn.net/ajax/libs/prettify/r298/lang-vb.min.js"></script>'
| |
| +'<script src="https://cdn.bootcdn.net/ajax/libs/prettify/r298/lang-yaml.min.js"></script>'
| |
| +'<link href="https://cdn.bootcdn.net/ajax/libs/prettify/r298/prettify.min.css" rel="stylesheet">')
| |
| //文档准备完毕后执行
| |
| $(document).ready(function(){
| |
| function countLog(obj) {
| |
| $(obj).each(function(){
| |
| var count=$(this).children('li').length;
| |
| $(this).prepend('<span>共计'+count+'条记录</span>');
| |
| });
| |
| }
| |
| | |
| //清理缓存
| |
| $('#pt-logout').before('<li id="pt-purge"><a title="刷新页面并清理缓存" href="?action=purge">清理缓存</a><li>');
| |
| | |
| //日志统计
| |
| countLog("#mw-log-deleterevision-submit>ul");
| |
| | |
| });
| |
| //代码高亮 | |
| function colorizedPre() {
| |
| var preList = document.querySelectorAll('pre');
| |
| var i;
| |
| for (i = 0; i < preList.length; i++) {
| |
| if (!langGuess(preList[i])) {
| |
| langFind(preList[i])
| |
| }
| |
| preList[i].classList.add('prettyprint');
| |
| }
| |
| }
| |
| function langGuess(el) {
| |
| var pel = el.parentNode;
| |
| var langList = ['css', 'js', 'java', 'vb'];
| |
| for (var i of langList) {
| |
| if (pel.classList.contains(i)) {
| |
| el.classList.add('lang-' + i);
| |
| pel.classList.remove(i);
| |
| return true;
| |
| }
| |
| }
| |
| return false;
| |
| }
| |
| function langFind(el) {
| |
| if (thisHref.indexOf('.js') != -1) {
| |
| el.classList.add('lang-js');
| |
| } else if (thisHref.indexOf('.css') != -1) {
| |
| el.classList.add('lang-css');
| |
| }
| |
| }
| |
| colorizedPre();
| |