Lyrics Studio logo returns to the admin home; Stamp now works on any line

This commit is contained in:
Jonathan Sykes
2026-10-11 04:08:32 +08:00
parent 785e903e1e
commit 955dd54e5a

View File

@@ -321,7 +321,7 @@
<!-- ============ sign-in ============ -->
<div id="loginBox" class="gate hidden">
<div class="brand"><i><svg viewBox="0 0 24 24"><path d="M9 18V6l10-2v12"/><circle cx="6.5" cy="18" r="2.5"/><circle cx="16.5" cy="16" r="2.5"/></svg></i>Lyrics Studio</div>
<a class="brand" href="/admin#editor" data-home style="text-decoration:none;color:inherit"><i><svg viewBox="0 0 24 24"><path d="M9 18V6l10-2v12"/><circle cx="6.5" cy="18" r="2.5"/><circle cx="16.5" cy="16" r="2.5"/></svg></i>Lyrics Studio</a>
<div class="card">
<h2>Sign in</h2>
<p class="muted">Admin password</p>
@@ -340,7 +340,7 @@
<div id="app" class="hidden">
<header class="top">
<div class="brand"><i><svg viewBox="0 0 24 24"><path d="M9 18V6l10-2v12"/><circle cx="6.5" cy="18" r="2.5"/><circle cx="16.5" cy="16" r="2.5"/></svg></i>Lyrics Studio</div>
<a class="brand" href="/admin#editor" data-home style="text-decoration:none;color:inherit"><i><svg viewBox="0 0 24 24"><path d="M9 18V6l10-2v12"/><circle cx="6.5" cy="18" r="2.5"/><circle cx="16.5" cy="16" r="2.5"/></svg></i>Lyrics Studio</a>
<nav class="tabs" role="tablist" id="tabsTop"></nav>
<span class="grow"></span>
<a class="ghost desk" href="/">← Back to app</a>
@@ -1358,7 +1358,9 @@
}
function seek(t) { if (!LE.audio) return; LE.audio.currentTime = Math.max(0, Math.min(LE.dur || 1e9, t)); tick(); }
function stamp(i) {
if (!LE.audio || i < 0 || i >= LE.lines.length) return;
if (i < 0 || i >= LE.lines.length) return;
if (!LE.audio) { say('The audio is still loading — try again in a moment.', 'err'); return; }
if (LE.sel !== i) select(i);
edit(() => { LE.lines[i].t = r2(cur()); });
paintRow(i); progress(); lastIdx = -2; tick(); tapLabel();
}
@@ -1367,7 +1369,7 @@
$('lines').addEventListener('click', async (e) => {
const row = e.target.closest('.ln'); if (!row) return;
const i = Number(row.dataset.i);
if (LE.sel !== i) select(i);
if (LE.sel !== i || !row.classList.contains('sel')) select(i);
const btn = e.target.closest('button[data-act]'); if (!btn) return;
const act = btn.dataset.act;
if (act === 'chip') {
@@ -1420,6 +1422,13 @@
$('bUndo').addEventListener('click', doUndo);
$('bRedo').addEventListener('click', doRedo);
$('bTools').addEventListener('click', () => { const on = $('drawer').classList.toggle('hidden') === false; $('bTools').setAttribute('aria-pressed', String(on)); });
document.querySelectorAll('[data-home]').forEach((a) => a.addEventListener('click', (e) => {
e.preventDefault();
if (!$('app').classList.contains('hidden')) {
if (LE.loaded && !$('studio').classList.contains('hidden')) $('closeSong').click();
showTab('editor');
} else location.href = '/admin#editor';
}));
$('closeSong').addEventListener('click', () => {
if (LE.dirty && !confirm('Discard the unsaved changes to this song?')) return;
if (LE.audio) { LE.audio.pause(); LE.audio = null; }