MediaWiki:Gadget-ppIndicators.js

var protectionLevel; var isMW = ( mw.config.get( 'wgCanonicalNamespace' ) == 'MediaWiki' ? true : false ); if ( isMW ) { protectionLevel = 'mediawiki';// page is MediaWiki: } else { var editLevel = mw.config.get( 'wgRestrictionEdit' );// Get the edit protection flag for page if ( editLevel == '' || editLevel == 'undefined' || editLevel == null ) { editLevel = 'none';// page isn't protected at all } else { if ( $.inArray( 'sysop', editLevel ) >= 0 ) { editLevel = 'full';// sysop is full }   else if ( $.inArray( 'autoconfirmed', editLevel ) >= 0 ) { editLevel = 'semi';// autoconfirmed is semi } else { editLevel = 'none';// otherwise there's none } }  var moveLevel = mw.config.get( 'wgRestrictionMove' );// Get the move protection flag for page if ( moveLevel == '' || moveLevel == 'undefined' || moveLevel == null ) { moveLevel = 'none';// page isn't protected at all } else { if ( $.inArray( 'sysop', moveLevel ) >= 0 ) { moveLevel = 'full';// sysop is full }   else if ( $.inArray( 'autoconfirmed', moveLevel ) >= 0 ) { moveLevel = 'semi';// autoconfirmed is semi } else { moveLevel = 'none';// otherwise there's none } }  protectionLevel = editLevel + '/' + moveLevel; }

if ( protectionLevel === 'mediawiki' ) { $( 'li#pt-userpage' ).before( '' ); } else if ( protectionLevel === 'full/full' ) { $( 'li#pt-userpage' ).before( '' ); } else if ( protectionLevel === 'full/semi' ){ $( 'li#pt-userpage' ).before( 'Full/Semi protection enabled' ); } else if ( protectionLevel === 'full/none' ){ $( 'li#pt-userpage' ).before( 'Full edit protection enabled' ); } else if ( protectionLevel === 'semi/full' ){ $( 'li#pt-userpage' ).before( 'Semi/Full protection enabled' ); } else if ( protectionLevel === 'semi/semi' ){ $( 'li#pt-userpage' ).before( '' ); } else if ( protectionLevel === 'semi/none' ){ $( 'li#pt-userpage' ).before( 'Semi edit protection enabled</li>' ); } else if ( protectionLevel === 'none/full' ){ $( 'li#pt-userpage' ).before( 'Full move protection enabled</li>' ); } else if ( protectionLevel === 'none/semi' ){ $( 'li#pt-userpage' ).before( 'Semi move protection enabled</li>' ); } else { /* Do nothing because there is no protection */ }