MCBBS Wiki欢迎您共同参与编辑!在参与编辑之前请先阅读Wiki方针。
如果在编辑的过程中遇到了什么问题,可以去讨论板提问。
为了您能够无阻碍地参与编辑 未验证/绑定过邮箱的用户,请尽快绑定/验证。
MCBBS Wiki GitHub群组已上线!
您可以在回声洞中发表吐槽!
服务器状态监控。点击进入
本站由MCBBS用户自行搭建,与MCBBS及东银河系漫游指南(北京)科技有限公司没有从属关系。点此了解 MCBBS Wiki 不是什么>>
用户:QWERTY770/common.js:修订间差异
跳到导航
跳到搜索
小 (// Edit via Wikiplus) |
(// Edit via Wikiplus) |
||
第32行: | 第32行: | ||
$('#p-help ul').append('<li><a href="https://wiki.crash-logs.cn/wiki/MCBBS_Wiki:%E7%94%B3%E8%AF%B7%E8%81%8C%E4%BD%8D">申请职位</a></li>'); |
$('#p-help ul').append('<li><a href="https://wiki.crash-logs.cn/wiki/MCBBS_Wiki:%E7%94%B3%E8%AF%B7%E8%81%8C%E4%BD%8D">申请职位</a></li>'); |
||
var preList = document.querySelectorAll('pre') |
|||
/* 高亮开始 */ |
|||
var el |
|||
⚫ | |||
for (var i = 0; i < preList.length; i++) { |
|||
var h = document.querySelector(".mw-highlight").innerHTML; |
|||
el=preList[i] |
|||
document.querySelector(".mw-highlight").innerHTML = h.replace("<pre>", "<pre><code class='language-" + lang + "'>"); |
|||
el.classList.add('line-numbers') |
|||
el.innerHTML='<code class="language-'+langGuess(el)+'">'+el.innerHTML+'</code>' |
|||
var h = document.querySelector(".mw-highlight").innerHTML; |
|||
document.querySelector(".mw-highlight").innerHTML = h.replace("</pre>", "</code></pre>"); |
|||
} |
} |
||
⚫ | |||
var |
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++) { |
|||
rep("js"); |
|||
if (pel.classList.contains(langList[i])) { |
|||
} |
|||
return langList[i] |
|||
if (s.indexOf("css") != -1){ |
|||
} |
|||
} |
} |
||
if ( |
if (thisHref.indexOf('.js') != -1) { |
||
return 'js' |
|||
⚫ | |||
var h = document.querySelector("pre").innerHTML; |
|||
⚫ | |||
document.querySelector("pre").innerHTML = h.replace("<pre>", "<pre><code class='language-python'>"); |
|||
⚫ | |||
$('pre').addClass("line-numbers"); |
|||
return 'js' |
|||
var h = document.querySelector("pre").innerHTML; |
|||
document.querySelector("pre").innerHTML = h.replace("</pre>", "</code></pre>"); |
|||
} |
} |
||
var isShow = 1; |
|||
// 插件 |
|||
$("pre").attr("id", "isshow1"); |
|||
$('head').append('<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/prism.min.js"></script>' //本体 |
|||
$("#codeshow").click(function(){ |
|||
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-basic.min.js"></script>' |
|||
if (isShow == 0){ |
|||
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-batch.min.js"></script>' |
|||
$("pre").attr("id", "isshow1"); |
|||
+'<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>' |
|||
}else{ |
|||
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-cpp.min.js"></script>' |
|||
$("pre").attr("id", "isshow0"); |
|||
+'<script src="https://cdn.bootcdn.net/ajax/libs/prism/1.22.0/components/prism-css.min.js"></script>' |
|||
isShow = 0; |
|||
+'<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">') //样式 |
|||
// 以上摘自salt lovely的js |
|||
/* Widget代码显示 */ |
/* Widget代码显示 */ |
2020年10月15日 (四) 19:41的版本
/* Wikiplus */
mw.loader.load('https://wikiplus-app.com/Main.js');
/* 高亮 */
$('head').append('<link rel="stylesheet" href="https://cdn.bootcss.com/prism/1.15.0/themes/prism.css">');
$('head').append('<script src="https://cdn.bootcss.com/prism/1.15.0/prism.js">');
/* 部分链接新窗口打开 */
addTarget("mw-changeslist-title");
addTarget("mw-changeslist-diff");
addTarget("mw-changeslist-diff-cur");
addTarget("mw-changeslist-groupdiff");
addTarget("mw-changeslist-history");
addTarget("mw-userlink");
function addTarget (obj) {
var a_mct = document.getElementsByClassName(obj);
for (var i = a_mct.length - 1; i >= 0; i--) {
a_mct[i].setAttribute("target","_blank");
};
}
/* 添加 */
$('#p-personal ul').append('<li><a href="?action=purge">强制刷新</a><li>');
$('#p-personal ul').append('<li><a href="https://wiki.crash-logs.cn/wiki/User:QWERTY_52_38/common.js">js</a></li>');
$('#p-personal ul').append('<li><a href="https://wiki.crash-logs.cn/wiki/User:QWERTY_52_38/common.css">css</a></li>');
$('#p-personal ul').append(' <button type="button" id="codeshow">显示/隐藏代码行数</button>');
$('#p-help ul').append('<li><a href="https://wiki.crash-logs.cn/wiki/%E7%89%B9%E6%AE%8A:%E7%BC%96%E8%BE%91%E8%AE%A1%E6%95%B0">编辑数</a></li>');
$('#p-help ul').append('<li><a href="https://wiki.crash-logs.cn/wiki/%E6%A8%A1%E6%9D%BF:MCBBS%E6%A2%97%E6%96%87%E5%8C%96">MCBBS梗</a></li>');
$('#p-help ul').append('<li><a href="https://wiki.crash-logs.cn/wiki/%E6%A8%A1%E6%9D%BF:MCBBS%E8%AE%BA%E5%9D%9B%E4%BA%8B%E4%BB%B6">MCBBS事件</a></li>');
$('#p-help ul').append('<li><a href="https://wiki.crash-logs.cn/wiki/%E6%A8%A1%E6%9D%BF:MCBBS%E8%AE%BA%E5%9D%9B%E6%9C%BA%E5%88%B6">MCBBS机制</a></li>');
$('#p-help ul').append('<li><a href="https://wiki.crash-logs.cn/wiki/%E6%A8%A1%E6%9D%BF:MCBBS%E8%AE%BA%E5%9D%9B%E7%94%A8%E6%88%B7">MCBBS用户</a></li>');
$('#p-help ul').append('<li><a href="https://wiki.crash-logs.cn/wiki/MCBBS_Wiki:%E7%94%B3%E8%AF%B7%E8%81%8C%E4%BD%8D">申请职位</a></li>');
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">') //样式
// 以上摘自salt lovely的js
/* Widget代码显示 */
if (s.indexOf("Widget:") != -1){
$.ajax({url: "?action=edit", type: "GET", success: function(data){var result = $(data).find("#wpTextbox1");$("#bodyContent").html(result);}});
}