Skip to content

Show script admins with violet names instead of a badge - #1049

Merged
boomzero merged 4 commits into
devfrom
admin-violet-names
Oct 6, 2026
Merged

boomzero merged 4 commits into
devfrom
admin-violet-names

Conversation

@boomzero

@boomzero boomzero commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

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: XMOJ-Script-dev/docs#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:
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:

  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.

Written for commit 98ac80c. Summary will update on new commits.

Review in cubic

The 脚本管理员 badge plus a custom badge often wrapped onto a second line.
Admins now get a reserved violet username color with a 脚本管理员 tooltip,
whether or not ratings are shown, and the badge is removed. No rating tier
uses violet, so it cannot be mistaken for a rating.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E5dr7XTsCeoamqLSiT9rLp
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-06T00:37:08.276062Z 0111cc1 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@hendragon-bot hendragon-bot Bot added the user-script This issue or pull request is related to the main user script label Oct 6, 2026
@sourcery-ai

sourcery-ai Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Sorry @boomzero, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 4 days and 13 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The PR changes script-admin identification from a separate badge to a reserved violet username color with a 脚本管理员 tooltip, ensuring the marker works across rating and UI modes while leaving custom badges available.

Flow diagram for script-admin username rendering

flowchart TD
    A[GetUsernameHTML] --> B{AdminUserList includes Username}
    B -- Yes --> C[Add title 脚本管理员]
    C --> D[Apply xmoj-rating-admin violet class]
    D --> E[Render custom badge when not Simple]
    B -- No --> F{Rating enabled}
    F -- Yes --> G[Apply rating tier class]
    F -- No --> H[Render default username color]
    G --> E
    H --> E
    E --> I[No 脚本管理员 badge]
Loading

File-Level Changes

Change Details Files
Represent script administrators with a reserved violet username style and tooltip instead of a dedicated badge.
  • Add an admin-specific username CSS class with normal and hover/focus violet colors.
  • Apply the admin class and 脚本管理员 tooltip before rating logic, including when ratings are disabled or Simple mode is used.
  • Remove the 脚本管理员 badge while retaining custom user badges.
XMOJ.user.js

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Deploying xmoj-script-dev-channel with  Cloudflare Pages  Cloudflare Pages

Latest commit: 98ac80c
Status: ✅  Deploy successful!
Preview URL: https://41082cd2.xmoj-script-dev-channel.pages.dev
Branch Preview URL: https://admin-violet-names.xmoj-script-dev-channel.pages.dev

View logs

@pull-request-size pull-request-size Bot added size/M and removed size/S labels Oct 6, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 3 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="XMOJ.user.js">

<violation number="1" location="XMOJ.user.js:707">
P2: This hover/focus shade has only 3.03:1 contrast against the dark skin background (`#1a1a1a`), below the palette’s stated 3.3:1 minimum. Lighten it to a darker-than-base violet such as `#9b59dd`.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sourcery assessment

Approved.

@XMOJ-Script-dev XMOJ-Script-dev deleted a comment from cubic-dev-ai Bot Oct 6, 2026
@boomzero
boomzero merged commit 035839d into dev Oct 6, 2026
12 checks passed
@boomzero
boomzero deleted the admin-violet-names branch October 6, 2026 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M user-script This issue or pull request is related to the main user script

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant