This commit is contained in:
2026-10-01 00:58:00 +02:00
parent 61d86cf727
commit 3a88bb6ad3
14 changed files with 1076 additions and 43 deletions
+10 -5
View File
@@ -7373,11 +7373,14 @@ window.cancelAnimFrame = (function () {
const f = input.files && input.files[0];
input.value = '';
if (!f || !api()) return;
const r = await api().setCustomSound(f);
const r = api().setFile ? await api().setFile(key, f) : await api().setCustomSound(f);
if (!r.ok && window.flashMessage) window.flashMessage(r.msg || 'Could not use that file', 3000, 'error');
else if (api()) api().preview();
else if (key === 'customSound' && api()) api().preview();
});
rowEl.querySelector('[data-sqc-clear]').addEventListener('click', () => {
if (!api()) return;
if (api().clearFile) api().clearFile(key); else api().clearCustomSound();
});
rowEl.querySelector('[data-sqc-clear]').addEventListener('click', () => { if (api()) api().clearCustomSound(); });
return;
}
const input = rowEl.querySelector('input, select');
@@ -7406,8 +7409,10 @@ window.cancelAnimFrame = (function () {
const row = a.schema.find(r => r.key === key);
const valEl = rowEl.querySelector('[data-sqc-value]');
if (row.type === 'file') {
if (valEl) valEl.textContent = st.customSound || 'none';
rowEl.style.opacity = st.hitSound === 'custom' || !st.customSound ? '' : '0.6';
// file name, dimmed while the setting that uses it is not selected (activeWhen: [key, value])
if (valEl) valEl.textContent = st[key] || 'none';
const on = !row.activeWhen || st[row.activeWhen[0]] === row.activeWhen[1];
rowEl.style.opacity = on || !st[key] ? '' : '0.6';
return;
}
if (row.showIf) rowEl.style.display = +st[row.showIf] ? '' : 'none';