docs: update AGENTS.md and README for new features, add JS tests
Docs: - AGENTS.md: updated toolchain section with js-lint/js-test tasks, expanded web/ui/ directory listing, added event delegation and Web Audio API to key patterns, updated testing section - README: marked issue #9 (Audio Preview Player) as done - .gitignore: added akai-fetch.test and cover.out Tests: - Moved groupWavs and cleanName to util.js (pure functions) - Added 10 new JS tests: 6 groupWavs, 4 cleanName - Total JS tests: 29 (up from 19)
This commit is contained in:
@@ -200,29 +200,6 @@ let animationFrame = null;
|
||||
|
||||
document.getElementById('wav-browse-btn').addEventListener('click', browseWavs);
|
||||
|
||||
function groupWavs(paths) {
|
||||
const libs = {};
|
||||
for (const p of paths) {
|
||||
const parts = p.split('/');
|
||||
let lib, prog, file;
|
||||
if (parts.length === 1) {
|
||||
file = parts[0];
|
||||
} else if (parts.length === 2) {
|
||||
lib = parts[0]; prog = parts[0]; file = parts[1];
|
||||
} else {
|
||||
lib = parts[0]; prog = parts[1]; file = parts[parts.length - 1];
|
||||
}
|
||||
if (!libs[lib]) libs[lib] = {};
|
||||
if (!libs[lib][prog]) libs[lib][prog] = [];
|
||||
libs[lib][prog].push({ fullPath: p, name: file.replace(/\.wav$/i, '') });
|
||||
}
|
||||
return libs;
|
||||
}
|
||||
|
||||
function cleanName(name) {
|
||||
return name.replace(/_+/g, ' ').trim();
|
||||
}
|
||||
|
||||
function renderSampleCards(samples) {
|
||||
return samples.map(s => `
|
||||
<div class="sample-card" data-action="play" data-wav="${esc(s.fullPath)}">
|
||||
|
||||
Reference in New Issue
Block a user