diff options
| author | stonedDiscord <Tukz@gmx.de> | 2025-06-26 18:37:43 +0200 |
|---|---|---|
| committer | stonedDiscord <Tukz@gmx.de> | 2025-06-26 18:37:43 +0200 |
| commit | 970341acbc3a8f3ff8b36d54b3ca383f539c815b (patch) | |
| tree | d01548679aeccd0c62b28c9396ec040c837ba350 /webAO | |
| parent | 774ae2255f71f8939b365796f703579e1ee245af (diff) | |
convert vol to ts
Diffstat (limited to 'webAO')
| -rw-r--r-- | webAO/dom/changeVolume.js | 30 | ||||
| -rw-r--r-- | webAO/dom/changeVolume.ts | 51 |
2 files changed, 51 insertions, 30 deletions
diff --git a/webAO/dom/changeVolume.js b/webAO/dom/changeVolume.js deleted file mode 100644 index bae82d2..0000000 --- a/webAO/dom/changeVolume.js +++ /dev/null @@ -1,30 +0,0 @@ -import setCookie from "../utils/setCookie.ts"; - -/** - * Triggered by the sound effect volume slider. - */ - -export function changeSFXVolume() { - setCookie("sfxVolume", document.getElementById("client_sfxaudio").volume); -} -window.changeSFXVolume = changeSFXVolume; - -/** - * Triggered by the testimony volume slider. - */ -export function changeTestimonyVolume() { - setCookie( - "testimonyVolume", - document.getElementById("client_testimonyaudio").volume, - ); -} -window.changeTestimonyVolume = changeTestimonyVolume; - -/** - * Triggered by the shout volume slider. - */ - -export function changeShoutVolume() { - setCookie("shoutVolume", document.getElementById("client_shoutaudio").volume); -} -window.changeShoutVolume = changeShoutVolume; diff --git a/webAO/dom/changeVolume.ts b/webAO/dom/changeVolume.ts new file mode 100644 index 0000000..0c94aa6 --- /dev/null +++ b/webAO/dom/changeVolume.ts @@ -0,0 +1,51 @@ +import setCookie from "../utils/setCookie"; + +declare global { + interface Window { + changeSFXVolume: () => void; + changeTestimonyVolume: () => void; + changeShoutVolume: () => void; + } +} + +/** + * Triggered by the sound effect volume slider. + */ +export function changeSFXVolume(): void { + const sfxAudioElement = document.getElementById("client_sfxaudio") as HTMLAudioElement; + if (sfxAudioElement) { + setCookie("sfxVolume", sfxAudioElement.volume); + } +} +if (typeof window.changeSFXVolume !== 'function') { + window.changeSFXVolume = changeSFXVolume; +} + +/** + * Triggered by the testimony volume slider. + */ +export function changeTestimonyVolume(): void { + const testimonyAudioElement = document.getElementById("client_testimonyaudio") as HTMLAudioElement; + if (testimonyAudioElement) { + setCookie( + "testimonyVolume", + testimonyAudioElement.volume + ); + } +} +if (typeof window.changeTestimonyVolume !== 'function') { + window.changeTestimonyVolume = changeTestimonyVolume; +} + +/** + * Triggered by the shout volume slider. + */ +export function changeShoutVolume(): void { + const shoutAudioElement = document.getElementById("client_shoutaudio") as HTMLAudioElement; + if (shoutAudioElement) { + setCookie("shoutVolume", shoutAudioElement.volume); + } +} +if (typeof window.changeShoutVolume !== 'function') { + window.changeShoutVolume = changeShoutVolume; +}
\ No newline at end of file |
