Skip to content

Fix image enlarger and minimalist skin on video replay pages; add page title - #1051

Merged
boomzero merged 10 commits into
devfrom
fix-video-thumb-enlarger
Oct 6, 2026
Merged

boomzero merged 10 commits into
devfrom
fix-video-thumb-enlarger

Conversation

@boomzero

@boomzero boomzero commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

What does this PR aim to accomplish?:

On contest/problem replay pages (contest_video.php, problem_video.php), clicking or dragging the video progress bar thumb opened the image enlarger, because the Aliyun player renders that thumb as an <img>.

Closes #1003

How does this PR accomplish the above?:

ApplyEnlargerToImage now skips images inside the player container (.prism-player or an element whose id starts with J_prismPlayer). Matching on the container id covers the case where the enlarger runs before the player adds its class. Other images on the page are unaffected.

Also on the replay pages:

  • The minimalist skin's global * { border-radius: 0; box-shadow: none } reset squared off the player's round play-button ring (showing a grey box), and its global img sizing rule resized the player's control icons. Both rules now exclude .prism-player descendants (:not(.prism-player *)).
  • contest_video.php / problem_video.php now get a page title from the page heading (e.g. 回放: Contest 8039: Manacher-TB2401), falling back to 比赛 <cid> 回放.

(The progress bar being hard to drag is a site/player issue — it reproduces with the script disabled — and is not addressed here.)

Note: the enlarger and skin changes were checked in a local harness with the real Aliplayer (play-button ring radius 0px → 100%); the page title is not yet verified on the live page. Item 11 (new UI + classic UI) needs human verification.


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.

  • 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

Fix video replay page interactions and presentation while adding descriptive browser titles.

New Features:

  • Add descriptive page titles to contest and problem video replay pages, with fallbacks when headings are unavailable.

Bug Fixes:

  • Prevent video player control images from opening the image enlarger.
  • Keep minimalist skin styling from distorting video player controls.

Build:

  • Bump the userscript and package versions to 3.8.8.

The Aliyun player on contest/problem replay pages renders its progress
bar thumb as an <img>, so clicking or dragging it opened the image
enlarger. Skip images inside the player container.

Closes #1003

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E5dr7XTsCeoamqLSiT9rLp
@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 3 days and 15 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@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
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates image-enlarger image filtering to ignore Aliyun video-player thumbnails and progress-bar controls, using both the player class and ID prefix so replay-page controls are not treated as enlargable images while unrelated page images remain unchanged.

Sequence diagram for filtering replay video controls from image enlargement

sequenceDiagram
    participant User
    participant ImageEnlarger as InitializeImageEnlarger
    participant Image as ImageElement
    participant Player as AliyunPlayer

    User->>ImageEnlarger: InitializeImageEnlarger()
    ImageEnlarger->>Image: closest(.xmoj-image-modal)
    ImageEnlarger->>Image: closest(.prism-player, [id^=J_prismPlayer])
    alt image is inside video player
        ImageEnlarger-->>Image: Skip image enlargement
    else unrelated image
        ImageEnlarger->>Image: currentSrc or src
        ImageEnlarger-->>User: Enable image enlargement
    end
Loading

File-Level Changes

Change Details Files
Exclude video player controls from image-enlarger initialization.
  • Skip images nested in elements with the .prism-player class.
  • Also skip images under containers whose IDs begin with J_prismPlayer, covering initialization before the player class is applied.
  • Preserve existing eligibility checks for all other images.
XMOJ.user.js

Possibly linked issues


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: 1bb14a7
Status: ✅  Deploy successful!
Preview URL: https://86c61176.xmoj-script-dev-channel.pages.dev
Branch Preview URL: https://fix-video-thumb-enlarger.xmoj-script-dev-channel.pages.dev

View logs

@pull-request-size pull-request-size Bot added size/S and removed size/XS labels Oct 6, 2026
@chatgpt-codex-connector

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:55:27.344304Z 63ebf7c 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.

boomzero and others added 3 commits October 6, 2026 08:55
The global border-radius/box-shadow reset squared off Aliplayer's round
play button ring (showing a grey box), and the global img sizing rule
distorted its control icons. Exclude .prism-player descendants from both.

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

@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.

@boomzero boomzero changed the title Don't open the image enlarger on video player controls Fix image enlarger and minimalist skin on video replay pages; add page title Oct 6, 2026
@boomzero
boomzero merged commit 1213cac into dev Oct 6, 2026
7 checks passed
@boomzero
boomzero deleted the fix-video-thumb-enlarger branch October 6, 2026 01:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S 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