MCBBS Wiki欢迎您共同参与编辑!在参与编辑之前请先阅读Wiki方针

如果在编辑的过程中遇到了什么问题,可以去讨论板提问。

为了您能够无阻碍地参与编辑 未验证/绑定过邮箱的用户,请尽快绑定/验证

MCBBS Wiki GitHub群组已上线!

您可以在回声洞中发表吐槽!

服务器状态监控。点击进入

本站由MCBBS用户自行搭建,与MCBBS及东银河系漫游指南(北京)科技有限公司没有从属关系。点此了解 MCBBS Wiki 不是什么>>

用户:Salt lovely/common.js:修订间差异

来自MCBBS Wiki
跳到导航 跳到搜索
无编辑摘要
无编辑摘要
第1行: 第1行:
var thisHref = window.location.href;
var thisHref = window.location.href;
//使用wikiplus
//使用wikiplus
mw.loader.load('https://wikiplus-app.com/Main.js');
mw.loader.load('https://wikiplus-app.com/Main.min.js');
//引入高亮
//引入高亮
$('head').append('<script src="https://cdn.bootcdn.net/ajax/libs/prettify/r298/run_prettify.min.js"></script>'
$('head').append('<script defer 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 defer 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 defer 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>'
+'<script defer 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">')
+'<link href="https://cdn.bootcdn.net/ajax/libs/prettify/r298/prettify.min.css" rel="stylesheet">')
//文档准备完毕后执行
//文档准备完毕后执行
$(document).ready(function(){
$(document).ready(function(){
//清理缓存
$('#pt-logout').before('<li id="pt-purge"><a title="刷新页面并清理缓存" href="?action=purge">清理缓存</a><li>');

//日志统计
function countLog(obj) {
function countLog(obj) {
$(obj).each(function(){
$(obj).each(function(){
第16行: 第20行:
});
});
}
}

//清理缓存
$('#pt-logout').before('<li id="pt-purge"><a title="刷新页面并清理缓存" href="?action=purge">清理缓存</a><li>');

//日志统计
countLog("#mw-log-deleterevision-submit>ul");
countLog("#mw-log-deleterevision-submit>ul");


第27行: 第26行:
function colorizedPre() {
function colorizedPre() {
var preList = document.querySelectorAll('pre');
var preList = document.querySelectorAll('pre');
var i;
for (var i = 0; i < preList.length; i++) {
for (i = 0; i < preList.length; i++) {
if (!langGuess(preList[i])) {
if (!langGuess(preList[i])) {
langFind(preList[i])
langFind(preList[i])

2020年10月15日 (四) 12:15的版本

var thisHref = window.location.href;
//使用wikiplus
mw.loader.load('https://wikiplus-app.com/Main.min.js');
//引入高亮
$('head').append('<script defer src="https://cdn.bootcdn.net/ajax/libs/prettify/r298/run_prettify.min.js"></script>'
+'<script defer src="https://cdn.bootcdn.net/ajax/libs/prettify/r298/lang-css.min.js"></script>'
+'<script defer src="https://cdn.bootcdn.net/ajax/libs/prettify/r298/lang-vb.min.js"></script>'
+'<script defer 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(){
    //清理缓存
    $('#pt-logout').before('<li id="pt-purge"><a title="刷新页面并清理缓存" href="?action=purge">清理缓存</a><li>');

    //日志统计
    function countLog(obj) {
        $(obj).each(function(){
            var count=$(this).children('li').length;
            $(this).prepend('<span>共计'+count+'条记录</span>');
        });
    }
    countLog("#mw-log-deleterevision-submit>ul");

});
//代码高亮
function colorizedPre() {
    var preList = document.querySelectorAll('pre');
    for (var 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();