Extract shared helpers from artists.js to shared-helpers.js
Part C of the deferred unification cleanup. The Artists page is no
longer in the sidebar, but its JS file can't be deleted yet because
it houses ~20 general-purpose helpers that other modules depend on
(escapeHtml used in 229 places, service-status polling, image-colour
extraction, download-bubble infrastructure, discography completion
checking, enrichment card rendering).
Moved all non-page-specific code from artists.js into the new
webui/static/shared-helpers.js — pure copy/paste, zero logic change.
Two contiguous blocks extracted:
Block A (lines 1097..1398 of original artists.js): discography
completion suite — checkDiscographyCompletion, handleStreaming-
CompletionUpdate, cacheCompletionData, updateAlbumCompletion-
Overlay, getCompletionStatusText, setAlbumDownloadedStatus,
setAlbumDownloadingStatus.
Block B (lines 2206..EOF of original artists.js): download-bubble
infrastructure (artist + search + Beatport clusters with their
snapshot/hydrate/modal/monitor helpers), openDownloadMissingModal-
ForArtistAlbum, image-colour extractor and dynamic-glow helper,
escapeHtml, service-status polling, renderEnrichmentCards.
Function declarations in a plain <script> tag are auto-global, so all
existing callers continue to resolve without any import/export
changes. Load order in index.html: shared-helpers.js loads right
after core.js (which defines the artistDownloadBubbles / search-
DownloadBubbles / beatportDownloadBubbles globals these helpers use).
Stats:
artists.js: 4638 → 1903 lines (-2735)
shared-helpers.js: new, 2762 lines
No function duplicated between the two files
All 357 tests pass (3 new from split-integrity parametrization)
What's left in artists.js is purely the Artists page — search UI,
detail view, state switching, watchlist button, discography loading.
All of that is reachable only by typing /artists in the URL bar
since the sidebar entry was retired in Phase 4b. Parts D + E will
delete that remainder and the file itself.
This commit is contained in:
parent
3c7dc4de6e
commit
a5d97261e4
4 changed files with 2765 additions and 2736 deletions
|
|
@ -27,9 +27,11 @@ _ROOT = Path(__file__).resolve().parent.parent
|
|||
_STATIC = _ROOT / "webui" / "static"
|
||||
_INDEX = _ROOT / "webui" / "index.html"
|
||||
|
||||
# The 17 modules that replaced script.js (order matters for first/last checks)
|
||||
# The 17 modules that replaced script.js + shared-helpers.js extracted from
|
||||
# artists.js (order matters for first/last checks)
|
||||
SPLIT_MODULES = [
|
||||
"core.js",
|
||||
"shared-helpers.js",
|
||||
"media-player.js",
|
||||
"settings.js",
|
||||
"search.js",
|
||||
|
|
|
|||
|
|
@ -7988,6 +7988,7 @@
|
|||
<script src="{{ url_for('static', filename='setup-wizard.js') }}"></script>
|
||||
<!-- Split modules (was: script.js) — core.js must load first, init.js last -->
|
||||
<script src="{{ url_for('static', filename='core.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='shared-helpers.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='media-player.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='settings.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='search.js') }}"></script>
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
2761
webui/static/shared-helpers.js
Normal file
2761
webui/static/shared-helpers.js
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue