Repository navigation
sync: dev to extern-contrib - #1037
Conversation
Reviewer's GuideThis sync updates the project to 3.8.1, unifies monochrome font loading across UI modes, hardens navbar styling against repeated refreshes and DOM replacement while preserving page-owned styles and elements, and adds focused browser/unit coverage for these behaviors and downloads layout. Sequence diagram for resilient navbar styling refreshsequenceDiagram
participant UI as Contest or legacy UI
participant Update as UpdateNavbarStyler
participant Styler as NavbarStyler
participant DOM as Navbar DOM
UI->>Update: UpdateNavbarStyler()
Update->>DOM: querySelector(.navbar.navbar-expand-lg.bg-body-tertiary)
alt Navbar replaced or top bar disabled
Update->>Styler: destroy()
Styler->>DOM: restore preserved styles and classes
Styler->>DOM: remove owned overlay and spacer
end
alt Navbar exists and NewTopBar enabled
Update->>Styler: new NavbarStyler(navbar)
Styler->>DOM: init()
Styler->>DOM: createOverlay()
Styler->>DOM: createSpacer()
Styler->>DOM: updateBlurOverlay()
end
Flow diagram for unified monochrome font loadingflowchart TD
A[Monochrome UI enabled] --> B{Font link already exists?}
B -->|Yes| C[Reuse existing link]
B -->|No| D["LoadMonochromeFonts()"]
D --> E[Create stylesheet link]
E --> F[Append link to document head]
C --> G[Apply monochrome UI]
F --> G
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Deploying xmoj-script-dev-channel with
|
| Latest commit: |
11dd0db
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://c03be34c.xmoj-script-dev-channel.pages.dev |
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="XMOJ.user.js" line_range="2941-2945" />
<code_context>
`;
document.head.appendChild(style);
}
+ const overlay = document.getElementById('blur-overlay');
+ if (overlay !== this.overlay && overlay !== this.borrowedOverlay) {
+ this.borrowedOverlay = overlay;
+ this.restoreOverlayStyles = this.preserveStyles(overlay, ['top', 'left', 'width', 'height']);
+ }
} catch (e) {
console.error(e);
</code_context>
<issue_to_address>
**issue (bug_risk):** When a page-owned `blur-overlay` or `navbar-spacer` is replaced before the next `UpdateNavbarStyler()` call, the new element overwrites `restoreOverlayStyles` or `restoreSpacerStyles` while the old modified element is no longer tracked. Teardown restores only the replacement, leaving the original page-owned element with XMOJ's dimensions.
**Triggers:** When Vue or another page handler replaces an existing page-owned overlay or spacer between navbar refreshes.
**Suggested fix:** Restore the previously borrowed element before replacing its restore callback, or track each borrowed element and its restoration callback independently.
</issue_to_address>Sourcery assessment
Approval pending. 1 finding to address first.
Blocking findings: XMOJ.user.js:2945
| const overlay = document.getElementById('blur-overlay'); | ||
| if (overlay !== this.overlay && overlay !== this.borrowedOverlay) { | ||
| this.borrowedOverlay = overlay; | ||
| this.restoreOverlayStyles = this.preserveStyles(overlay, ['top', 'left', 'width', 'height']); | ||
| } |
There was a problem hiding this comment.
issue (bug_risk): When a page-owned blur-overlay or navbar-spacer is replaced before the next UpdateNavbarStyler() call, the new element overwrites restoreOverlayStyles or restoreSpacerStyles while the old modified element is no longer tracked. Teardown restores only the replacement, leaving the original page-owned element with XMOJ's dimensions.
Triggers: When Vue or another page handler replaces an existing page-owned overlay or spacer between navbar refreshes.
Suggested fix: Restore the previously borrowed element before replacing its restore callback, or track each borrowed element and its restoration callback independently.
fix: navbar font mismatch and overlap before Bootstrap loads
sync-branches: New code has just landed in dev, so let's bring extern-contrib up to speed!
Summary by Sourcery
Improve monochrome navbar rendering and lifecycle handling across legacy and web interfaces.
Bug Fixes:
Enhancements:
Tests: