web: S opens universal search, sort menu, iOS-style appearance, centered play icon
- Sidebar search box replaced by a blurred overlay (S or /, Shift+S shuffles): songs, artists, albums, Plex and stem playlists across every enabled server, arrow keys + Enter - Sort select + flip chip replaced by one button with a checked menu (fields, directions) - Themes are now Black/Dark/White with the iOS accent colors; old presets migrate - Play triangle recentered, per-button nudges removed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
11dffdf9e6
commit
d30479c6f7
5 files changed
+221
-56
No files matched your search
+134
-36
@@ -14,16 +14,18 @@ const view = $("#view");
|
||||
|
||||
// ---- appearance -------------------------------------------------------------------------------
|
||||
|
||||
// Same palettes as the iOS app: three appearances and the system accent colors (light / dark variants).
|
||||
const THEMES = {
|
||||
graphite: { bg: "#181819", panel: "#101010", raised: "#262628", line: "#2b2b2e", text: "#e7e7e7", muted: "#a8a8a8", accent: "#3a81ed" },
|
||||
amber: { bg: "#0d0e12", panel: "#15171d", raised: "#1d2028", line: "#262a33", text: "#eceef3", muted: "#8a8f9c", accent: "#f2b544" },
|
||||
ocean: { bg: "#0a1018", panel: "#101a26", raised: "#172434", line: "#1f2f42", text: "#e6eef7", muted: "#8698ad", accent: "#4cc2ff" },
|
||||
rose: { bg: "#120c10", panel: "#1b1218", raised: "#251922", line: "#33222e", text: "#f5e9f0", muted: "#a48b99", accent: "#ff6f9f" },
|
||||
forest: { bg: "#0b110d", panel: "#111a14", raised: "#18241c", line: "#223127", text: "#e8f2ea", muted: "#88a08e", accent: "#62d38a" },
|
||||
mono: { bg: "#0e0e0e", panel: "#161616", raised: "#202020", line: "#2c2c2c", text: "#f0f0f0", muted: "#8c8c8c", accent: "#f0f0f0" },
|
||||
oled: { bg: "#000000", panel: "#000000", raised: "#141414", line: "#1e1e1e", text: "#f2f2f2", muted: "#8a8a8a", accent: "#f2b544" },
|
||||
light: { bg: "#f6f6f3", panel: "#ffffff", raised: "#ebeae5", line: "#dddbd4", text: "#18181b", muted: "#6b6b73", accent: "#c27a06", light: true },
|
||||
black: { label: "Black", bg: "#000000", panel: "#000000", raised: "#1c1c1e", line: "#2c2c2e", text: "#ffffff", muted: "#8d8d93", fill: "#3a3a3c" },
|
||||
dark: { label: "Dark", bg: "#1c1c1e", panel: "#161618", raised: "#2c2c2e", line: "#3d3d40", text: "#ffffff", muted: "#98989d", fill: "#48484a" },
|
||||
white: { label: "White", bg: "#ffffff", panel: "#f2f2f7", raised: "#efeff0", line: "#d8d8dc", text: "#000000", muted: "#8a8a8e", fill: "#e3e3e8", light: true },
|
||||
};
|
||||
const ACCENTS = {
|
||||
music: ["Music", "#fa2d48", "#fc3c44"], pink: ["Pink", "#ff2d55", "#ff375f"], orange: ["Orange", "#ff9500", "#ff9f0a"],
|
||||
yellow: ["Yellow", "#ffcc00", "#ffd60a"], green: ["Green", "#34c759", "#30d158"], teal: ["Teal", "#30b0c7", "#40c8e0"],
|
||||
blue: ["Blue", "#007aff", "#0a84ff"], indigo: ["Indigo", "#5856d6", "#5e5ce6"], purple: ["Purple", "#af52de", "#bf5af2"],
|
||||
};
|
||||
const accentOf = (base, key = S.accent) => (ACCENTS[key] || ACCENTS.music)[base.light ? 1 : 2];
|
||||
const inkFor = hex => {
|
||||
const n = parseInt(hex.slice(1), 16), l = (0.299 * (n >> 16) + 0.587 * (n >> 8 & 255) + 0.114 * (n & 255)) / 255;
|
||||
return l > 0.6 ? "#141414" : "#ffffff";
|
||||
@@ -76,7 +78,7 @@ const ArtTheme = {
|
||||
},
|
||||
};
|
||||
function applyTheme() {
|
||||
const base = THEMES[S.theme] || THEMES.graphite, t = ArtTheme.hsv ? artPalette(ArtTheme.hsv, base) : base, a = ArtTheme.hsv ? t.accent : S.accent || t.accent;
|
||||
const base = THEMES[S.theme] || THEMES.dark, t = ArtTheme.hsv ? artPalette(ArtTheme.hsv, base) : base, a = ArtTheme.hsv ? t.accent : accentOf(base);
|
||||
$("#theme").textContent = `:root{--bg:${t.bg};--panel:${t.panel};--raised:${t.raised};--line:${t.line};--text:${t.text};--muted:${t.muted};` +
|
||||
`--accent:${a};--accent-ink:${inkFor(a)};--glass:${t.panel}ee;--hover:${t.text}0d;--shadow:${t.light ? "#0003" : "#0009"};` +
|
||||
`--wave:${t.text}44;--wave-ghost:${t.text}14;color-scheme:${t.light ? "light" : "dark"}}`;
|
||||
@@ -558,13 +560,14 @@ if ("mediaSession" in navigator) {
|
||||
}
|
||||
|
||||
document.addEventListener("keydown", ev => {
|
||||
if (ev.key === "Escape") return Menu.close();
|
||||
if (ev.key === "Escape") { Finder.close(); return Menu.close(); }
|
||||
if (ev.target.closest("input, select, textarea") || ev.metaKey || ev.ctrlKey || ev.altKey) return;
|
||||
const k = ev.key.toLowerCase();
|
||||
if (k === "/" || (k === "s" && !ev.shiftKey)) { ev.preventDefault(); return Finder.open(); }
|
||||
if (k === " ") { ev.preventDefault(); togglePlay(); }
|
||||
else if (k === "arrowright") E.seek(Math.min(E.duration(), E.position() + (ev.shiftKey ? 30 : 5)));
|
||||
else if (k === "arrowleft") E.seek(Math.max(0, E.position() - (ev.shiftKey ? 30 : 5)));
|
||||
else if (k === "s") Q.toggleShuffle();
|
||||
else if (k === "s") Q.toggleShuffle(); // Shift+S
|
||||
else if (k === "r") Q.cycleRepeat();
|
||||
else if (k === "m") toggleDrawer("mixer");
|
||||
else if (k === "l") toggleDrawer("lyrics");
|
||||
@@ -646,7 +649,7 @@ const Menu = {
|
||||
items = items.filter(Boolean);
|
||||
const m = document.createElement("div");
|
||||
m.id = "menu";
|
||||
m.innerHTML = items.map((it, i) => it === "-" ? "<hr>" : `<button data-mi="${i}" ${it.run ? "" : "disabled"}>${esc(it.label)}</button>`).join("");
|
||||
m.innerHTML = items.map((it, i) => it === "-" ? "<hr>" : it.head ? `<h5>${esc(it.head)}</h5>` : `<button data-mi="${i}" ${it.run ? "" : "disabled"} ${"check" in it ? `class="chk ${it.check ? "on" : ""}"` : ""}>${"check" in it ? ICON.check : ""}${esc(it.label)}</button>`).join("");
|
||||
document.body.append(m);
|
||||
const r = m.getBoundingClientRect();
|
||||
m.style.left = Math.max(8, Math.min(x, innerWidth - r.width - 8)) + "px";
|
||||
@@ -654,12 +657,105 @@ const Menu = {
|
||||
m.onclick = ev => { const b = ev.target.closest("[data-mi]"); if (b) { const it = items[+b.dataset.mi]; this.close(); it.run(); } };
|
||||
this.el = m;
|
||||
},
|
||||
close() { this.el?.remove(); this.el = null; },
|
||||
close() { this.el?.remove(); this.el = this.from = null; },
|
||||
};
|
||||
addEventListener("pointerdown", ev => { if (Menu.el && !Menu.el.contains(ev.target)) Menu.close(); }, true);
|
||||
addEventListener("pointerdown", ev => { if (Menu.el && !Menu.el.contains(ev.target) && !Menu.from?.contains(ev.target)) Menu.close(); }, true);
|
||||
addEventListener("blur", () => Menu.close());
|
||||
view.addEventListener("scroll", () => Menu.close(), { passive: true });
|
||||
|
||||
// ---- universal search (S) -----------------------------------------------------------------------
|
||||
// One box over every enabled server: songs, artists, albums and playlists, plus stem playlists.
|
||||
// Arrow keys move, Enter opens (or plays a song), Esc closes.
|
||||
|
||||
const Finder = {
|
||||
el: null, items: [], at: 0, n: 0, timer: 0, pls: null, plsAt: 0,
|
||||
build() {
|
||||
const f = document.createElement("div");
|
||||
f.id = "finder"; f.hidden = true;
|
||||
f.innerHTML = `<div class="fbox" role="dialog" aria-label="Search"><label class="fin">${ICON.search}<input type="text" placeholder="Search songs, artists, albums, playlists" autocomplete="off" spellcheck="false"><kbd>esc</kbd></label><div class="fres" role="listbox"></div></div>`;
|
||||
document.body.append(f);
|
||||
const inp = f.querySelector("input"), res = f.querySelector(".fres");
|
||||
f.addEventListener("pointerdown", ev => { if (ev.target === f) this.close(); });
|
||||
inp.addEventListener("input", () => { clearTimeout(this.timer); this.timer = setTimeout(() => this.run(inp.value.trim()), 180); });
|
||||
inp.addEventListener("keydown", ev => {
|
||||
if (ev.key === "ArrowDown" || ev.key === "ArrowUp") { ev.preventDefault(); this.move(ev.key === "ArrowDown" ? 1 : -1); }
|
||||
else if (ev.key === "Enter") { ev.preventDefault(); this.pick(this.at, ev.shiftKey); }
|
||||
else if (ev.key === "Escape") { ev.preventDefault(); this.close(); }
|
||||
});
|
||||
res.addEventListener("pointermove", ev => { const r = ev.target.closest("[data-fi]"); if (r && +r.dataset.fi !== this.at) this.move(+r.dataset.fi - this.at); });
|
||||
res.addEventListener("click", ev => { const r = ev.target.closest("[data-fi]"); if (r) this.pick(+r.dataset.fi, ev.shiftKey); });
|
||||
this.el = f; this.inp = inp; this.res = res;
|
||||
},
|
||||
open() {
|
||||
if (!this.el) this.build();
|
||||
Menu.close();
|
||||
this.el.hidden = false;
|
||||
document.body.classList.add("finding");
|
||||
this.inp.select(); this.inp.focus();
|
||||
if (!this.inp.value) this.hint();
|
||||
},
|
||||
close() { if (!this.el || this.el.hidden) return; this.el.hidden = true; document.body.classList.remove("finding"); this.inp.blur(); },
|
||||
hint() { this.items = []; this.res.innerHTML = `<p class="fmsg">Type to search every server. <kbd>↑</kbd><kbd>↓</kbd> to move, <kbd>↵</kbd> to open, <kbd>⇧↵</kbd> to queue a song.</p>`; },
|
||||
// Plex playlists aren't in hub search results per section, so keep a short-lived list of them.
|
||||
async plexPlaylists() {
|
||||
if (!this.pls || Date.now() - this.plsAt > 120000) {
|
||||
this.plsAt = Date.now();
|
||||
this.pls = everything(liveServers().map(srv => ({ srv })), "/playlists", { playlistType: "audio" }).catch(() => []);
|
||||
}
|
||||
return this.pls;
|
||||
},
|
||||
async run(q) {
|
||||
const n = ++this.n;
|
||||
if (!q) return this.hint();
|
||||
this.res.classList.add("busy");
|
||||
const lq = q.toLowerCase(), has = s => (s || "").toLowerCase().includes(lq);
|
||||
const [hubs, pls] = await Promise.all([
|
||||
Promise.all(sources().map(s => px(s.srv, "/hubs/search", { query: q, limit: 8, sectionId: s.sec })
|
||||
.then(mc => (mc.Hub || []).flatMap(h => (h.Metadata || []).map(m => (m._srv = s.srv.id, m._type = h.type, m)))).catch(() => []))).then(a => a.flat()),
|
||||
this.plexPlaylists(),
|
||||
]);
|
||||
if (n !== this.n) return;
|
||||
this.res.classList.remove("busy");
|
||||
const of = t => hubs.filter(m => m._type === t), dedupe = (a, k) => [...new Map(a.map(x => [k(x), x])).values()];
|
||||
const songs = dedupe(of("track").map(m => track(m._srv, m)), t => t.id).slice(0, 8);
|
||||
const groups = [
|
||||
["Songs", songs.map(t => ({ kind: "song", t: t.title, s: [t.artist, t.album].filter(Boolean).join(" · "), art: artOf(t, 96), track: t }))],
|
||||
["Artists", dedupe(of("artist"), m => m._srv + m.ratingKey).slice(0, 5).map(m => ({ kind: "artist", t: m.title, s: "Artist", art: img(m._srv, m.thumb, 96), round: true, href: `#/artist/${m._srv}:${m.ratingKey}` }))],
|
||||
["Albums", dedupe(of("album"), m => m._srv + m.ratingKey).slice(0, 6).map(m => ({ kind: "album", t: m.title, s: [m.parentTitle, m.year].filter(Boolean).join(" · "), art: img(m._srv, m.thumb, 96), href: `#/album/${m._srv}:${m.ratingKey}` }))],
|
||||
["Playlists", [
|
||||
...playlists.filter(p => has(p.title)).map(p => ({ kind: "playlist", t: p.title, s: `Stem playlist · ${plural(p.items.length, "track")}`, art: artOf(p.items[0]?.track, 96), href: `#/stemplaylist/${p.id}` })),
|
||||
...pls.filter(p => has(p.title)).map(p => ({ kind: "playlist", t: p.title, s: `Playlist · ${plural(p.leafCount || 0, "track")}`, art: img(p._srv, p.thumb || p.composite, 96), href: `#/playlist/${p._srv}:${p.ratingKey}` })),
|
||||
].slice(0, 6)],
|
||||
].filter(g => g[1].length);
|
||||
this.items = groups.flatMap(g => g[1]);
|
||||
this.items.push({ kind: "all", t: `See all results for “${q}”`, href: "#/search/" + encodeURIComponent(q) });
|
||||
let i = 0;
|
||||
const row = it => `<div class="frow ${it.kind === "all" ? "fall" : ""}" role="option" data-fi="${i++}">${it.kind === "all" ? `<span class="fic">${ICON.search}</span>`
|
||||
: `<span class="fart ${it.round ? "round" : ""}">${it.art ? `<img src="${esc(it.art)}" alt="" loading="lazy" decoding="async" ${FB}>` : ""}</span>`}
|
||||
<span class="ftx"><b>${esc(it.t)}</b>${it.s ? `<small>${esc(it.s)}</small>` : ""}</span>${it.kind === "song" ? `<span class="fkey">Play</span>` : it.kind === "all" ? "" : `<span class="fkey">Open</span>`}</div>`;
|
||||
this.res.innerHTML = (groups.length ? "" : `<p class="fmsg">No matches.</p>`) +
|
||||
groups.map(([h, its]) => `<div class="fgrp"><h4>${h}</h4>${its.map(row).join("")}</div>`).join("") + row(this.items.at(-1));
|
||||
this.at = 0; this.move(0);
|
||||
},
|
||||
move(d) {
|
||||
if (!this.items.length) return;
|
||||
this.at = (this.at + d + this.items.length) % this.items.length;
|
||||
this.res.querySelector(".frow.on")?.classList.remove("on");
|
||||
const r = this.res.querySelector(`[data-fi="${this.at}"]`);
|
||||
r?.classList.add("on");
|
||||
if (d) r?.scrollIntoView({ block: "nearest" });
|
||||
},
|
||||
pick(i, queue) {
|
||||
const it = this.items[i];
|
||||
if (!it) return;
|
||||
this.close();
|
||||
if (it.track) return queue ? Q.add([it.track], false) : Q.playList([it.track], 0, false);
|
||||
location.hash = it.href;
|
||||
},
|
||||
};
|
||||
$("#b-search").innerHTML = ICON.search;
|
||||
$("#b-search").onclick = () => Finder.open();
|
||||
|
||||
const download = (tracks, group = null) => saveOffline(tracks, m => m && toast(m, 120000), group);
|
||||
function stemItem(tracks) {
|
||||
const need = tracks.filter(t => !Stems.find(t));
|
||||
@@ -764,9 +860,20 @@ const stemsChip = () => `<div class="seg stemfilter">${[["stems", "Stems Only"],
|
||||
`<button class="${S.stemFilter === v ? "on" : ""}" data-stemfilter="${v}">${l}</button>`).join("")}</div>`;
|
||||
function sortControl(screen) {
|
||||
const st = sortState(screen);
|
||||
return `<div class="sort"><select data-sort="${screen}" title="Sort">${st.opts.map((o, i) => `<option value="${i}" ${i === st.i ? "selected" : ""}>${o[0]}</option>`).join("")}</select>
|
||||
${st.random ? `<button class="chip" data-reshuffle title="Shuffle again">${ICON.shuffle}</button>`
|
||||
: `<button class="chip" data-sortdir="${screen}" title="Flip order">${st.desc ? st.o[4] : st.o[3]}</button>`}</div>`;
|
||||
return `<button class="sortbtn" data-sortmenu="${screen}" title="Sort" aria-haspopup="menu">${ICON.sort}<span>${st.o[0]}</span>` +
|
||||
`${st.random ? "" : `<small>${st.desc ? st.o[4] : st.o[3]}</small>`}<i class="caret"></i></button>`;
|
||||
}
|
||||
// The sort menu: fields with a check on the current one, then the two directions (or reshuffle).
|
||||
function sortMenu(btn) {
|
||||
const screen = btn.dataset.sortmenu, st = sortState(screen), r = btn.getBoundingClientRect(), go = f => () => { f(); route(); };
|
||||
Menu.open(r.left, r.bottom + 6, [
|
||||
{ head: "Sort by" },
|
||||
...st.opts.map((o, i) => ({ label: o[0], check: i === st.i, run: go(() => i !== st.i && pickSort(screen, i)) })),
|
||||
"-",
|
||||
...(st.random ? [{ label: "Shuffle again", run: () => route() }]
|
||||
: [{ label: st.o[3], check: !st.desc, run: go(() => pickSort(screen, st.i, false)) }, { label: st.o[4], check: st.desc, run: go(() => pickSort(screen, st.i, true)) }]),
|
||||
]);
|
||||
Menu.el.classList.add("sortmenu"); Menu.from = btn;
|
||||
}
|
||||
const bar = (title, { sort, filter = true, extra = "" } = {}) =>
|
||||
`<div class="bar"><h1>${esc(title)}</h1><span class="sub" id="count"></span><span class="grow"></span>${extra}${filter ? stemsChip() : ""}${sort ? sortControl(sort) : ""}</div>`;
|
||||
@@ -1062,11 +1169,6 @@ async function route() {
|
||||
if (my === seq) marks();
|
||||
}
|
||||
addEventListener("hashchange", route);
|
||||
$("#search").onsubmit = ev => {
|
||||
ev.preventDefault();
|
||||
const q = ev.target.q.value.trim();
|
||||
if (q) location.hash = "#/search/" + encodeURIComponent(q);
|
||||
};
|
||||
|
||||
view.addEventListener("click", async ev => {
|
||||
const el = ev.target.closest("button, tr[data-list]");
|
||||
@@ -1078,8 +1180,7 @@ view.addEventListener("click", async ev => {
|
||||
return ts.length ? Q.playList(ts, 0, false) : toast("Nothing to play");
|
||||
}
|
||||
if (ds.stemfilter) { S.stemFilter = S.stemFilter === ds.stemfilter ? "" : ds.stemfilter; save(); applyStemFilter(); return; }
|
||||
if ("sortdir" in ds) { pickSort(ds.sortdir, sortState(ds.sortdir).i); return route(); }
|
||||
if ("reshuffle" in ds) return route();
|
||||
if (ds.sortmenu) return Menu.el ? Menu.close() : sortMenu(el);
|
||||
if ("add" in ds && row) return Q.add([listItems[row.dataset.list]?.[+row.dataset.i] || lists[row.dataset.list][+row.dataset.i]], ev.shiftKey);
|
||||
if ("menu" in ds && row) { const r = el.getBoundingClientRect(); return trackMenu(r.left, r.bottom, row.dataset.list, +row.dataset.i); }
|
||||
if (el === row) return playFrom(row.dataset.list, +row.dataset.i);
|
||||
@@ -1136,10 +1237,6 @@ view.addEventListener("click", async ev => {
|
||||
if (ds.pldelete) { if (confirm("Delete this stem playlist?")) { playlists.splice(playlists.findIndex(x => x.id === ds.pldelete), 1); savePlaylists(); location.hash = "#/playlists"; } return; }
|
||||
if ("dlclear" in ds) { if (confirm("Remove every download?")) { for (const id of [...Offline.ids]) await Offline.remove(id); emit("offline"); route(); } }
|
||||
});
|
||||
view.addEventListener("change", ev => {
|
||||
const s = ev.target.dataset.sort;
|
||||
if (s) { pickSort(s, +ev.target.value); route(); }
|
||||
});
|
||||
view.addEventListener("contextmenu", ev => {
|
||||
const row = ev.target.closest("tr[data-list]"), c = ev.target.closest(".card[data-kind]");
|
||||
if (row) { ev.preventDefault(); trackMenu(ev.clientX, ev.clientY, row.dataset.list, +row.dataset.i); }
|
||||
@@ -1187,11 +1284,11 @@ function serverHtml(srv) {
|
||||
: `<small>No music libraries</small>`}</div></div>`;
|
||||
}
|
||||
|
||||
const KEYS = [["Space", "Play / pause"], ["← →", "Seek 5 s"], ["⇧ ← →", "Seek 30 s"], ["S", "Shuffle"], ["R", "Repeat"], ["[ ]", "Speed"],
|
||||
const KEYS = [["Space", "Play / pause"], ["← →", "Seek 5 s"], ["⇧ ← →", "Seek 30 s"], ["S", "Search"], ["⇧ S", "Shuffle"], ["R", "Repeat"], ["[ ]", "Speed"],
|
||||
["M", "Mixer"], ["L", "Lyrics"], ["Q", "Queue"], ["K", "Karaoke"], ["P", "Next preset"]];
|
||||
|
||||
function renderSettings() {
|
||||
const theme = THEMES[S.theme] || THEMES.graphite, nMix = Object.keys(songMixes).length;
|
||||
const nMix = Object.keys(songMixes).length;
|
||||
view.innerHTML = `<div class="settings"><nav class="toc">${SECTIONS.map(([id, l]) => `<a href="#/settings" data-jump="${id}">${l}</a>`).join("")}</nav><div class="panes">
|
||||
<h1>Settings</h1>
|
||||
<section id="set-plex"><h2>Plex</h2>
|
||||
@@ -1222,8 +1319,10 @@ function renderSettings() {
|
||||
</section>
|
||||
<section id="set-look"><h2>Appearance</h2>
|
||||
<div class="sg"><div class="sr col"><div class="sl"><span>Theme</span></div>
|
||||
<div class="themes">${Object.entries(THEMES).map(([k, t]) => `<button class="swatch ${S.theme === k ? "on" : ""}" data-theme="${k}" style="background:${t.bg};color:${t.text};border-color:${t.line}"><i style="background:${t.accent}"></i>${k[0].toUpperCase() + k.slice(1)}</button>`).join("")}</div></div>
|
||||
${srow("Accent", `${S.accent ? `<button class="btn small" id="accentreset">Reset</button>` : ""}<input type="color" id="accent" value="${S.accent || theme.accent}">`)}
|
||||
<div class="themes">${Object.entries(THEMES).map(([k, t]) => `<button class="tcard ${S.theme === k ? "on" : ""}" data-theme="${k}">
|
||||
<span class="tmock" style="background:${t.bg};border-color:${t.line}"><i style="background:${t.text}"></i>${"<b></b>".repeat(3).replaceAll("<b>", `<b style="background:${t.raised === t.bg ? t.panel : t.raised}">`)}<u style="background:${accentOf(t)}"></u></span>${t.label}</button>`).join("")}</div></div>
|
||||
<div class="sr col"><div class="sl"><span>Accent</span><small>${(ACCENTS[S.accent] || ACCENTS.music)[0]}</small></div>
|
||||
<div class="accents">${Object.entries(ACCENTS).map(([k, [l]]) => `<button class="dot ${(ACCENTS[S.accent] ? S.accent : "music") === k ? "on" : ""}" data-accent="${k}" title="${l}" aria-label="${l}" style="--c:${accentOf(THEMES[S.theme] || THEMES.dark, k)}"></button>`).join("")}</div></div>
|
||||
${stog("Match album art", sw(`id="arttheme"`, S.artTheme))}
|
||||
${stog("Call the vocals-only preset “Acapella”", sw(`id="acapella"`, S.acapella))}</div>
|
||||
<h3 class="sgh">Player bar</h3>
|
||||
@@ -1293,8 +1392,6 @@ function renderSettings() {
|
||||
$("#kmode").onchange = ev => setKaraokeMode(ev.target.value);
|
||||
$("#kdb").oninput = ev => { $("#kdbv").textContent = ev.target.value + " dB"; };
|
||||
$("#kdb").onchange = ev => setKaraokeMode(S.karaokeMode, +ev.target.value);
|
||||
$("#accent").oninput = ev => { S.accent = ev.target.value; applyTheme(); save(); };
|
||||
if ($("#accentreset")) $("#accentreset").onclick = () => { S.accent = ""; applyTheme(); save(); again(); };
|
||||
let cssTimer;
|
||||
$("#css").oninput = ev => { clearTimeout(cssTimer); cssTimer = setTimeout(() => { S.css = ev.target.value; applyTheme(); save(); }, 250); };
|
||||
if ($("#persist")) $("#persist").onclick = async () => toast(await navigator.storage.persist() ? "Downloads will be kept" : "The browser said no");
|
||||
@@ -1315,11 +1412,12 @@ function renderSettings() {
|
||||
};
|
||||
const sv = $(".settings");
|
||||
sv.addEventListener("click", async ev => {
|
||||
const b = ev.target.closest("[data-jump], [data-theme], [data-refsrv], [data-rmsrv], [data-plock], [data-pmove], [data-pdel], [data-padd], [data-prestore], [data-pclear]");
|
||||
const b = ev.target.closest("[data-jump], [data-theme], [data-accent], [data-refsrv], [data-rmsrv], [data-plock], [data-pmove], [data-pdel], [data-padd], [data-prestore], [data-pclear]");
|
||||
if (!b) return;
|
||||
const ds = b.dataset;
|
||||
if (ds.jump) { ev.preventDefault(); $("#set-" + ds.jump).scrollIntoView({ behavior: "smooth", block: "start" }); }
|
||||
else if (ds.theme) { S.theme = ds.theme; S.accent = ""; applyTheme(); save(); again(); }
|
||||
else if (ds.theme) { S.theme = ds.theme; applyTheme(); save(); again(); }
|
||||
else if (ds.accent) { S.accent = ds.accent; applyTheme(); save(); again(); }
|
||||
else if (ds.refsrv) { try { await refreshServer(server(ds.refsrv)); toast("Refreshed"); } catch (e) { toast(e.message); } plexChanged(); again(); }
|
||||
else if (ds.rmsrv && confirm("Remove this server?")) { S.servers = S.servers.filter(s => s.id !== ds.rmsrv); plexChanged(); again(); }
|
||||
else if (ds.plock) toggleLock(ds.plock, mixNames());
|
||||
|
||||
+2
-3
@@ -12,8 +12,7 @@
|
||||
<body>
|
||||
<div id="app">
|
||||
<aside id="nav">
|
||||
<div class="brand">stemify</div>
|
||||
<form id="search"><input type="search" name="q" placeholder="Search" autocomplete="off"></form>
|
||||
<div class="navtop"><div class="brand">stemify</div><button id="b-search" title="Search (S)" aria-label="Search"></button></div>
|
||||
<a href="#/home" data-nav="home"><svg viewBox="0 0 24 24"><path d="M12 3l9 7.5V21h-6.5v-6h-5v6H3V10.5L12 3zm0 2.6L5 11.4V19h2.5v-6h9v6H19v-7.6l-7-5.8z"/></svg>Home</a>
|
||||
<a href="#/albums" data-nav="albums"><svg viewBox="0 0 24 24"><path d="M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20zm0 2a8 8 0 1 0 0 16 8 8 0 0 0 0-16zm0 5a3 3 0 1 1 0 6 3 3 0 0 1 0-6zm0 2a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>Albums</a>
|
||||
<a href="#/artists" data-nav="artists"><svg viewBox="0 0 24 24"><path d="M12 3a4.5 4.5 0 1 1 0 9 4.5 4.5 0 0 1 0-9zm0 2a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zm0 8c4.4 0 8 2.2 8 5v3H4v-3c0-2.8 3.6-5 8-5zm0 2c-3.4 0-6 1.6-6 3v1h12v-1c0-1.4-2.6-3-6-3z"/></svg>Artists</a>
|
||||
@@ -38,7 +37,7 @@
|
||||
</div>
|
||||
<div class="center">
|
||||
<div class="transport">
|
||||
<button id="b-shuffle" class="side" title="Shuffle (S)"></button>
|
||||
<button id="b-shuffle" class="side" title="Shuffle (Shift+S)"></button>
|
||||
<button id="b-prev" title="Previous"></button>
|
||||
<button id="b-play" class="play" title="Play (Space)"></button>
|
||||
<button id="b-next" title="Next (hold to skip the album)"></button>
|
||||
|
||||
+15
-1
@@ -24,11 +24,25 @@ export const S = Object.assign({
|
||||
acapella: false, // spell "A Cappella" as "Acapella"
|
||||
bar: { speed: true, mixer: true, lyrics: true, queue: true }, // player bar buttons
|
||||
stations: [], // web radio: [{id, name, url}]
|
||||
theme: "graphite", accent: "", css: "", sideArt: false, artTheme: false,
|
||||
theme: "dark", accent: "music", css: "", sideArt: false, artTheme: false,
|
||||
}, load(KEY) || {});
|
||||
|
||||
if (!S.clientId) S.clientId = uuid();
|
||||
if (!S.ui2) { if (S.theme === "amber" && !S.accent) S.theme = "graphite"; S.ui2 = true; }
|
||||
// Before the iOS-style appearance: eight preset themes and a free accent color.
|
||||
if (!["black", "dark", "white"].includes(S.theme)) {
|
||||
const old = S.theme, hues = { music: 353, pink: 349, orange: 35, yellow: 48, green: 135, teal: 189, blue: 211, indigo: 241, purple: 280 };
|
||||
S.theme = old === "oled" ? "black" : old === "light" ? "white" : "dark";
|
||||
let h = { graphite: 216, amber: 39, ocean: 201, rose: 340, forest: 142, mono: 211, oled: 39, light: 37 }[old] ?? 211;
|
||||
const m = /^#([0-9a-f]{6})$/i.exec(S.accent || "");
|
||||
if (m) {
|
||||
const n = parseInt(m[1], 16), r = (n >> 16) / 255, g = (n >> 8 & 255) / 255, b = (n & 255) / 255, mx = Math.max(r, g, b), c = mx - Math.min(r, g, b);
|
||||
if (c > 0.05) h = 60 * (mx === r ? ((g - b) / c + 6) % 6 : mx === g ? (b - r) / c + 2 : (r - g) / c + 4);
|
||||
}
|
||||
const d = x => Math.min(Math.abs(x - h), 360 - Math.abs(x - h));
|
||||
S.accent = Object.keys(hues).sort((a, b) => d(hues[a]) - d(hues[b]))[0];
|
||||
}
|
||||
if (!S.accent || S.accent[0] === "#") S.accent = "music";
|
||||
if (S.fmt.startsWith("opus") && !new Audio().canPlayType('audio/ogg; codecs="opus"')) S.fmt = "flac";
|
||||
|
||||
// Before multiple servers there was one S.plex and one S.section.
|
||||
|
||||
+67
-15
@@ -41,8 +41,11 @@ svg { width: 1em; height: 1em; fill: currentColor; display: block; }
|
||||
#nav a svg { width: 18px; height: 18px; flex: none; }
|
||||
#nav a:hover { color: var(--text); background: var(--hover); }
|
||||
#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); }
|
||||
.navtop { display: flex; align-items: center; justify-content: space-between; padding-bottom: 8px; }
|
||||
.navtop .brand { padding-bottom: 0; }
|
||||
#b-search { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); flex: none; }
|
||||
#b-search:hover { color: var(--text); background: var(--hover); }
|
||||
#b-search svg { width: 18px; height: 18px; fill: currentColor; }
|
||||
.settings-link { margin-top: 2px; }
|
||||
#sideart { display: none; position: sticky; bottom: 0; z-index: 2; margin-top: auto; padding: 10px 0 12px; background: var(--panel); }
|
||||
#sideart::before { content: ""; position: absolute; left: -10px; right: -10px; bottom: 100%; height: 28px; pointer-events: none; background: linear-gradient(to top, var(--panel), transparent); }
|
||||
@@ -75,7 +78,7 @@ select, textarea, input[type=text], input[type=url], input[type=password] { back
|
||||
.card.round img, .card.round .ph { border-radius: 50%; }
|
||||
.cplay { position: absolute; right: 8px; bottom: 8px; width: 42px; height: 42px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
|
||||
display: grid; place-items: center; font-size: 17px; box-shadow: 0 6px 16px #0008; opacity: 0; transform: translateY(6px); transition: opacity .15s, transform .15s; }
|
||||
.cplay svg { margin-left: 2px; }
|
||||
|
||||
.card:hover .cplay, .cplay:focus-visible { opacity: 1; transform: none; }
|
||||
.cplay:hover { transform: scale(1.06) !important; }
|
||||
.card .t { margin-top: 10px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
@@ -96,7 +99,7 @@ select, textarea, input[type=text], input[type=url], input[type=password] { back
|
||||
.actions { display: flex; gap: 14px; align-items: center; margin: 4px 0 6px; padding: 14px 0; }
|
||||
.bigplay { width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 22px;
|
||||
box-shadow: 0 6px 18px #0006; transition: transform .1s, filter .15s; }
|
||||
.bigplay svg { margin-left: 3px; }
|
||||
|
||||
.bigplay:hover { transform: scale(1.05); filter: brightness(1.1); }
|
||||
.ibtn { color: var(--muted); font-size: 22px; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; }
|
||||
.ibtn:hover { color: var(--text); }
|
||||
@@ -138,9 +141,12 @@ body.stems-ready .card.nostem .t::after { content: "NO STEMS"; font-size: 9px; f
|
||||
.bar.sm { margin: 28px 0 12px; }
|
||||
.bar.sm h2 { margin: 0; }
|
||||
.grow { flex: 1; }
|
||||
.sort { display: flex; gap: 6px; align-items: center; }
|
||||
.sort select { padding: 5px 8px; font-size: 13px; }
|
||||
.sort .chip svg { display: inline-block; vertical-align: -2px; }
|
||||
.sortbtn { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 10px 0 9px; border-radius: 8px; border: 1px solid var(--line);
|
||||
font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; transition: background .12s, border-color .12s; }
|
||||
.sortbtn:hover { background: var(--hover); border-color: color-mix(in srgb, var(--line) 50%, var(--muted)); }
|
||||
.sortbtn svg { width: 15px; height: 15px; fill: var(--muted); flex: none; }
|
||||
.sortbtn small { color: var(--muted); font-size: 12px; font-weight: 500; }
|
||||
.sortbtn .caret { width: 6px; height: 6px; margin: -3px 1px 0 1px; border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
|
||||
.chip { display: inline-flex; gap: 6px; align-items: center; }
|
||||
.link { color: var(--accent); cursor: pointer; }
|
||||
.btn.small { padding: 5px 12px; font-size: 13px; }
|
||||
@@ -170,6 +176,45 @@ body.no-stems .tracks:not(:has(tbody tr.nostem)) ~ .only-nostems { display: bloc
|
||||
#menu button { display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: 6px; }
|
||||
#menu button:not(:disabled):hover { background: var(--accent); color: var(--accent-ink); }
|
||||
#menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }
|
||||
#menu h5 { margin: 4px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
|
||||
#menu button.chk { display: flex; align-items: center; gap: 8px; padding-left: 8px; }
|
||||
#menu button.chk svg { width: 15px; height: 15px; fill: currentColor; flex: none; visibility: hidden; }
|
||||
#menu button.chk.on { font-weight: 600; }
|
||||
#menu button.chk.on svg { visibility: visible; }
|
||||
#menu.sortmenu { min-width: 190px; }
|
||||
|
||||
#finder { position: fixed; inset: 0; z-index: 60; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px;
|
||||
background: color-mix(in srgb, var(--bg) 40%, transparent); -webkit-backdrop-filter: blur(16px) saturate(1.3); backdrop-filter: blur(16px) saturate(1.3);
|
||||
animation: ffade .14s ease-out; }
|
||||
#finder[hidden] { display: none; }
|
||||
@keyframes ffade { from { opacity: 0; } }
|
||||
.fbox { width: min(640px, 100%); max-height: 72vh; display: flex; flex-direction: column; background: var(--raised); border: 1px solid var(--line);
|
||||
border-radius: 14px; box-shadow: 0 24px 60px var(--shadow); overflow: hidden; animation: fpop .16s cubic-bezier(.2, .9, .3, 1.2); }
|
||||
@keyframes fpop { from { transform: translateY(-8px) scale(.98); } }
|
||||
.fin { display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 54px; border-bottom: 1px solid var(--line); flex: none; }
|
||||
.fin svg { width: 20px; height: 20px; fill: var(--muted); flex: none; }
|
||||
.fin input { flex: 1; min-width: 0; background: none; border: 0; outline: none; font-size: 17px; padding: 0; }
|
||||
.fres { overflow-y: auto; padding: 6px; overscroll-behavior: contain; }
|
||||
.fres.busy { opacity: .6; }
|
||||
.fgrp h4 { margin: 8px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
|
||||
.frow { display: flex; align-items: center; gap: 12px; padding: 6px 10px; border-radius: 8px; cursor: pointer; }
|
||||
.frow.on { background: var(--accent); color: var(--accent-ink); }
|
||||
.frow.on small, .frow.on .fkey { color: inherit; opacity: .8; }
|
||||
.fart { width: 38px; height: 38px; border-radius: 5px; overflow: hidden; background: var(--line); flex: none; }
|
||||
.fart.round { border-radius: 50%; }
|
||||
.fart img { width: 100%; height: 100%; object-fit: cover; display: block; }
|
||||
.fic { width: 38px; height: 38px; display: grid; place-items: center; flex: none; }
|
||||
.fic svg { width: 18px; height: 18px; fill: currentColor; }
|
||||
.ftx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
|
||||
.ftx b, .ftx small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.ftx b { font-weight: 600; font-size: 14px; }
|
||||
.ftx small { color: var(--muted); font-size: 12px; }
|
||||
.fkey { font-size: 12px; color: var(--muted); visibility: hidden; }
|
||||
.frow.on .fkey { visibility: visible; }
|
||||
.fall { margin-top: 4px; }
|
||||
.fmsg { margin: 14px 12px; color: var(--muted); font-size: 13px; }
|
||||
.fmsg kbd { margin: 0 2px; }
|
||||
body.finding { overflow: hidden; }
|
||||
|
||||
#toast { position: fixed; left: 50%; bottom: calc(var(--player-h) + 18px); transform: translate(-50%, 10px); z-index: 60; max-width: min(520px, calc(100% - 32px));
|
||||
background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 999px; font-weight: 500; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
|
||||
@@ -246,13 +291,20 @@ kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px;
|
||||
.keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
|
||||
.keys > div { display: flex; align-items: center; gap: 4px; min-height: 42px; padding: 8px 16px; font-size: 13px; border-top: 1px solid var(--line); margin-top: -1px; }
|
||||
.keys > div > span { flex: 1; color: var(--muted); }
|
||||
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
|
||||
.swatch { border: 1px solid; border-radius: 8px; padding: 10px 12px; text-align: left; font-weight: 600; font-size: 13px; display: flex; gap: 8px; align-items: center; transition: transform .12s; }
|
||||
.swatch:hover { transform: translateY(-1px); }
|
||||
.swatch i { width: 12px; height: 12px; border-radius: 50%; flex: none; }
|
||||
.swatch.on { outline: 2px solid var(--accent); outline-offset: 2px; }
|
||||
input[type=color] { width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: none; cursor: pointer; overflow: hidden; }
|
||||
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
|
||||
.themes { display: flex; gap: 14px; flex-wrap: wrap; }
|
||||
.tcard { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--muted); }
|
||||
.tcard.on { color: var(--text); font-weight: 600; }
|
||||
.tmock { width: 92px; height: 64px; border-radius: 10px; border: 1px solid; padding: 9px 10px; display: flex; flex-direction: column; gap: 5px;
|
||||
box-shadow: 0 0 0 0 var(--accent); transition: box-shadow .14s; }
|
||||
.tcard:hover .tmock { box-shadow: 0 0 0 2px var(--line); }
|
||||
.tcard.on .tmock { box-shadow: 0 0 0 3px var(--accent); }
|
||||
.tmock i { width: 40%; height: 5px; border-radius: 3px; opacity: .9; }
|
||||
.tmock b { height: 6px; border-radius: 3px; }
|
||||
.tmock u { width: 30%; height: 6px; border-radius: 3px; margin-top: auto; }
|
||||
.accents { display: flex; gap: 12px; flex-wrap: wrap; padding: 2px; }
|
||||
.dot { width: 28px; height: 28px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 0 var(--text); transition: box-shadow .12s, transform .12s; }
|
||||
.dot:hover { transform: scale(1.08); }
|
||||
.dot.on { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--text); }
|
||||
input[type=color]::-webkit-color-swatch { border: 0; border-radius: 50%; }
|
||||
input[type=color]::-moz-color-swatch { border: 0; border-radius: 50%; }
|
||||
.note { color: var(--muted); font-size: 13px; }
|
||||
@@ -383,7 +435,7 @@ input[type=range] { accent-color: var(--accent); }
|
||||
#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; }
|
||||
.navtop { padding: 0; gap: 4px; }
|
||||
#live { margin: 0; white-space: nowrap; }
|
||||
.settings { grid-template-columns: 1fr; gap: 0; }
|
||||
.toc { display: none; }
|
||||
|
||||
+3
-1
@@ -38,9 +38,11 @@ export const ICON = {
|
||||
pladd: '<svg viewBox="0 0 24 24"><path d="M3 5h13v2H3zm0 5h13v2H3zm0 5h8v2H3zm15-2h2v3h3v2h-3v3h-2v-3h-3v-2h3z"/></svg>',
|
||||
up: '<svg viewBox="0 0 24 24"><path d="M12 7.6l7.7 7.7-1.4 1.4-6.3-6.3-6.3 6.3-1.4-1.4z"/></svg>',
|
||||
down: '<svg viewBox="0 0 24 24"><path d="M12 16.4L4.3 8.7l1.4-1.4 6.3 6.3 6.3-6.3 1.4 1.4z"/></svg>',
|
||||
search: '<svg viewBox="0 0 24 24"><path d="M10.5 4a6.5 6.5 0 0 1 5.2 10.4l4.4 4.4-1.4 1.4-4.4-4.4A6.5 6.5 0 1 1 10.5 4zm0 2a4.5 4.5 0 1 0 0 9 4.5 4.5 0 0 0 0-9z"/></svg>',
|
||||
sort: '<svg viewBox="0 0 24 24"><path d="M7 4l4 4H8v12H6V8H3zm10 16l-4-4h3V4h2v12h3z"/></svg>',
|
||||
x: '<svg viewBox="0 0 24 24"><path d="M6.4 5L12 10.6 17.6 5 19 6.4 13.4 12l5.6 5.6-1.4 1.4-5.6-5.6L6.4 19 5 17.6 10.6 12 5 6.4z"/></svg>',
|
||||
lock: '<svg viewBox="0 0 24 24"><path d="M7 10V7a5 5 0 0 1 10 0v3h.5A1.5 1.5 0 0 1 19 11.5v8a1.5 1.5 0 0 1-1.5 1.5h-11A1.5 1.5 0 0 1 5 19.5v-8A1.5 1.5 0 0 1 6.5 10H7zm2 0h6V7a3 3 0 0 0-6 0v3z"/></svg>',
|
||||
play: '<svg viewBox="0 0 24 24"><path d="M7 4.5v15a1 1 0 0 0 1.5.86l12.5-7.5a1 1 0 0 0 0-1.72L8.5 3.64A1 1 0 0 0 7 4.5z"/></svg>',
|
||||
play: '<svg viewBox="0 0 24 24"><path d="M5.5 4.5v15a1 1 0 0 0 1.5.86l12.5-7.5a1 1 0 0 0 0-1.72L7 3.64A1 1 0 0 0 5.5 4.5z"/></svg>',
|
||||
pause: '<svg viewBox="0 0 24 24"><rect x="5.5" y="4" width="4.5" height="16" rx="1.2"/><rect x="14" y="4" width="4.5" height="16" rx="1.2"/></svg>',
|
||||
prev: '<svg viewBox="0 0 24 24"><rect x="4" y="5" width="2.5" height="14" rx="1"/><path d="M20 5.7v12.6a1 1 0 0 1-1.55.83L9 12.83a1 1 0 0 1 0-1.66l9.45-6.3A1 1 0 0 1 20 5.7z"/></svg>',
|
||||
next: '<svg viewBox="0 0 24 24"><rect x="17.5" y="5" width="2.5" height="14" rx="1"/><path d="M4 5.7v12.6a1 1 0 0 0 1.55.83L15 12.83a1 1 0 0 0 0-1.66l-9.45-6.3A1 1 0 0 0 4 5.7z"/></svg>',
|
||||
|
||||
Reference in new issue
Block a user