aboutsummaryrefslogtreecommitdiff
path: root/webAO/dom
diff options
context:
space:
mode:
Diffstat (limited to 'webAO/dom')
-rw-r--r--webAO/dom/changeBlipVolume.ts15
-rw-r--r--webAO/dom/changeMusicVolume.ts14
-rw-r--r--webAO/dom/iniEdit.ts10
-rw-r--r--webAO/dom/muteListClick.ts19
-rw-r--r--webAO/dom/opusCheck.ts2
-rw-r--r--webAO/dom/reloadTheme.ts16
-rw-r--r--webAO/dom/resizeChatbox.ts1
-rw-r--r--webAO/dom/setChatbox.ts3
-rw-r--r--webAO/dom/showNameClick.ts2
-rw-r--r--webAO/dom/twofactor.ts10
-rw-r--r--webAO/dom/updateIniswap.ts18
-rw-r--r--webAO/dom/window.ts2
12 files changed, 105 insertions, 7 deletions
diff --git a/webAO/dom/changeBlipVolume.ts b/webAO/dom/changeBlipVolume.ts
new file mode 100644
index 0000000..572f389
--- /dev/null
+++ b/webAO/dom/changeBlipVolume.ts
@@ -0,0 +1,15 @@
+import setCookie from "../utils/setCookie";
+import { client } from '../client'
+/**
+ * Triggered by the blip volume slider.
+ */
+export const changeBlipVolume = () => {
+ const blipVolume = (<HTMLInputElement>(
+ document.getElementById("client_bvolume")
+ )).value;
+ client.viewport.blipChannels.forEach(
+ (channel: HTMLAudioElement) => (channel.volume = Number(blipVolume))
+ );
+ setCookie("blipVolume", blipVolume);
+}
+window.changeBlipVolume = changeBlipVolume;
diff --git a/webAO/dom/changeMusicVolume.ts b/webAO/dom/changeMusicVolume.ts
new file mode 100644
index 0000000..9e5d51a
--- /dev/null
+++ b/webAO/dom/changeMusicVolume.ts
@@ -0,0 +1,14 @@
+import { client } from '../client'
+import setCookie from '../utils/setCookie';
+
+export const changeMusicVolume = (volume: number = -1) => {
+ const clientVolume = Number(
+ (<HTMLInputElement>document.getElementById("client_mvolume")).value
+ );
+ let musicVolume = volume === -1 ? clientVolume : volume;
+ client.viewport.music.forEach(
+ (channel: HTMLAudioElement) => (channel.volume = musicVolume)
+ );
+ setCookie("musicVolume", String(musicVolume));
+};
+window.changeMusicVolume = changeMusicVolume; \ No newline at end of file
diff --git a/webAO/dom/iniEdit.ts b/webAO/dom/iniEdit.ts
index 359a226..b26c179 100644
--- a/webAO/dom/iniEdit.ts
+++ b/webAO/dom/iniEdit.ts
@@ -1,14 +1,18 @@
import { client } from "../client";
+import { handleCharacterInfo } from "../client/handleCharacterInfo";
import { packetHandler } from "../packets/packetHandler";
/**
* Triggered by the ini button.
*/
export async function iniedit() {
- const ininame = (<HTMLInputElement>document.getElementById("client_ininame"))
- .value;
+ const iniselect = (<HTMLSelectElement>document.getElementById("client_iniselect"))
+ const ininame = (<HTMLInputElement>document.getElementById("client_ininame"));
const inicharID = client.charID;
- await client.handleCharacterInfo(ininame.split("&"), inicharID);
+
+ const newname = iniselect.selectedIndex === 0 ? ininame.value : iniselect.value;
+
+ await handleCharacterInfo(newname.split("&"), inicharID);
packetHandler.get("PV")!(`PV#0#CID#${inicharID}`.split("#"));
}
window.iniedit = iniedit;
diff --git a/webAO/dom/muteListClick.ts b/webAO/dom/muteListClick.ts
new file mode 100644
index 0000000..e7c9357
--- /dev/null
+++ b/webAO/dom/muteListClick.ts
@@ -0,0 +1,19 @@
+import { client } from "../client";
+/**
+ * Triggered when a character in the mute list is clicked
+ * @param {MouseEvent} event
+ */
+export function mutelist_click(_event: Event) {
+ const mutelist = <HTMLSelectElement>(document.getElementById('mute_select'));
+ const selected_character = mutelist.options[mutelist.selectedIndex];
+
+ if (client.chars[selected_character.value].muted === false) {
+ client.chars[selected_character.value].muted = true;
+ selected_character.text = `${client.chars[selected_character.value].name} (muted)`;
+ console.info(`muted ${client.chars[selected_character.value].name}`);
+ } else {
+ client.chars[selected_character.value].muted = false;
+ selected_character.text = client.chars[selected_character.value].name;
+ }
+}
+window.mutelist_click = mutelist_click; \ No newline at end of file
diff --git a/webAO/dom/opusCheck.ts b/webAO/dom/opusCheck.ts
index 939fdc6..5f0248d 100644
--- a/webAO/dom/opusCheck.ts
+++ b/webAO/dom/opusCheck.ts
@@ -9,7 +9,7 @@ export function opusCheck(
if (audio === "") {
return;
}
- console.info(`failed to load sound ${channel.src}`);
+ console.warn(`failed to load sound ${channel.src}`);
let oldsrc = "";
let newsrc = "";
oldsrc = channel.src;
diff --git a/webAO/dom/reloadTheme.ts b/webAO/dom/reloadTheme.ts
new file mode 100644
index 0000000..bfa46b6
--- /dev/null
+++ b/webAO/dom/reloadTheme.ts
@@ -0,0 +1,16 @@
+import { client } from '../client'
+import setCookie from '../utils/setCookie';
+
+/**
+ * Triggered by the theme selector.
+ */
+export const reloadTheme = () => {
+ client.viewport.setTheme((<HTMLSelectElement>document.getElementById("client_themeselect"))
+ .value);
+
+ setCookie("theme", client.viewport.getTheme());
+ (<HTMLAnchorElement>(
+ document.getElementById("client_theme")
+ )).href = `styles/${client.viewport.getTheme()}.css`;
+}
+window.reloadTheme = reloadTheme; \ No newline at end of file
diff --git a/webAO/dom/resizeChatbox.ts b/webAO/dom/resizeChatbox.ts
index efb8bdc..887877d 100644
--- a/webAO/dom/resizeChatbox.ts
+++ b/webAO/dom/resizeChatbox.ts
@@ -17,7 +17,6 @@ export function resizeChatbox() {
let weekday = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
const month = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
document.getElementById("client_clock_month")!.innerText = month[now.getMonth()];
- console.debug(CHATBOX);
if (CHATBOX == "acww") {
weekday = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
document.getElementById("client_clock_weekday")!.innerText = weekday[now.getDay()];
diff --git a/webAO/dom/setChatbox.ts b/webAO/dom/setChatbox.ts
index 6d1a78c..095ead3 100644
--- a/webAO/dom/setChatbox.ts
+++ b/webAO/dom/setChatbox.ts
@@ -5,7 +5,7 @@ import setCookie from "../utils/setCookie";
/**
* Set the style of the chatbox
*/
-export function setChatbox(style: string) {
+export function setChatbox(setstyle: string) {
const chatbox_theme = <HTMLAnchorElement>(
document.getElementById("chatbox_theme")
);
@@ -16,6 +16,7 @@ export function setChatbox(style: string) {
setCookie("chatbox", CHATBOX);
if (CHATBOX === "dynamic") {
+ const style = setstyle.replace("chat","");
if (chatbox_arr.includes(style)) {
chatbox_theme.href = `styles/chatbox/${style}.css`;
} else {
diff --git a/webAO/dom/showNameClick.ts b/webAO/dom/showNameClick.ts
index 265f6c8..3e48b70 100644
--- a/webAO/dom/showNameClick.ts
+++ b/webAO/dom/showNameClick.ts
@@ -5,7 +5,7 @@ import setCookie from "../utils/setCookie";
* Triggered when the showname checkboc is clicked
* @param {MouseEvent} event
*/
-export function showname_click(_event: Event) {
+export function showname_click(_event: Event | null) {
setCookie(
"showname",
String((<HTMLInputElement>document.getElementById("showname")).checked)
diff --git a/webAO/dom/twofactor.ts b/webAO/dom/twofactor.ts
new file mode 100644
index 0000000..b7e947a
--- /dev/null
+++ b/webAO/dom/twofactor.ts
@@ -0,0 +1,10 @@
+import { client } from "../client";
+
+function handleCredentialResponse(response: any) {
+ client.sender.sendServer(`2T#${response.credential}#%`);
+ }
+window.handleCredentialResponse = handleCredentialResponse;
+
+export function showFactorDialog(args: string[]) {
+ document.getElementById("client_secondfactor").style.display = args[1];
+} \ No newline at end of file
diff --git a/webAO/dom/updateIniswap.ts b/webAO/dom/updateIniswap.ts
new file mode 100644
index 0000000..5bea0f5
--- /dev/null
+++ b/webAO/dom/updateIniswap.ts
@@ -0,0 +1,18 @@
+/**
+ * Update iniswap drowdown
+ */
+export function updateIniswap() {
+ const ini_select = <HTMLSelectElement>(
+ document.getElementById("client_iniselect")
+ );
+ const ini_name = <HTMLInputElement>(
+ document.getElementById("client_ininame")
+ );
+
+ if (ini_select.selectedIndex === 0) {
+ ini_name.style.display = "initial";
+ } else {
+ ini_name.style.display = "none";
+ }
+}
+window.updateIniswap = updateIniswap;
diff --git a/webAO/dom/window.ts b/webAO/dom/window.ts
index 2535768..0b3bd34 100644
--- a/webAO/dom/window.ts
+++ b/webAO/dom/window.ts
@@ -17,6 +17,7 @@ declare global {
changeBackgroundOOC: () => void;
updateActionCommands: (side: string) => void;
updateEvidenceIcon: () => void;
+ updateIniswap: () => void;
resizeChatbox: () => void;
setChatbox: (style: string) => void;
getIndexFromSelect: (select_box: string, value: string) => Number;
@@ -51,6 +52,7 @@ declare global {
onEnter: (event: any) => void;
onReplayGo: (_event: any) => void;
onOOCEnter: (_event: any) => void;
+ handleCredentialResponse: (_event: any) => void;
}
}
export { } \ No newline at end of file