-
-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathAudioPlaybackSpeed.svelte
More file actions
76 lines (68 loc) · 2.06 KB
/
AudioPlaybackSpeed.svelte
File metadata and controls
76 lines (68 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<script lang="ts">
import { monoIconColor, t, userSettings } from '$lib/data/stores';
import Modal from './Modal.svelte';
let modalId = 'playback';
// Array of speed options
const speeds = [
{ value: '0.4', label: '0.4x' },
{ value: '0.6', label: '0.6x' },
{ value: '0.7', label: '0.7x' },
{ value: '0.8', label: '0.8x' },
{ value: '0.9', label: '0.9x' },
{ value: '1.0', label: $t['Settings_Audio_Speed_Normal'] },
{ value: '1.1', label: '1.1x' },
{ value: '1.2', label: '1.2x' },
{ value: '1.3', label: '1.3x' },
{ value: '1.4', label: '1.4x' },
{ value: '1.6', label: '1.6x' }
];
function setPlaySpeed(value: string) {
$userSettings['audio-speed'] = value;
}
let modalThis: HTMLDialogElement;
export function showModal() {
modalThis.showModal();
}
</script>
<Modal bind:dialog={modalThis} id={modalId}>
<div style="color: {$monoIconColor}">
<h1>
<b>{$t['Settings_Audio_Speed']}</b>
</h1>
<div class="speed-controls">
{#each speeds as { value, label }}
<label>
<input
type="radio"
name="speed"
{value}
on:click={(e) => setPlaySpeed(e.currentTarget.value)}
checked={$userSettings['audio-speed'] === value}
/>
{label}
</label>
{/each}
<div class="dy-modal-action close-btn">
<button class="dy-btn dy-btn-ghost">{$t['Button_Close']}</button>
</div>
</div>
</div>
</Modal>
<style>
.close-btn {
display: flex;
justify-content: center;
margin: 0 auto;
}
.speed-controls {
align-items: left;
margin-top: 10px;
display: flex;
flex-direction: column;
}
label {
margin-right: 0px;
margin-top: 10px;
margin-bottom: 10px;
}
</style>