aboutsummaryrefslogtreecommitdiff
path: root/webAO/client/loadResources.ts
diff options
context:
space:
mode:
authorstonedDiscord <stonedDiscord@users.noreply.github.com>2024-11-20 13:31:50 +0000
committerGitHub Action <actions@github.com>2024-11-20 13:31:50 +0000
commit6684f3fce6e90fd0574d7bab63b629554ab03ef6 (patch)
treeb2a62247d17e23a77af57aea355ba621666817c2 /webAO/client/loadResources.ts
parent95a2d1361d84c61b454ebe506e6963b93f6d8dee (diff)
Prettified Code!
Diffstat (limited to 'webAO/client/loadResources.ts')
-rw-r--r--webAO/client/loadResources.ts129
1 files changed, 66 insertions, 63 deletions
diff --git a/webAO/client/loadResources.ts b/webAO/client/loadResources.ts
index 4954966..2608ace 100644
--- a/webAO/client/loadResources.ts
+++ b/webAO/client/loadResources.ts
@@ -1,81 +1,84 @@
import getCookie from "../utils/getCookie";
import vanilla_evidence_arr from "../constants/evidence.js";
import vanilla_background_arr from "../constants/backgrounds.js";
-import { changeMusicVolume } from '../dom/changeMusicVolume'
+import { changeMusicVolume } from "../dom/changeMusicVolume";
import { setChatbox } from "../dom/setChatbox";
-import { changeSFXVolume, changeShoutVolume, changeTestimonyVolume } from "../dom/changeVolume";
+import {
+ changeSFXVolume,
+ changeShoutVolume,
+ changeTestimonyVolume,
+} from "../dom/changeVolume";
import { showname_click } from "../dom/showNameClick";
-import { changeBlipVolume } from '../dom/changeBlipVolume'
-import { reloadTheme } from '../dom/reloadTheme'
+import { changeBlipVolume } from "../dom/changeBlipVolume";
+import { reloadTheme } from "../dom/reloadTheme";
const version = process.env.npm_package_version;
/**
- * Load game resources and stored settings.
- */
+ * Load game resources and stored settings.
+ */
export const loadResources = () => {
- document.getElementById("client_version")!.innerText = `version ${version}`;
- // Load background array to select
- const background_select = <HTMLSelectElement>(
- document.getElementById("bg_select")
- );
- background_select.add(new Option("Custom", "0"));
- vanilla_background_arr.forEach((background) => {
- background_select.add(new Option(background));
- });
+ document.getElementById("client_version")!.innerText = `version ${version}`;
+ // Load background array to select
+ const background_select = <HTMLSelectElement>(
+ document.getElementById("bg_select")
+ );
+ background_select.add(new Option("Custom", "0"));
+ vanilla_background_arr.forEach((background) => {
+ background_select.add(new Option(background));
+ });
- // Load evidence array to select
- const evidence_select = <HTMLSelectElement>(
- document.getElementById("evi_select")
- );
- evidence_select.add(new Option("Custom", "0"));
- vanilla_evidence_arr.forEach((evidence) => {
- evidence_select.add(new Option(evidence));
- });
+ // Load evidence array to select
+ const evidence_select = <HTMLSelectElement>(
+ document.getElementById("evi_select")
+ );
+ evidence_select.add(new Option("Custom", "0"));
+ vanilla_evidence_arr.forEach((evidence) => {
+ evidence_select.add(new Option(evidence));
+ });
- // Read cookies and set the UI to its values
- (<HTMLInputElement>document.getElementById("OOC_name")).value =
- getCookie("OOC_name") ||
- `web${String(Math.round(Math.random() * 100 + 10))}`;
+ // Read cookies and set the UI to its values
+ (<HTMLInputElement>document.getElementById("OOC_name")).value =
+ getCookie("OOC_name") ||
+ `web${String(Math.round(Math.random() * 100 + 10))}`;
- // Read cookies and set the UI to its values
- const cookietheme = getCookie("theme") || "default";
+ // Read cookies and set the UI to its values
+ const cookietheme = getCookie("theme") || "default";
- (<HTMLOptionElement>(
- document.querySelector(`#client_themeselect [value="${cookietheme}"]`)
- )).selected = true;
- reloadTheme();
+ (<HTMLOptionElement>(
+ document.querySelector(`#client_themeselect [value="${cookietheme}"]`)
+ )).selected = true;
+ reloadTheme();
- const cookiechatbox = getCookie("chatbox") || "dynamic";
+ const cookiechatbox = getCookie("chatbox") || "dynamic";
- (<HTMLOptionElement>(
- document.querySelector(`#client_chatboxselect [value="${cookiechatbox}"]`)
- )).selected = true;
- setChatbox(cookiechatbox);
+ (<HTMLOptionElement>(
+ document.querySelector(`#client_chatboxselect [value="${cookiechatbox}"]`)
+ )).selected = true;
+ setChatbox(cookiechatbox);
- (<HTMLInputElement>document.getElementById("client_mvolume")).value =
- getCookie("musicVolume") || "1";
- changeMusicVolume();
- (<HTMLAudioElement>document.getElementById("client_sfxaudio")).volume =
- Number(getCookie("sfxVolume")) || 1;
- changeSFXVolume();
- (<HTMLAudioElement>document.getElementById("client_shoutaudio")).volume =
- Number(getCookie("shoutVolume")) || 1;
- changeShoutVolume();
- (<HTMLAudioElement>(
- document.getElementById("client_testimonyaudio")
- )).volume = Number(getCookie("testimonyVolume")) || 1;
- changeTestimonyVolume();
- (<HTMLInputElement>document.getElementById("client_bvolume")).value =
- getCookie("blipVolume") || "1";
- changeBlipVolume();
+ (<HTMLInputElement>document.getElementById("client_mvolume")).value =
+ getCookie("musicVolume") || "1";
+ changeMusicVolume();
+ (<HTMLAudioElement>document.getElementById("client_sfxaudio")).volume =
+ Number(getCookie("sfxVolume")) || 1;
+ changeSFXVolume();
+ (<HTMLAudioElement>document.getElementById("client_shoutaudio")).volume =
+ Number(getCookie("shoutVolume")) || 1;
+ changeShoutVolume();
+ (<HTMLAudioElement>document.getElementById("client_testimonyaudio")).volume =
+ Number(getCookie("testimonyVolume")) || 1;
+ changeTestimonyVolume();
+ (<HTMLInputElement>document.getElementById("client_bvolume")).value =
+ getCookie("blipVolume") || "1";
+ changeBlipVolume();
- (<HTMLInputElement>document.getElementById("ic_chat_name")).value =
- getCookie("ic_chat_name");
- (<HTMLInputElement>document.getElementById("showname")).checked = Boolean(
- getCookie("showname")
- );
- showname_click(null);
+ (<HTMLInputElement>document.getElementById("ic_chat_name")).value =
+ getCookie("ic_chat_name");
+ (<HTMLInputElement>document.getElementById("showname")).checked = Boolean(
+ getCookie("showname"),
+ );
+ showname_click(null);
- (<HTMLInputElement>document.getElementById("client_callwords")).value =
- getCookie("callwords");
-} \ No newline at end of file
+ (<HTMLInputElement>document.getElementById("client_callwords")).value =
+ getCookie("callwords");
+};