MediaWiki:ProtectionIndicators.js

( function ( mw, $ ) {

function init { 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; }

if ( restrictions.indexOf( 'protectLevel-Tech' ) !== -1 ) { protectLevel = 'Technical Restricted'; }		else if ( restrictions.indexOf( 'protectLevel-ContentModerator' ) !== -1 ) { protectLevel = 'Content Mod Restricted'; }		else if ( restrictions.indexOf( 'protectLevel-Admin' ) !== -1 ) { protectLevel = 'Admin Restricted'; }		else if ( restrictions.indexOf( 'protectLevel-Staff' ) !== -1 ) { protectLevel = 'Staff Restricted'; }		else if ( restrictions.indexOf( 'protectLevel-Webmaster' ) !== -1 ) { protectLevel = 'Webmaster Restricted'; }					$.when( mw.loader.using( 'mediawiki.util' ), mw.loader.using( 'mediawiki.api' ), $.ready ).then( function { 			mw.util.addPortletLink('p-views', '#',  protectLevel, 't-protection');		} );

} }

$( init );

}( mediaWiki, jQuery ) );