Valgbare jingler: seks innebygde + egne filer i chimes/
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
45a22e7ed6
commit
756a234b13
4 changed files with 166 additions and 31 deletions
14
index.html
14
index.html
|
|
@ -86,8 +86,9 @@
|
|||
<label for="speed">Hastighet <span id="speedval">1.0×</span></label>
|
||||
<input id="speed" type="range" min="0.7" max="1.4" step="0.05" value="1.0">
|
||||
</div>
|
||||
<div style="flex:0 1 auto">
|
||||
<div class="check"><input id="chime" type="checkbox" checked><label for="chime" style="margin:0;text-transform:none;letter-spacing:0;color:var(--fg)">Ding-dong først</label></div>
|
||||
<div>
|
||||
<label for="chime">Jingle først</label>
|
||||
<select id="chime"></select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -132,7 +133,7 @@ const QUICK = [
|
|||
|
||||
function key() { return JSON.stringify(payload()); }
|
||||
function payload() {
|
||||
return { text: text.value.trim(), voice: voice.value, speed: parseFloat(speed.value), chime: chime.checked };
|
||||
return { text: text.value.trim(), voice: voice.value, speed: parseFloat(speed.value), chime: chime.value };
|
||||
}
|
||||
function headers() {
|
||||
const h = { 'Content-Type': 'application/json' };
|
||||
|
|
@ -163,6 +164,11 @@ async function init() {
|
|||
}
|
||||
voice.value = localStorage.getItem('voice') || cfg.default_voice;
|
||||
if (!voice.value) voice.value = cfg.default_voice;
|
||||
for (const c of cfg.chimes) {
|
||||
const o = document.createElement('option'); o.value = c.id; o.textContent = c.name; chime.append(o);
|
||||
}
|
||||
chime.value = localStorage.getItem('chime') || cfg.default_chime;
|
||||
if (!chime.value) chime.value = cfg.default_chime;
|
||||
$('#max').textContent = cfg.max_chars; text.maxLength = cfg.max_chars;
|
||||
if (cfg.pin_required) { $('#pinbox').style.display = 'block'; $('#pin').value = localStorage.getItem('pin') || ''; }
|
||||
for (const q of QUICK) {
|
||||
|
|
@ -176,7 +182,7 @@ async function init() {
|
|||
text.addEventListener('input', () => { $('#count').textContent = text.value.length; updateAnnounce(); });
|
||||
voice.addEventListener('change', () => { localStorage.setItem('voice', voice.value); updateAnnounce(); });
|
||||
speed.addEventListener('input', () => { $('#speedval').textContent = parseFloat(speed.value).toFixed(2).replace(/0$/, '') + '×'; updateAnnounce(); });
|
||||
chime.addEventListener('change', updateAnnounce);
|
||||
chime.addEventListener('change', () => { localStorage.setItem('chime', chime.value); updateAnnounce(); });
|
||||
$('#pin').addEventListener('input', e => localStorage.setItem('pin', e.target.value));
|
||||
|
||||
btnPreview.addEventListener('click', async () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue