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( '' ); } else if ( protectionLevel === 'full/none' ){ $( 'li#pt-userpage' ).before( '<img src="http://ddowiki.com/images/RedPurple_d20.png" style="width: 16px; height: 16px;" title="Full edit protection enabled" /></a></li>' ); } else if ( protectionLevel === 'semi/full' ){ $( 'li#pt-userpage' ).before( '<img src="http://ddowiki.com/images/BlueRed_d20.png" style="width: 16px; height: 16px;" title="Semi/Full protection enabled" /></a></li>' ); } else if ( protectionLevel === 'semi/semi' ){ $( 'li#pt-userpage' ).before( '<img src="http://ddowiki.com/images/Blue_d20.png" style="width: 16px; height: 16px;" title="Semi protection enabled" /></a></li>' ); } else if ( protectionLevel === 'semi/none' ){ $( 'li#pt-userpage' ).before( '<img src="http://ddowiki.com/images/BluePurple_d20.png" style="width: 16px; height: 16px;" title="Semi edit protection enabled" /></a></li>' ); } else if ( protectionLevel === 'none/full' ){ $( 'li#pt-userpage' ).before( '<img src="http://ddowiki.com/images/PurpleRed_d20.png" style="width: 16px; height: 16px;" title="Full move protection enabled" /></a></li>' ); } else if ( protectionLevel === 'none/semi' ){ $( 'li#pt-userpage' ).before( '<img src="http://ddowiki.com/images/PurpleBlue_d20.png" style="width: 16px; height: 16px;" title="Semi move protection enabled" /></a></li>' ); } else { $( 'li#pt-userpage' ).before( '<img src="http://ddowiki.com/images/Purple_d20.png" style="width: 16px; height: 16px;" title="Not protected" /></a></li>' ); }