User:Daniel Quinlan/Scripts/UserHighlighter
Description | Highlights users based on groups and blocks. |
---|---|
Author(s) | Daniel Quinlan |
Status | Beta |
Updated | 10 November 2024 |
Browsers | Firefox, Safari, Chrome |
Skins | Vector |
Source | UserHighlighter.js |
The UserHighlighter script visually highlights Wikipedia usernames based on user groups and block status.
Features
[edit]- Real-time queries: Fast and accurate highlighting without relying on large data files.
- Block support: Supports IP range, IP, and user blocks (replaces the markblocked gadget).
- Minimal highlighting by default: Highlights sysops, extended-confirmed users, bots, and blocked users. More groups can be enabled through settings.
- Custom labels: Optionally append labels to usernames.
- OOUI configuration: Accessible settings for easy customization.
- Dark and light mode support: Automatically adjusts styling based on user preferences.
Installation
[edit]To install the UserHighlighter script, follow these steps:
- In your preferences, go to Preferences → Gadgets. At the bottom of the "Advanced" section, click the "Install scripts without having to manually edit JavaScript files (documentation)" checkbox, then click the "Save" button.
- Return to this page and click the blue "Install" button.
Alternatively, you can manually install it by adding the following code to your common.js file:
{{subst:iusc|User:Daniel Quinlan/Scripts/UserHighlighter.js}}
Configuration
[edit]To customize UserHighlighter, click on User highlighter options in the tools menu on your common.css page. You can enable or disable user groups, enter custom labels for each enabled group, and you can turn off the default stylesheet to use your own custom CSS styling.
Styling
[edit]Default highlighting
[edit]User status | Light mode | Dark mode |
---|---|---|
Extended confirmed | Example | Example |
Administrator | Example | Example |
Bot | Example | Example |
Partial block | Example | Example |
Temporary block | Example | Example |
Indefinite block | Example | Example |
Custom highlighting
[edit]You can customize the highlighting by either supplementing the default stylesheet or disabling it entirely. The default stylesheet is located at User:Daniel Quinlan/Scripts/UserHighlighter.css. Any additional styles, including those for user groups not covered by the default, can be added to your common.css page or a skin-specific stylesheet such as vector.css.
Each class name is the group name prefixed with uh-
, as listed on Special:ListGroupRights. Make sure the group name is enabled in the configuration if you're trying to use it.
Generally, color
works well for dark mode, while background-color
is more suitable for light mode. Here's an example of styling the bureaucrat user group with gold text:
/* custom color for bureaucrat group */
a.uh-bureaucrat {
color: #b5b506;
}
Notes
[edit]Blocks and user groups are cached locally for one hour. Extended-confirmed users have a cache duration of three hours, and administrators have a cache duration of 24 hours. To force an early refresh of cached data, visit the user's profile page, their talk page, or their contributions page.
Credits
[edit]This script is originally based on User:Novem Linguae/Scripts/UserHighlighterSimple.js although it has been comprehensively rewritten, so any issues should be attributed to me. That script was based on User:Chlod/Scripts/UserHighlighter.js, which was based on User:Pythoncoder/Scripts/userHighlighter.js, which was based on User:Amalthea/userhighlighter.js, ultimately originating from User:Ais523/adminrights.js. Thanks to all the previous authors for their work!