Show script admins with violet names instead of a badge
What does this PR aim to accomplish?:
Script admins showed a 脚本管理员 badge next to their username. Together with a custom badge, the two often wrapped onto a second line. This PR marks admins with a reserved violet username color instead, which frees the space for their own badge.
Docs PR: https://github.com/XMOJ-Script-dev/docs/pull/10
How does this PR accomplish the above?:
- In
GetUsernameHTML, users inAdminUserListget the newxmoj-rating-adminclass and atitle="脚本管理员"tooltip. The old commented-outlink-fuchsiasketch was the same idea.- It applies whether or not the
Ratingoption is on, like the badge did. - It also applies in Simple mode, where badges were never shown, so admins become recognizable there too.
- It applies whether or not the
- The 脚本管理员 badge is removed. Custom badges from
GetUserBadgeare unchanged. RatingColorCSSgains violet#a855f7with hover#8644c6, darkened 20% like the other tiers.- Contrast is 4.0:1 on white and 4.4:1 on
#1a1a1a. - No rating tier uses violet, so an admin can't be mistaken for a rating and vice versa.
- It is clearly apart from blue and red (OKLab ΔE 0.165 and 0.252).
- Contrast is 4.0:1 on white and 4.4:1 on
- Checked by running
GetUsernameHTMLwith stubbed user info and badge lookups:
| Case | Name color | Tooltip | Badges |
|---|---|---|---|
| Admin, Rating on | violet | 脚本管理员 | custom badge only |
| Admin, Rating off | violet | 脚本管理员 | custom badge only |
| Ordinary user | rating tier color | none | custom badge only |
| Admin, Simple mode | violet | 脚本管理员 | none |
- The test suite runs in CI.
By submitting this pull request, I confirm the following:
- I have read and understood the contributor's guide, as well as this entire template.
- I have commented on my proposed changes within the code.
- I have tested my changes.
- I am willing to help maintain this change if there are issues with it later.
- It is compatible with the GNU General Public License v3.0.
- I have squashed any insignificant commits.
- I have checked that another pull request for this purpose does not exist.
- I have considered and confirmed that this submission will be valuable to others.
- I accept that this submission may not be used, and the PR can be closed at the will of the maintainer.
- I give this submission freely and claim no ownership to its content.
- I have verified that my changes work correctly in both the new UI and the old/classic UI.
⚠️ Item 11 has not been verified: this was prepared by an AI assistant that cannot test both XMOJ UIs in a browser. A human needs to check admin usernames (violet, tooltip, no 脚本管理员 badge) in both the new and classic UI before ticking the box below.
- I have read the above and my PR is ready for review.
🤖 Generated with Claude Code
https://claude.ai/code/session_01E5dr7XTsCeoamqLSiT9rLp
Summary by Sourcery
Replace the script administrator badge with violet username styling to free space for custom badges.
New Features:
- Display script administrators with reserved violet usernames and a “脚本管理员” tooltip instead of a separate administrator badge.
- Preserve custom user badges while making administrator styling consistent across rating and Simple modes.
Enhancements:
- Add accessible hover and focus styling for administrator usernames.
Build:
- Bump the userscript and package versions to 3.8.7.
Summary by cubic
Shows script admins with reserved violet usernames and a 脚本管理员 tooltip instead of a separate badge, freeing space for custom badges.
- Applies the admin styling with or without rating display and in Simple mode.
- Keeps custom badges unchanged.
- Adds hover styling with a darker violet color.
- Bumps the version to 3.8.7 and adds a prerelease entry with release notes to
Update.json.