mirror of
https://github.com/kristoferssolo/kristofersxyz.git
synced 2025-10-21 18:30:34 +00:00
Play audio on button press
This commit is contained in:
parent
cf4c205c5e
commit
78a9d3fd2c
@ -1,11 +1,10 @@
|
|||||||
let lightmode = localStorage.getItem("lightmode")
|
let lightmode = localStorage.getItem("lightmode")
|
||||||
const HTML = document.documentElement
|
const HTML = document.documentElement
|
||||||
|
const AUDIO = document.getElementById("flashbang")
|
||||||
|
|
||||||
const ENABLE_LIGHT_MODE = () => {
|
const ENABLE_LIGHT_MODE = () => {
|
||||||
const AUDIO = document.getElementById("flashbang")
|
|
||||||
HTML.setAttribute("data-color-mode", "light")
|
HTML.setAttribute("data-color-mode", "light")
|
||||||
localStorage.setItem("lightmode", "enabled")
|
localStorage.setItem("lightmode", "enabled")
|
||||||
AUDIO.play()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const DISABLE_LIGHT_MODE = () => {
|
const DISABLE_LIGHT_MODE = () => {
|
||||||
@ -21,6 +20,7 @@ document.querySelector("#color-mode-toggle").addEventListener("click", () => {
|
|||||||
lightmode = localStorage.getItem("lightmode")
|
lightmode = localStorage.getItem("lightmode")
|
||||||
if (lightmode !== "enabled") {
|
if (lightmode !== "enabled") {
|
||||||
ENABLE_LIGHT_MODE()
|
ENABLE_LIGHT_MODE()
|
||||||
|
AUDIO.play()
|
||||||
} else {
|
} else {
|
||||||
DISABLE_LIGHT_MODE()
|
DISABLE_LIGHT_MODE()
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user