Skip to content

Remove problem translate button#948

Merged
def-WA2025 merged 2 commits intodevfrom
remove-problem-translate-button
Mar 15, 2026
Merged

Remove problem translate button#948
def-WA2025 merged 2 commits intodevfrom
remove-problem-translate-button

Conversation

@def-WA2025
Copy link
Member

@def-WA2025 def-WA2025 commented Mar 15, 2026

What does this PR aim to accomplish?

Fix the title of the problem is not centered.

How does this PR accomplish the above?

Remove problem translate button.


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. I understand which branch to base my commits and Pull Requests against.
  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. (git rebase)
  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 pull request 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. Check this box to confirm

Summary by Sourcery

Update the XMOJ userscript to remove problem translation controls on the problem page so the problem title layout is centered correctly.

Bug Fixes:

  • Remove Chinese–English problem translation buttons on the problem page to fix misaligned problem titles.

Enhancements:

  • Bump userscript version metadata from 3.3.4 to 3.3.5.

Summary by cubic

Removed the translation buttons on /problem.php to fix the off-center problem title and prevent layout shift. Elements #lang_cn_to_en and #lang_en_to_cn are now removed on load.

Written for commit 2d0c226. Summary will update on new commits.

@sourcery-ai
Copy link

sourcery-ai bot commented Mar 15, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Removes the problem translation buttons on the problem page to fix the misaligned problem title, and bumps the userscript version from 3.3.4 to 3.3.5.

Flow diagram for problem page DOM updates removing translation buttons

flowchart TD
  A[Location is /problem.php] --> B[Get element lang_cn_to_en]
  A --> C[Get element lang_en_to_cn]

  B --> D{transZhEn is not null}
  C --> E{transEnZh is not null}

  D -- Yes --> F[Remove transZhEn from DOM]
  D -- No --> G[Skip removing transZhEn]

  E -- Yes --> H[Remove transEnZh from DOM]
  E -- No --> I[Skip removing transEnZh]

  F --> J[Call RenderMathJax]
  G --> J
  H --> J
  I --> J
Loading

File-Level Changes

Change Details Files
Hide/remove problem translation controls on the problem page to fix title centering.
  • On /problem.php, look up the Chinese→English and English→Chinese translation buttons by their DOM IDs.
  • If either translation button exists, remove it from the DOM before performing further rendering (e.g., MathJax).
XMOJ.user.js
Increment userscript version to reflect this change.
  • Update the @Version metadata from 3.3.4 to 3.3.5.
XMOJ.user.js

Possibly linked issues

  • #unknown: The PR removes translation buttons that skew the bilingual problem title layout, fixing the misaligned title bug.

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

@hendragon-bot hendragon-bot bot added the user-script This issue or pull request is related to the main user script label Mar 15, 2026
Copy link
Member

@boomzero boomzero left a comment

Choose a reason for hiding this comment

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

If you confirm it works, pls merge

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • Consider adding a short comment above the translation-button removal explaining that this is done to fix the problem title centering, so future maintainers understand why these elements are being removed.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider adding a short comment above the translation-button removal explaining that this is done to fix the problem title centering, so future maintainers understand why these elements are being removed.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link

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

Choose a reason for hiding this comment

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

1 issue found across 1 file

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


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

<violation number="1" location="XMOJ.user.js:3">
P2: Don't manually bump `@version` here; it is now out of sync with `package.json` and the release automation expects these versions to stay synchronized.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

// ==UserScript==
// @name XMOJ
// @version 3.3.4
// @version 3.3.5
Copy link

@cubic-dev-ai cubic-dev-ai bot Mar 15, 2026

Choose a reason for hiding this comment

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

P2: Don't manually bump @version here; it is now out of sync with package.json and the release automation expects these versions to stay synchronized.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At XMOJ.user.js, line 3:

<comment>Don't manually bump `@version` here; it is now out of sync with `package.json` and the release automation expects these versions to stay synchronized.</comment>

<file context>
@@ -1,6 +1,6 @@
 // ==UserScript==
 // @name         XMOJ
-// @version      3.3.4
+// @version      3.3.5
 // @description  XMOJ增强脚本
 // @author       @XMOJ-Script-dev, @langningchen and the community
</file context>
Fix with Cubic

@def-WA2025 def-WA2025 merged commit 87ddcc4 into dev Mar 15, 2026
12 of 13 checks passed
@def-WA2025 def-WA2025 deleted the remove-problem-translate-button branch March 15, 2026 09:42
@def-WA2025 def-WA2025 linked an issue Mar 15, 2026 that may be closed by this pull request
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XS 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.

[Bug] 双语题面ProblemTitle是歪的

2 participants