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( '<!--' );
return (text.slice(0, i) + text.slice(i + 7)).replace(/-->/, '');
}
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( '<' );
return (text.slice(0, i) + text.slice(i + 4)).replace(/>/, '');
}
return ele.html();
});
}
if(['edit', 'submit'].includes( action ) &&
!mw.config.get('wgIsProbablyEditable') &&
$('.editRequest').length == 1) {
|