forked from extern/easydiffusion
Persist audio toggle setting
This commit is contained in:
parent
5542b5e9a6
commit
8e2074d29d
16
index.html
16
index.html
@ -69,10 +69,20 @@
|
|||||||
</body>
|
</body>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
const SOUND_ENABLED_KEY = "soundEnabled"
|
||||||
|
document.querySelector('#sound_toggle').checked = isSoundEnabled();
|
||||||
|
|
||||||
const HEALTH_PING_INTERVAL = 5 // seconds
|
const HEALTH_PING_INTERVAL = 5 // seconds
|
||||||
|
|
||||||
let serverStatus = 'offline'
|
let serverStatus = 'offline'
|
||||||
|
|
||||||
|
function isSoundEnabled() {
|
||||||
|
if (localStorage.getItem(SOUND_ENABLED_KEY) === 'false') {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
function setStatus(statusType, msg, msgType) {
|
function setStatus(statusType, msg, msgType) {
|
||||||
let el = ''
|
let el = ''
|
||||||
|
|
||||||
@ -230,6 +240,12 @@ async function makeImage() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleAudioEnabledChange(e) {
|
||||||
|
localStorage.setItem(SOUND_ENABLED_KEY, e.target.checked.toString())
|
||||||
|
}
|
||||||
|
|
||||||
|
document.querySelector('#sound_toggle').addEventListener('click', handleAudioEnabledChange)
|
||||||
|
|
||||||
document.querySelector('#makeImage').addEventListener('click', makeImage)
|
document.querySelector('#makeImage').addEventListener('click', makeImage)
|
||||||
|
|
||||||
let config = document.querySelector('#config')
|
let config = document.querySelector('#config')
|
||||||
|
Loading…
Reference in New Issue
Block a user