Show script admins with violet names instead of a badge

Merged
BO
2mo ago
+27-15

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 in AdminUserList get the new xmoj-rating-admin class and a title="脚本管理员" tooltip. The old commented-out link-fuchsia sketch was the same idea.
    • It applies whether or not the Rating option is on, like the badge did.
    • It also applies in Simple mode, where badges were never shown, so admins become recognizable there too.
  • The 脚本管理员 badge is removed. Custom badges from GetUserBadge are unchanged.
  • RatingColorCSS gains violet #a855f7 with 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).
  • Checked by running GetUsernameHTML with stubbed user info and badge lookups:
CaseName colorTooltipBadges
Admin, Rating onviolet脚本管理员custom badge only
Admin, Rating offviolet脚本管理员custom badge only
Ordinary userrating tier colornonecustom badge only
Admin, Simple modeviolet脚本管理员none
  • The test suite runs in CI.

By submitting this pull request, I confirm the following:

  1. I have read and understood the contributor's guide, as well as this entire template.
  2. I have commented on my proposed changes within the code.
  3. I have tested my changes.
  4. I am willing to help maintain this change if there are issues with it later.
  5. It is compatible with the GNU General Public License v3.0.
  6. I have squashed any insignificant commits.
  7. I have checked that another pull request for this purpose does not exist.
  8. I have considered and confirmed that this submission will be valuable to others.
  9. I accept that this submission may not be used, and the PR can be closed at the will of the maintainer.
  10. I give this submission freely and claim no ownership to its content.
  11. 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.