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

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

跳转到导航 跳转到搜索
无编辑摘要
(撤销Bhsd讨论)的版本23633)
标签撤销
var lines = $this.html().replace(/\n$/, '').split('\n');
if (mw.config.get( 'wgNamespaceNumber' ) == 274) { lines = lines.slice(1, -1); } // 扔掉首尾的Wikitext注释
return $('<ol>', {html start: lines$this.mapattr(function(ele, i) { return $('<li>start', {html: ele), id: 'L' + (i + 1)}); })})
html: lines.cssmap(function(ele, i) { return $('padding-left<li>', lines.length.toString().length{html: ele, id: 'L' + 2.5(i + 'ch'1)}); })
}).css('padding-left', lines.length.toString().length + 2.5 + 'ch');
});
mw.hook( 'code.prettify' ).fire( $block );
const fragment = decodeURIComponent( location.hash.slice(1) ),
target = document.getElementById( fragment ); // 用户输入内容,禁止使用$()
console.info( target );
console.info( $block.html().slice(0, 200) );
if (/^L\d+$/.test( fragment ) && target) { target.scrollIntoView({ behavior: 'smooth' }); }
}, function(reason) { mw.apiFailure(reason, 'highlight.js'); });
16,874

个编辑

导航菜单