Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/* * User rights script * By MastCell * ------------------ * Adds information on user rights (sysop, checkuser, etc) to the heading on user pages. * Heavily borrowed and lightly adapted from User:Splarka/sysopdectector.js *//* * Namespace check: Add user rights info if this is a userpage or talkpage * If this is a user or usertalk subpage (e.g. "User:Example/subpage"), we'll leave out * the info. We'll also leave it out if we're editing or submitting an edit. */if((mw.config.get('wgNamespaceNumber')==2||mw.config.get('wgNamespaceNumber')==3)&&mw.config.get('wgTitle').indexOf('/')==-1&&mw.config.get('wgAction')!='edit'&&mw.config.get('wgAction')!='submit'){addOnloadHook(mcShowUserGroups);}functionmcShowUserGroups(){varurl=mw.config.get('wgServer')+mw.config.get('wgScriptPath');url+='/api.php?action=query&format=json&list=users&usprop=groups|blockinfo|editcount|registration';url+='&callback=mcDisplayUserRightsInfo&maxage=3600&smaxage=3600&ususers=';url+=encodeURIComponent(mw.config.get('wgTitle'));importScriptURI(url);}functionmcDisplayUserRightsInfo(queryObj){// Check to make sure the query returned a user; otherwise, returnif(!queryObj['query']||!queryObj['query']['users']){return;}varuser=queryObj['query']['users'];if(user.length===0){return;}user=user[0];// If the user is an IP ("invalid") or unregistered ("missing"), returnif(user['invalid']===""||user['missing']==="")return;varuserRightStr="";// Get registration Dateif(user['registration']){varregDate=user['registration'].split("T")[0];varregDateObj=newDate(regDate);userRightStr+=("Registered "+(regDateObj.getMonth()+1)+"/"+regDateObj.getDate()+"/"+regDateObj.getFullYear()+"; ");}// Get edit countif(user['editcount']){userRightStr+=(user['editcount']+" edits");}// Get user rightsif(user['groups']){varnumRights=0;vargroupLength=user['groups'].length;for(vari=0;i<groupLength;i++){// We'll ignore the groups "*" and "users", since everyone belongs to themvarcurrentGroup=user['groups'][i];if((currentGroup!="*")&&(currentGroup!="user")){if(numRights===0){userRightStr+="; ";}else{userRightStr+=", ";}if(currentGroup=="sysop"){userRightStr+="<span style='text-shadow: green 0px 0px 10px'>";userRightStr+=currentGroup;userRightStr+="</span>";}elseif(currentGroup=="bureaucrat"){userRightStr+="<span style='text-shadow: yellow 0px 0px 10px'>";userRightStr+=currentGroup;userRightStr+="</span>";}elseif(currentGroup=="checkuser"){userRightStr+="<span style='text-shadow: red 0px 0px 10px'>";userRightStr+=currentGroup;userRightStr+="</span>";}elseif(currentGroup=="oversight"){userRightStr+="<span style='text-shadow: cyan 0px 0px 10px'>";userRightStr+=currentGroup;userRightStr+="</span>";}else{userRightStr+=currentGroup;}numRights++;}}}// If currently blocked, mention itif(user['blockedby']){varblockLogURL=mw.config.get('wgServer')+mw.config.get('wgScriptPath')+"/index.php?title=Special:Log/block&page="+encodeURIComponent(mw.config.get('wgPageName'));userRightStr+="; <a href='"+blockLogURL+"'>currently blocked</a>";}// Attach the info where we want it$('#siteSub').before("<div id='mcUserRights' style='font-size: smaller'>"+userRightStr+"</div>");}