“MediaWiki:Gadget-site-shared.js”的版本间差异

删除932字节 、​ 2020年12月15日 (二) 12:08
无编辑摘要
 
mw.hook('wikipage.content').add( function($content) {
if(['edit', const action ='submit'].includes( mw.config.get('wgAction'); ) &&
if (mw.config.get( 'wgNamespaceNumber' ) == 10 && ['view', 'submit'].includes( action )) {
$content.find( '.mw-highlight > pre' ).last().html(function() {
const ele = $(this);
if (ele.text().startsWith( '-->' ) && ele.text().endsWith( '<!--\n' )) {
const text = ele.html(),
i = text.lastIndexOf( '&lt;!--' );
return (text.slice(0, i) + text.slice(i + 7)).replace(/--&gt;/, '');
}
if (ele.text().startsWith( '</noinclude>' ) && ele.text().endsWith( '<noinclude>\n' )) {
ele.children( '.nt:first, .nt:last, .p:first, .p:last' ).remove();
const text = ele.html(),
i = text.lastIndexOf( '&lt;' );
return (text.slice(0, i) + text.slice(i + 4)).replace(/&gt;/, '');
}
return ele.html();
});
}
 
if(['edit', 'submit'].includes( action ) &&
!mw.config.get('wgIsProbablyEditable') &&
$('.editRequest').length == 1) {
16,874

个编辑