LLWiki正在建设中,欢迎加入我们

“MediaWiki:Gadget-code-prettify.js”的版本间差异

跳转到导航 跳转到搜索
无编辑摘要
/* 引自[[moegirl:mediawiki:gadget-code-prettify.js]] */
 
mw.hook('wikipage.content').add( function($content) {
varconst acceptsLangs = {
"js": "javascript",
"javascript": "javascript",
"css": "css",
"scribunto": "lua",
"lua": "lua",
"html": "html"
};,
var wgPageContentModel = mw.config.get( "wgPageContentModel" ).toLowerCase();
if (wgPageContentModel in acceptsLangs) {wgPageContentModel $content= mw.find('config.mw-code').addClassget( 'hljs linenums ' + acceptsLangs["wgPageContentModel]" ).toLowerCase(); }
if (wgPageContentModel in acceptsLangs) {
$content.find('.mw-code').addClass( 'hljs linenums ' + acceptsLangs[wgPageContentModel] );
});
$content.find('pre[lang], code[lang]').each(function() {
var self = $(this),
if ( self.is('pre') ) { self.addClass("linenums"); }
}
else if (lang == "html") { self.addClass("prettyprint"); }
});
if ($content.find('.hljs').length > 0) { mw.loader.load( '/zh?title=mediawiki:gadget-code-prettify-core.js&action=raw&ctype=text/javascript' ); }
mw.loader.getScriptload( '/zh?title=usermediawiki:bhsd/gadget-code-prettify-core.js&action=raw&ctype=text/javascript' ).then(function() {;
if ($content.find('.prettyprint').length > 0) {
mw.loader.getScript('/zh?title=user:bhsd/code-prettify.js&action=raw&ctype=text/javascript').then(function() {
prettyPrint();
});
}
});
16,874

个编辑

导航菜单