diff --git a/webui/static/script.js b/webui/static/script.js index a954a9e6..c317dee4 100644 --- a/webui/static/script.js +++ b/webui/static/script.js @@ -6704,9 +6704,13 @@ function renderMusicPaths(paths) { container.innerHTML = paths.map((p, i) => `
- +
`).join(''); + // Attach auto-save to dynamically rendered inputs + container.querySelectorAll('.music-path-input').forEach(input => { + input.addEventListener('change', () => { if (typeof debouncedAutoSaveSettings === 'function') debouncedAutoSaveSettings(); }); + }); } function addMusicPathRow() { @@ -6720,10 +6724,19 @@ function addMusicPathRow() { row.style.marginBottom = '4px'; row.innerHTML = ` - + `; container.appendChild(row); - row.querySelector('input').focus(); + const input = row.querySelector('input'); + input.focus(); + // Auto-save when the user finishes typing a path + input.addEventListener('change', () => { if (typeof debouncedAutoSaveSettings === 'function') debouncedAutoSaveSettings(); }); +} + +function _removeMusicPathRow(btn) { + btn.closest('.music-path-row').remove(); + // Auto-save after removing a path + if (typeof debouncedAutoSaveSettings === 'function') debouncedAutoSaveSettings(); } function collectMusicPaths() {