Замечание: Возможно, после публикации вам придётся очистить кэш своего браузера, чтобы увидеть изменения.
( function ( mw, $ ) { function setMessages() { mw.messages.set( { 'gadget-protection-autoconfirmed': 'Эта страница частично защищена', 'gadget-protection-editprotected': 'Эта страница полностью защищена' } ); } function init() { if (mw.config.get( 'wgIsMainPage' )) return; var restrictions = mw.config.get( 'wgRestrictionEdit' ), action = mw.config.get( 'wgAction' ); if ( action === 'view' && restrictions !== null && restrictions.length > 0 ) { var $indicators = $( '.mw-indicators' ).first(); protectLevel = null; if ( $indicators.find( '#mw-indicator-protected' ).length > 0 ) { return; } setMessages(); if ( restrictions.indexOf( 'sysop' ) !== -1 ) { protectLevel = 'editprotected'; } else if ( restrictions.indexOf( 'autoconfirmed' ) !== -1 ) { protectLevel = 'autoconfirmed'; } var protectText = mw.msg( 'gadget-protection-' + protectLevel ); $( '' ) .addClass( 'mw-indicator mw-indicator-protect' ) .attr( { id: 'mw-indicator-protect-' + protectLevel, title: protectText, alt: protectText } ) .appendTo( $indicators ); } } $( init ); }( mediaWiki, jQuery ) );