feat: remove per-file waveform SVG from the analyse view
Same rationale as the day timeline: purely visual, useless via screen
reader. The section count it carried in its aria-label moved into the
meta line ("N loud sections - margin: 12 dB - gap: 2s - min: 0.5s").
drawWave() and the svg.wave CSS are gone; the UI now renders no SVG at
all. /api/analyze still returns rms_display for API stability, but the
bundled UI no longer reads it.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
+3
-40
@@ -63,7 +63,6 @@ button.del{color:var(--red);border-color:#7f1d1d}
|
||||
button.del:hover:not(:disabled){background:#2d0808}
|
||||
/* waveform */
|
||||
.wbox{background:var(--surf);border:1px solid var(--brd);border-radius:6px;padding:10px 12px}
|
||||
svg.wave{display:block;width:100%;height:56px}
|
||||
.chips{display:flex;flex-wrap:wrap;gap:5px;margin-top:8px}
|
||||
.chips[hidden]{display:none}
|
||||
.chip{background:#431407;color:var(--orange);border:1px solid #7c2d12;border-radius:4px;
|
||||
@@ -317,42 +316,6 @@ function togglePlayer(idx, filename) {
|
||||
audio.focus();
|
||||
}
|
||||
|
||||
function drawWave(rms, sections, duration, filename) {
|
||||
const ns = 'http://www.w3.org/2000/svg';
|
||||
const svg = document.createElementNS(ns,'svg');
|
||||
svg.setAttribute('class','wave');
|
||||
svg.setAttribute('viewBox',`0 0 ${rms.length} 1`);
|
||||
svg.setAttribute('preserveAspectRatio','none');
|
||||
svg.setAttribute('role','img');
|
||||
const nSec = sections ? sections.length : 0;
|
||||
svg.setAttribute('aria-label',
|
||||
`Waveform for ${filename}: duration ${fmtDur(duration)}, ${nSec} loud section${nSec!==1?'s':''}`);
|
||||
|
||||
if (duration > 0 && sections) {
|
||||
sections.forEach(s => {
|
||||
const r = document.createElementNS(ns,'rect');
|
||||
r.setAttribute('x', (s.start/duration)*rms.length);
|
||||
r.setAttribute('y', 0);
|
||||
r.setAttribute('width', ((s.end-s.start)/duration)*rms.length);
|
||||
r.setAttribute('height', 1);
|
||||
r.setAttribute('fill','rgba(249,115,22,0.22)');
|
||||
r.setAttribute('aria-hidden','true');
|
||||
svg.appendChild(r);
|
||||
});
|
||||
}
|
||||
const maxV = Math.max(...rms, 0.001);
|
||||
rms.forEach((v,i) => {
|
||||
const h = v/maxV;
|
||||
const r = document.createElementNS(ns,'rect');
|
||||
r.setAttribute('x',i); r.setAttribute('y',1-h);
|
||||
r.setAttribute('width',1); r.setAttribute('height',h);
|
||||
r.setAttribute('fill','#4f9cf9');
|
||||
r.setAttribute('aria-hidden','true');
|
||||
svg.appendChild(r);
|
||||
});
|
||||
return svg;
|
||||
}
|
||||
|
||||
function parseTime(s) {
|
||||
if (!s || !s.trim()) return null;
|
||||
const parts = s.trim().split(':').map(v => parseFloat(v));
|
||||
@@ -528,10 +491,10 @@ async function analyse(idx, filename, cell, btn, force = false) {
|
||||
restoreBtn(); return;
|
||||
}
|
||||
const box = document.createElement('div'); box.className='wbox';
|
||||
box.appendChild(drawWave(d.rms_display||[], d.sections||[], d.duration||0, filename));
|
||||
|
||||
const nSec = (d.sections || []).length;
|
||||
const meta = document.createElement('div'); meta.className='analysis-meta';
|
||||
meta.textContent = `margin: ${margin} dB · gap: ${minGap}s · min: ${minDur}s${d.cached ? ' · cached' : ''}`;
|
||||
meta.textContent = `${nSec} loud section${nSec!==1?'s':''}`
|
||||
+ ` · margin: ${margin} dB · gap: ${minGap}s · min: ${minDur}s${d.cached ? ' · cached' : ''}`;
|
||||
box.appendChild(meta);
|
||||
|
||||
const chips = document.createElement('div');
|
||||
|
||||
Reference in New Issue
Block a user