-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptions.js
More file actions
27 lines (23 loc) · 988 Bytes
/
options.js
File metadata and controls
27 lines (23 loc) · 988 Bytes
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
// Function to generate voice volume options dynamically
function generateVolumeOptions() {
const voiceVolumeSelect = document.getElementById('voiceVolumeSelect');
for (let i = 0; i <= 100; i++) {
const option = document.createElement('option');
option.value = i;
option.textContent = i;
voiceVolumeSelect.appendChild(option);
}
// Retrieve the saved volume from localStorage if it exists
const savedVolume = localStorage.getItem('selectedVolume');
if (savedVolume !== null) {
voiceVolumeSelect.value = savedVolume;
}
// Listen for change event on select element
voiceVolumeSelect.addEventListener('change', function (event) {
const selectedVolume = event.target.value;
// Save the selected volume in localStorage
localStorage.setItem('selectedVolume', selectedVolume);
});
}
// Call the function to generate the volume options on page load
window.onload = generateVolumeOptions;