From 84f351021fc27a6599e377474ad979c0b6fb1c1f Mon Sep 17 00:00:00 2001 From: root Date: Thu, 19 Nov 2026 22:04:41 -0800 Subject: [PATCH] Web: drop sidebar playlist list, pin side art, trim help text, redo mixer action buttons Co-Authored-By: Claude Opus 5.5 --- web/app.js | 74 ++++++++++++++------------------------------------ web/index.html | 4 --- web/style.css | 23 +++++++++------- web/util.js | 4 +++ 4 files changed, 37 insertions(+), 68 deletions(-) diff --git a/web/app.js b/web/app.js index 6a120c0..9c89678 100644 --- a/web/app.js +++ b/web/app.js @@ -249,20 +249,16 @@ function presetsHtml(names) { title="Tap again for Full Mix. Long press to ${lock?.id === p.id ? "unlock" : "lock"}.">${lock?.id === p.id ? ICON.lock : ""}${esc(presetLabel(p.name))}`).join("") + ``; } function mixFoot(names) { - const saved = songMixes[E.entry.key]; - const lock = S.lockedPreset && allPresets().find(p => p.id === S.lockedPreset); - const savedNote = saved ? (sameMix(saved, S.mix, names) ? "Using this song's saved mix." : "Changed from this song's saved mix.") : ""; - return `
- - ${saved ? `` : ""} - -
-

${savedNote} ${S.karaoke ? "Karaoke is on, so saved mixes are ignored until you turn it off." : lock ? `${esc(presetLabel(lock.name))} is locked, so every song starts with it. Long press it to unlock.` - : (S.keepMix ? "Songs without a saved mix keep this mix." : "Songs without a saved mix start at full mix.") + " Long press a preset to lock it."}

`; + const saved = songMixes[E.entry.key], same = saved && sameMix(saved, S.mix, names); + return `
+ + + ${saved ? `` : ""} +
`; } function mixerHtml() { const names = mixNames(); - if (!names.length) return `

${E.loading ? "Loading stems…" : Q.cur() ? "This track has no stems yet. Right-click it and pick Stem Now." : "Play something with stems to mix it."}

`; + if (!names.length) return `

${E.loading ? "Loading stems…" : Q.cur() ? "No stems for this track." : "Nothing playing."}

`; return `
${presetsHtml(names)}
${names.map(n => { @@ -829,7 +825,7 @@ const stationsHtml = () => S.stations.length ? `
${S.sta return `
${esc(st.name)}${esc(st.url)}
`; -}).join("")}
` : `

No stations yet. Add one with its stream URL.

`; +}).join("")}
` : `

No stations yet.

`; const routes = { async home(my) { @@ -862,8 +858,7 @@ const routes = {

Add a station

-
-

Any stream the browser can play, like MP3, AAC or Ogg. Playing a station pauses the queue, and playing the queue stops the station.

`; +
`; }, async albums(my) { const srcs = sources(); @@ -881,7 +876,7 @@ const routes = { const srcs = sources(); if (!srcs.length) return needPlex(); view.innerHTML = bar("Songs", { sort: "songs", extra: `` }) - + `${thead()}

No songs with stems loaded yet. Scroll for more.

Every song loaded so far has stems. Scroll for more.

`; + + `${thead()}

No songs with stems yet.

Every song has stems.

`; lists.songs = []; const size = S.stemFilter ? 1000 : 150; await paged(my, $("tbody", view), new Pager(srcs, secPath, { type: 10, sort: sortState("songs").param }, size), size, (ms, off) => { @@ -913,14 +908,14 @@ const routes = { view.innerHTML = bar("Playlists", { sort: "playlists", filter: false }) + `

Stem playlists

` + (playlists.length ? `
${playlists.map(p => card({ href: `#/stemplaylist/${p.id}`, img: artOf(p.items[0]?.track, 300), t: p.title, s: plural(p.items.length, "track") })).join("")}
` - : `

Stem playlists remember a mix for each song. Right-click any song to add it.

`) + : `

No stem playlists.

`) + `

Plex playlists

${liveServers().length ? "Loading…" : "No Plex server set up."}

`; if (!liveServers().length) return; let pls = await everything(liveServers().map(srv => ({ srv })), "/playlists", { playlistType: "audio" }); if (my !== seq) return; pls = st.random ? pls.sort(() => Math.random() - 0.5) : pls.sort(comparator(st.param)); count(pls.length + playlists.length, "playlist"); - navPls = [...pls].sort((a, b) => (a.title || "").localeCompare(b.title || "")); navState = "ok"; navPlaylists(); + $("#plexpl").innerHTML = pls.length ? `
${pls.map(p => card({ href: `#/playlist/${p._srv}:${p.ratingKey}`, img: img(p._srv, p.thumb || p.composite), fb: p.composite && rawImg(p._srv, p.composite), t: p.title, s: plural(p.leafCount || 0, "track"), kind: "playlist", srv: p._srv, key: p.ratingKey })).join("")}
` : `

No music playlists.

`; }, @@ -986,7 +981,7 @@ const routes = { view.innerHTML = bar("Downloads", { filter: false, extra: recs.length ? `` : "" }) + `

${plural(recs.length, "track")}, ${fmtBytes(total)} stored in this browser${est?.quota ? ` (${fmtBytes(est.usage)} of ${fmtBytes(est.quota)} used)` : ""}. Downloads play without the network. ${isSecureContext ? "" : "This page isn't on HTTPS, so the browser may clear them when space runs low."}

` - + (recs.length ? dlGroups(recs) : `

Nothing downloaded. Right-click a song or album and pick Download for offline.

`); + + (recs.length ? dlGroups(recs) : `

Nothing downloaded.

`); count(recs.length, "track"); }, async stems(my) { @@ -998,7 +993,7 @@ const routes = { const f = $("#sf").value.toLowerCase(); const hits = f ? all.filter(t => t.stem.key.toLowerCase().includes(f)) : all; $("#sl").innerHTML = (hits.length ? trackTable("stems", hits.slice(0, 400)) : `

${Stems.ok ? "No matches." : "Can't reach stemserve. Check Settings."}

`) - + (hits.length > 400 ? `

Showing 400 of ${hits.length}. Filter to narrow it down.

` : ""); + + (hits.length > 400 ? `

400 of ${hits.length}

` : ""); }; $("#sf").oninput = render; render(); @@ -1006,33 +1001,11 @@ const routes = { settings: renderSettings, }; -// Sidebar playlist list: stem playlists, then Plex ones (fetched at start and on the Playlists page). -let navPls = [], navHtml = ""; -let navState = "loading"; -const STEMDOT = ''; -function navPlaylists() { - const box = $("#nav-pl"), html = playlists.map(p => `${esc(p.title)}${STEMDOT}`).join("") - + navPls.map(p => `${esc(p.title)}`).join("") - || ``; - if (html !== navHtml) { navHtml = html; box.innerHTML = html; } - for (const a of box.children) a.classList.toggle("on", a.getAttribute("href") === location.hash); -} -async function loadNavPlaylists() { - await connecting; - if (!liveServers().length) navState = "none"; - else { - try { navPls = (await everything(liveServers().map(srv => ({ srv })), "/playlists", { playlistType: "audio" })).sort((a, b) => (a.title || "").localeCompare(b.title || "")); } catch {} - navState = "ok"; - } - navPlaylists(); -} - async function route() { const my = ++seq; const [, name = "home", ...rest] = (location.hash || "#/home").split("/"); const arg = decodeURIComponent(rest.join("/")); $$("#nav a").forEach(a => a.classList.toggle("on", a.dataset.nav === name || (a.dataset.nav === "genres" && name === "genre") || (a.dataset.nav === "playlists" && /playlist$/.test(name)))); - navPlaylists(); lists = {}; listItems = {}; kick = null; delete view.dataset.genre; view.scrollTop = 0; @@ -1136,7 +1109,6 @@ function presetEditor() { const ps = presets(), lock = S.lockedPreset && allPresets().find(p => p.id === S.lockedPreset); return `

Locked

${lock ? `
${ICON.lock}${esc(presetLabel(lock.name))}
` : `

Nothing locked.

`} -

Every song starts with this mix, whether or not Keep Stem Mix Between Songs is on. Long press a preset in the mixer to lock or unlock it.

Mixer Bar

${ps.map((p, i) => `
${esc(presetLabel(p.name))}${p.custom ? ' CUSTOM' : ""} @@ -1165,7 +1137,6 @@ function renderSettings() { const theme = THEMES[S.theme] || THEMES.graphite; view.innerHTML = `

Plex

-

Turn on the music libraries you want. Everything that's on is browsed as one library.

${S.servers.map(serverHtml).join("") || `

No servers yet.

`}
Add a server by URL and token
@@ -1181,19 +1152,15 @@ function renderSettings() {

Stems

-

Stems are downloaded whole before a song starts. Opus 160 is about 1 MB per stem-minute; FLAC is around eight times that.

-

How many upcoming songs load their stems in the background. Each one is held in memory, so keep it low on phones. FLAC loads one at most.

-

Songs without a saved mix keep the current mix. When it's off they start at full mix, and karaoke turns off.

${plural(Object.keys(songMixes).length, "saved song mix")}${Object.keys(songMixes).length ? `` : ""}

Stem Editor

${presetEditor()}

Karaoke

- -

Synced lyrics come from LRCLIB, shown in the Lyrics drawer (L).

+

Appearance

${Object.entries(THEMES).map(([k, t]) => ``).join("")}
@@ -1201,14 +1168,14 @@ function renderSettings() {
Player bar${BAR.map(([k, l]) => ``).join("")}
-

Applied live, after the theme. Variables: --bg --panel --raised --line --text --muted --accent --accent-ink --radius --wave --wave-ghost.

+

--bg --panel --raised --line --text --muted --accent --accent-ink --radius --wave --wave-ghost

Offline

${plural(Offline.ids.size, "track")} downloaded. Manage downloads

- ${isSecureContext && navigator.storage?.persist ? `
` : `

Over plain HTTP the browser may clear downloads when it's short on space.

`} + ${isSecureContext && navigator.storage?.persist ? `
` : ""}

Backup

-

Settings, saved mixes and stem playlists. The file includes your Plex tokens.

+

Includes your Plex tokens.

Keys

Space play/pause · ←/→ seek 5s (shift 30s) · S shuffle · R repeat · [ ] speed · M mixer · L lyrics · Q queue · K karaoke · P next preset · hold Next to skip the album · right-click a song or album for more

@@ -1237,7 +1204,7 @@ function renderSettings() { navigator.storage?.estimate?.().then(e => { const el = $("#storage-info"); if (el && e?.quota) el.insertAdjacentText("afterbegin", `${fmtBytes(e.usage)} of ${fmtBytes(e.quota)} used. `); }).catch(() => {}); const again = () => { if (location.hash.startsWith("#/settings")) renderSettings(); }; - const plexChanged = () => { genreCache = null; save(); loadNavPlaylists(); }; + const plexChanged = () => { genreCache = null; save(); }; $("#signin").onclick = async () => { const st = $("#sstatus"); try { const ok = await signIn(m => { st.textContent = m; }); plexChanged(); toast(`Added ${plural(ok.length, "server")}`); again(); } @@ -1346,7 +1313,6 @@ let connecting = null; Q.restore(); UI.all(); route(); - loadNavPlaylists(); Live.poll(); - setInterval(() => { if (!document.hidden) { Stems.refresh(); loadNavPlaylists(); } }, 5 * 60 * 1000); + setInterval(() => { if (!document.hidden) { Stems.refresh(); } }, 5 * 60 * 1000); })(); diff --git a/web/index.html b/web/index.html index 23a589e..0645829 100644 --- a/web/index.html +++ b/web/index.html @@ -23,10 +23,6 @@ Downloads Web Radio Settings -
diff --git a/web/style.css b/web/style.css index a217cd1..84fc23b 100644 --- a/web/style.css +++ b/web/style.css @@ -43,15 +43,8 @@ svg { width: 1em; height: 1em; fill: currentColor; display: block; } #nav a.on { background: var(--raised); color: var(--text); } #search input { width: 100%; margin: 10px 0; padding: 7px 10px; background: var(--raised); border: 1px solid transparent; border-radius: 4px; outline: none; } #search input:focus { border-color: var(--accent); } -.nav-sec { flex: 1 1 0 !important; min-height: 150px; display: flex; flex-direction: column; margin: 10px -10px 0; padding: 6px 10px 8px; border-top: 1px solid var(--line); } -#nav .nav-h { flex: none; min-height: 30px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; background: none; } -#nav .nav-h:hover { background: none; } -#nav-pl { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 1px; margin: 0 -6px; padding: 0 6px; } -#nav-pl a { flex: none; min-height: 32px; font-weight: 400; gap: 8px; justify-content: space-between; } -#nav-pl a svg { width: 13px; height: 13px; opacity: .55; } -.nav-empty { margin: 4px 10px; color: var(--muted); opacity: .7; font-size: 12px; } .settings-link { margin-top: 2px; } -#sideart { display: none; position: relative; margin: 0 -10px; aspect-ratio: 1; background: var(--raised); overflow: hidden; } +#sideart { display: none; position: sticky; bottom: 0; z-index: 2; margin: auto -10px 0; box-shadow: 0 -10px 24px rgba(0, 0, 0, .35); aspect-ratio: 1; background: var(--raised); overflow: hidden; } #app.sideart #sideart { display: block; animation: sain .26s cubic-bezier(.2, .8, .2, 1); } @keyframes sain { from { opacity: 0; transform: translateY(24px); } } #sideart .sa-img { display: block; width: 100%; height: 100%; padding: 0; cursor: pointer; } @@ -217,7 +210,17 @@ input[type=color] { width: 40px; height: 28px; padding: 0; border: 1px solid var .seg button { flex: 1; padding: 5px 4px; border-radius: 6px; font-size: 12px; color: var(--muted); } .seg button.on { background: var(--accent); color: var(--accent-ink); } .kara label { display: grid; gap: 4px; } -.mixrow { margin-top: 16px; } +.mixacts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 18px; } +.mixacts:has(.ic) { grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr) 36px; } +.mact { display: flex; align-items: center; justify-content: center; gap: 6px; height: 36px; min-width: 0; padding: 0 8px; border-radius: 8px; + background: var(--raised); color: var(--text); font-size: 13px; font-weight: 600; transition: background-color .12s, color .12s, transform .08s; } +.mact span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } +.mact svg { width: 17px; height: 17px; flex: none; fill: currentColor; } +.mact:hover { background: var(--hover); } +.mact:active { transform: scale(.97); } +.mact.on { background: color-mix(in srgb, var(--accent) 18%, var(--raised)); color: var(--accent); } +.mact.ic { padding: 0; color: var(--muted); } +.mact.ic:hover { color: #ff453a; } #lyr.synced p { margin: 0; padding: 7px 4px; font-size: 19px; font-weight: 700; line-height: 1.3; color: var(--muted); opacity: .55; cursor: pointer; transition: opacity .2s, color .2s; } #lyr.synced p:hover { opacity: .85; } #lyr.synced p.on { color: var(--text); opacity: 1; } @@ -314,7 +317,7 @@ input[type=range] { accent-color: var(--accent); } #nav { flex-direction: row; overflow-x: auto; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--line); align-items: center; } .brand { padding: 0 8px 0 4px; } #nav a { white-space: nowrap; overflow: visible; } - #nav a svg, .nav-sec, #sideart, #b-art .exp { display: none !important; } + #nav a svg, #sideart, #b-art .exp { display: none !important; } #nav { overflow-y: hidden; } #nav a { min-height: 32px; } #search input { margin: 0; width: 120px; } diff --git a/web/util.js b/web/util.js index df65afe..19e44ce 100644 --- a/web/util.js +++ b/web/util.js @@ -33,6 +33,10 @@ export function toast(msg, ms = 2400) { } export const ICON = { + save: '', + check: '', + pladd: '', + x: '', lock: '', play: '', pause: '',