MCBBS Wiki欢迎您共同参与编辑!在参与编辑之前请先阅读Wiki方针。
如果在编辑的过程中遇到了什么问题,可以去讨论板提问。
为了您能够无阻碍地参与编辑 未验证/绑定过邮箱的用户,请尽快绑定/验证。
MCBBS Wiki GitHub群组已上线!
您可以在回声洞中发表吐槽!
服务器状态监控。点击进入
本站由MCBBS用户自行搭建,与MCBBS及东银河系漫游指南(北京)科技有限公司没有从属关系。点此了解 MCBBS Wiki 不是什么>>
用户:Salt lovely/common.js:修订间差异
跳到导航
跳到搜索
Salt lovely(留言 | 贡献) 小 (// Edit via Wikiplus) |
Salt lovely(留言 | 贡献) 小 (减少向cdn的请求数;添加新的顶栏按钮) |
||
第6行: | 第6行: | ||
$(document).ready(function(){ |
$(document).ready(function(){ |
||
//清理缓存 |
//清理缓存 |
||
$('#pt-logout').before('<li id="pt-purge"><a title="刷新页面并清理缓存" href="?action=purge">清理缓存</a><li>' |
$('#pt-logout').before('<li id="pt-purge"><a title="刷新页面并清理缓存" href="?action=purge">清理缓存</a></li>' |
||
+'<li id="pt-editcount"><a title="查看编辑数" href="wiki/特殊:编辑计数/Salt_lovely">编辑计数</a></li>'); |
|||
//日志统计 |
//日志统计 |
||
第45行: | 第46行: | ||
// 插件 |
// 插件 |
||
$('head').append('<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/prism.min.js"></script>' //本体 |
$('head').append('<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/prism.min.js"></script>' //本体 |
||
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-basic.min.js"></script>' |
//+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-basic.min.js"></script>' |
||
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-batch.min.js"></script>' |
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-batch.min.js"></script>' |
||
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-bbcode.min.js"></script>' |
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-bbcode.min.js"></script>' |
||
第51行: | 第52行: | ||
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-cpp.min.js"></script>' |
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-cpp.min.js"></script>' |
||
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-css.min.js"></script>' |
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-css.min.js"></script>' |
||
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-go.min.js"></script>' |
//+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-go.min.js"></script>' |
||
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-java.min.js"></script>' |
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-java.min.js"></script>' |
||
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-javascript.min.js"></script>' |
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-javascript.min.js"></script>' |
||
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-json.min.js"></script>' |
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-json.min.js"></script>' |
||
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-kotlin.min.js"></script>' |
//+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-kotlin.min.js"></script>' |
||
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-markdown.min.js"></script>' |
//+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-markdown.min.js"></script>' |
||
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-lua.min.js"></script>' |
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-lua.min.js"></script>' |
||
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-python.min.js"></script>' |
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-python.min.js"></script>' |
||
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-sql.min.js"></script>' |
//+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-sql.min.js"></script>' |
||
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-visual-basic.min.js"></script>' |
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-visual-basic.min.js"></script>' |
||
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-vbnet.min.js"></script>' |
//+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-vbnet.min.js"></script>' |
||
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-yaml.min.js"></script>' |
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-yaml.min.js"></script>' |
||
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/plugins/inline-color/prism-inline-color.min.js"></script>' //插件 行内颜色 |
//+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/plugins/inline-color/prism-inline-color.min.js"></script>' //插件 行内颜色 |
||
+'<link href="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/plugins/inline-color/prism-inline-color.min.css" rel="stylesheet">' // 该插件的CSS |
//+'<link href="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/plugins/inline-color/prism-inline-color.min.css" rel="stylesheet">' // 该插件的CSS |
||
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/plugins/line-numbers/prism-line-numbers.min.js"></script>' //插件 显示行数 |
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/plugins/line-numbers/prism-line-numbers.min.js"></script>' //插件 显示行数 |
||
+'<link href="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/plugins/line-numbers/prism-line-numbers.min.css" rel="stylesheet">' |
+'<link href="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/plugins/line-numbers/prism-line-numbers.min.css" rel="stylesheet">' |
2020年10月16日 (五) 14:46的版本
var thisHref = window.location.href;
//使用wikiplus
mw.loader.load('https://wikiplus-app.com/Main.min.js');
//文档准备完毕后执行
$(document).ready(function(){
//清理缓存
$('#pt-logout').before('<li id="pt-purge"><a title="刷新页面并清理缓存" href="?action=purge">清理缓存</a></li>'
+'<li id="pt-editcount"><a title="查看编辑数" href="wiki/特殊:编辑计数/Salt_lovely">编辑计数</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")
})
// 高亮代码
var preList = document.querySelectorAll('pre')
var el
for (var i = 0; i < preList.length; i++) {
el=preList[i]
el.classList.add('line-numbers')
el.innerHTML='<code class="language-'+langGuess(el)+'">'+el.innerHTML+'</code>'
}
function langGuess(el) {
var pel = el.parentNode
var langList = ['css', 'js', 'java', 'vbnet', 'batch', 'python', 'lua', 'vb', 'basic', 'c', 'cpp', 'sql', 'bbcode', 'kotlin', 'markdown']
for (var i = 0; i < langList.length; i++) {
if (pel.classList.contains(langList[i])) {
return langList[i]
}
}
if (thisHref.indexOf('.js') != -1) {
return 'js'
} else if (thisHref.indexOf('.css') != -1) {
return 'css'
}
return 'js'
}
// 插件
$('head').append('<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/prism.min.js"></script>' //本体
//+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-basic.min.js"></script>'
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-batch.min.js"></script>'
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-bbcode.min.js"></script>'
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-c.min.js"></script>'
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-cpp.min.js"></script>'
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-css.min.js"></script>'
//+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-go.min.js"></script>'
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-java.min.js"></script>'
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-javascript.min.js"></script>'
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-json.min.js"></script>'
//+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-kotlin.min.js"></script>'
//+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-markdown.min.js"></script>'
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-lua.min.js"></script>'
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-python.min.js"></script>'
//+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-sql.min.js"></script>'
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-visual-basic.min.js"></script>'
//+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-vbnet.min.js"></script>'
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-yaml.min.js"></script>'
//+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/plugins/inline-color/prism-inline-color.min.js"></script>' //插件 行内颜色
//+'<link href="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/plugins/inline-color/prism-inline-color.min.css" rel="stylesheet">' // 该插件的CSS
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/plugins/line-numbers/prism-line-numbers.min.js"></script>' //插件 显示行数
+'<link href="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/plugins/line-numbers/prism-line-numbers.min.css" rel="stylesheet">'
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/plugins/toolbar/prism-toolbar.min.js"></script>' // 插件 工具栏
+'<link href="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/plugins/toolbar/prism-toolbar.min.css" rel="stylesheet">'
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/plugins/show-language/prism-show-language.min.js"></script>' // 插件 显示语言
+'<link href="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/themes/prism.min.css" rel="stylesheet">') //样式
/* 已停用的代码
$('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">')
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 = ['basic','batch','bbcode','c','cpp','css','go','java','javascript','json','kotlin','markdown','lua','python','sql','visual-basic','vbnet','yaml','html','js','vb','py']
for (var i = 0; i < langList.length; i++) {
if (pel.classList.contains(langList[i])) {
el.classList.add('lang-' + langList[i])
pel.classList.remove(langList[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();
*/