User:Bugghost/Scripts/UserRoleIndicator: Difference between revisions

Content deleted Content added
putting template back because i'm about to edit the script a bunch
typos (cool script!)
ย 
(19 intermediate revisions by 2 users not shown)
Line 1:
{{under construction}}
 
{{Infobox user script
| name = UserRoleIndicator
Line 6 โŸถ 4:
| author = [[User:Bugghost|Bugghost]]. Forked from [[User:Novem Linguae/Scripts/UserHighlighterSimple|UserHighlighterSimple]], which was made by {{ping|Novem Linguae}}, <small>which in turn was forked from a script with many authors: {{ping|Chlod|Pythoncoder|Bellezzasolo|Theopolisme|Amalthea|Ais523}}</small>
| source = [[User:Bugghost/Scripts/UserRoleIndicator.js]]
| screenshot = [[File:UserRoleIndicator examples v1.0.png|250px350px]]
}}
 
This script adds customisable little iconslabels next to usernamesusername links based on the user's user roleroles on the English Wikipedia. Works in signatures, mentions, in page histories/contribs, and elsewhere.

Forked from [[User:Novem Linguae]]'s [[User:Novem Linguae/Scripts/UserHighlighterSimple|UserHighlighterSimple]], and uses 90% of the same code. This fork just adds a little div with an emoji in it next to the link, rather than setting custom CSS on the link itself - signatures are (in most cases) left in-tact.
 
== Installation ==
Go install [[User:Enterprisey/script-installer]], then come back to this page and click the giant blue "Install" button in the infobox on the right.
 
== Roles and symbolsdefault labels ==
 
The default labels used are [[emoji]], but can be customised to be any text (see below). The default labels are:
The symbols used are:
 
* ๐Ÿฃ โ†’ Less than 500 edits
* ๐Ÿ“š๐Ÿ“˜ โ†’ [[WP:Extended confirmed|Extended confirmed]] (more than 500 edits, moreand older than 1a month)
* ๐Ÿฅ‡๐Ÿ“š โ†’ More than 10,000 edits
* ๐Ÿงบ โ†’ [[WP:NPR|New pagePage reviewerReviewer]]
* ๐Ÿ•ต๏ธ โ†’ [[WP:CheckUser|CheckUser]]
* ๐Ÿงน โ†’ [[WP:Admin|Admin]]
* ๐Ÿšฌ โ†’ Former Admin
Line 28 โŸถ 29:
* ๐Ÿฉบ โ†’ [[M:Steward|Steward]] or [[M:Ombud|Ombud]]
* ๐ŸŒ โ†’ Wikimedia Foundation (WMF)
* ๐Ÿค– โ†’ [[Wikipedia:Bots|Bot account]]
 
The links are given a tooltip when hovering, <u><span title="hello">like this</span></u>, which states the full role.
 
SomeThe of thedefault symbol choices are a bit tongue-in-cheek - they shouldn't be taken too seriously. If you have any good ideas for better emojis/unicode symbols for these roles, lemme know. (In the future I would like to expose a method for setting custom symbols/text for these roles to make this easy to change.)
 
The symbollabel is placed in a tasteful semitransparent box next to the username. - it should fit in well in both dark and light colour schemes.
 
'''Note''': unlike [[User:Novem Linguae/Scripts/UserHighlighterSimple|Novem Linguae/Scripts/UserHighlighterSimple]], this script adds new inline elements to the DOM (rather than just changing coloursstyles toof existing DOM elements), and so can make contents of the page jump a small amount when initialinitially loading.
 
== Custom Labels / Placement ==
 
If you don't like the default emoji labels or tooltip texts, you can customise them to be anything you want, including just regular old text.
 
To do this, open up your common.js page and add this code:
 
<syntaxhighlight lang="js" line="1">window.UserRoleIndicatorCustomLabels = {
wmf: ['๐ŸŒ', 'Wikimedia Foundation (WMF)'],
bot: ['๐Ÿค–', 'Bot'],
stewards: ['๐Ÿฉบ', 'Steward or Ombud'],
arbcom: ['โš–๏ธ', 'Arbitration Committee member'],
bureaucrats: ['๐Ÿ’ผโ€', 'Bureaucrat'],
checkUsers: ['๐Ÿ•ต๏ธ', 'Check User'],
admins: ['๐Ÿงน', 'Admin'],
formerAdmins: ['๐Ÿšฌ', 'Former Admin'],
newPageReviewers: ['๐Ÿงบ', 'New page reviewer'],
tenThousandEdits: ['๐Ÿ“š', 'More than 10,000 edits'],
extendedConfirmed: ['๐Ÿ“˜', 'Extended confirmed'],
lessThan500: ['๐Ÿฃ', 'Less than 500 edits'],
};</syntaxhighlight>
 
Modify any of the strings you want in there. The first item of the arrays is the content of the label that will appear next to the username. The second item is the tooltip label.
 
So for instance, if you wanted to do something different, you could have this setup:
 
<syntaxhighlight lang="js" line="1">window.UserRoleIndicatorCustomLabels = {
wmf: ['this user is a WMF member', 'WMF'],
stewards: ['steward coming through!!', 'Steward'],
arbcom: ['โ† arb com ?!', 'arbcom'],
bureaucrats: ['crat', 'Bureaucrat'],
admins: ['๐Ÿ‘ฎโ€โ™€๏ธ๐Ÿ‘ฎโ€โ™‚๏ธ', 'admin'],
formerAdmins: ['retired ๐Ÿ‘ฎโ€โ™€๏ธ๐Ÿ‘ฎโ€โ™‚๏ธ', 'old admin'],
newPageReviewers: ['npp', 'New page reviewer'],
tenThousandEdits: ['too many edits', 'More than 10,000 edits'],
extendedConfirmed: ['normal amount of edits', 'Extended confirmed'],
lessThan500: ['not enough edits', 'Less than 500 edits'],
};</syntaxhighlight>
 
Then save your common.js, and your custom labels will appear (it may require a hard refresh or cache clear to pick up the changes):
 
[[File:UserRoleIndicator custom examples.png|UserRoleIndicator custom examples.png]]
 
'''If you want the labels to appear ''before'' the user name''', open up your common.js file and add this line:
 
<syntaxhighlight lang="js" line="1">
this.window.UserRoleIndicatorCustomPlacement = "before";
</syntaxhighlight>
 
Thanks to [[User:Penultimate_supper]] for the feature suggestion!
 
== Bugs, feedback and suggestions ==
Line 41 โŸถ 93:
This is my first ever attempt at Wikipedia user script! If you have any issues or feedback, let me know.
 
As with any Unicode-on-the-web solution, your browser might display an ugly symbol instead of the intended one, depending on your browser version, your OS, the weather, and the current ___location of certain planets. If you are getting an ugly symbol instead of a nice one, letcheck meout knowthe andinstructions I'llabove seethat iflet there's a replacement Unicode character thatyou iscustomise betterthe supportedlabels.
 
Note that this is mainly a fork of [[User:Novem Linguae/Scripts/UserHighlighterSimple|Novem Linguae/Scripts/UserHighlighterSimple]], and the differences are largely cosmetic. Any issues with the icon rendering incorrectly is almost definitely a bug in this script - but issues identifying correct user roles ''may'' come from somewhere else - it could be worth trying to replicate using UserHighlighterSimple and seeing if any issue you're having is replicable there too.
 
Either way - let me know if you have any issues and I'll take a look and see if I can get to the bottom of it.
 
== Updates ==
Now that other people are using this script I don't want to make many big changes, but I will occasionally when it's a safe, small non-controversial change.
 
* Nov 5 2024 - [[User talk:Bugghost/Scripts/UserRoleIndicator#Indicator before signature?|As requested]], added an option to enable the icons to appear ''before'' a user name, not just afterwards
* Jan 22 2025 - Added [[CheckUser]] as a supported role. The icon is the gender-neutral detective ๐Ÿ•ต๏ธ (unicode U+1F575). See above for how to customise.
 
== Todo ==
 
* <s>Add method of custom emoji choices</s>
* <s>More thorough testing</s>
* <s>Add installation instructions</s>
* <s>Add image of custom labels in use</s>
* Find out what you're actually meant to do once you've made a userscript