aboutsummaryrefslogtreecommitdiff
path: root/webAO/dom/changeVolume.ts
blob: 0c94aa6c85f69162a39064e405f4c1d2dad6edfc (plain)
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
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;
}