aboutsummaryrefslogtreecommitdiff
path: root/webAO/dom
diff options
context:
space:
mode:
Diffstat (limited to 'webAO/dom')
-rw-r--r--webAO/dom/areaClick.ts15
-rw-r--r--webAO/dom/onEnter.ts103
-rw-r--r--webAO/dom/onOOCEnter.ts16
-rw-r--r--webAO/dom/onReplayGo.ts10
4 files changed, 144 insertions, 0 deletions
diff --git a/webAO/dom/areaClick.ts b/webAO/dom/areaClick.ts
new file mode 100644
index 0000000..6c3ff6b
--- /dev/null
+++ b/webAO/dom/areaClick.ts
@@ -0,0 +1,15 @@
+import { client } from '../client'
+/**
+ * Triggered when an item on the area list is clicked.
+ * @param {HTMLElement} el
+ */
+export function area_click(el: HTMLElement) {
+ const area = client.areas[el.id.substr(4)].name;
+ client.sendMusicChange(area);
+
+ const areaHr = document.createElement("div");
+ areaHr.className = "hrtext";
+ areaHr.textContent = `switched to ${el.textContent}`;
+ document.getElementById("client_log")!.appendChild(areaHr);
+}
+window.area_click = area_click; \ No newline at end of file
diff --git a/webAO/dom/onEnter.ts b/webAO/dom/onEnter.ts
new file mode 100644
index 0000000..01fbbd5
--- /dev/null
+++ b/webAO/dom/onEnter.ts
@@ -0,0 +1,103 @@
+import { client, selectedShout } from "../client";
+import { escapeChat } from "../encoding";
+
+
+/**
+ * Triggered when the Return key is pressed on the in-character chat input box.
+ * @param {KeyboardEvent} event
+ */
+ export function onEnter(event: KeyboardEvent) {
+ if (event.keyCode === 13) {
+ const mychar = client.character;
+ const myemo = client.emote;
+ const evi = client.evidence;
+ const flip = Boolean(
+ document.getElementById("button_flip")!.classList.contains("dark")
+ );
+ const flash = Boolean(
+ document.getElementById("button_flash")!.classList.contains("dark")
+ );
+ const screenshake = Boolean(
+ document.getElementById("button_shake")!.classList.contains("dark")
+ );
+ const noninterrupting_preanim = Boolean(
+ (<HTMLInputElement>document.getElementById("check_nonint")).checked
+ );
+ const looping_sfx = Boolean(
+ (<HTMLInputElement>document.getElementById("check_loopsfx")).checked
+ );
+ const color = Number(
+ (<HTMLInputElement>document.getElementById("textcolor")).value
+ );
+ const showname = escapeChat(
+ (<HTMLInputElement>document.getElementById("ic_chat_name")).value
+ );
+ const text = (<HTMLInputElement>document.getElementById("client_inputbox"))
+ .value;
+ const pairchar = (<HTMLInputElement>document.getElementById("pair_select"))
+ .value;
+ const pairoffset = Number(
+ (<HTMLInputElement>document.getElementById("pair_offset")).value
+ );
+ const pairyoffset = Number(
+ (<HTMLInputElement>document.getElementById("pair_y_offset")).value
+ );
+ const myrole = (<HTMLInputElement>document.getElementById("role_select"))
+ .value
+ ? (<HTMLInputElement>document.getElementById("role_select")).value
+ : mychar.side;
+ const additive = Boolean(
+ (<HTMLInputElement>document.getElementById("check_additive")).checked
+ );
+ const effect = (<HTMLInputElement>document.getElementById("effect_select"))
+ .value;
+
+ let sfxname = "0";
+ let sfxdelay = 0;
+ let emote_mod = myemo.zoom;
+ if ((<HTMLInputElement>document.getElementById("sendsfx")).checked) {
+ sfxname = myemo.sfx;
+ sfxdelay = myemo.sfxdelay;
+ }
+
+ // not to overwrite a 5 from the ini or anything else
+ if ((<HTMLInputElement>document.getElementById("sendpreanim")).checked) {
+ if (emote_mod === 0) {
+ emote_mod = 1;
+ }
+ } else if (emote_mod === 1) {
+ emote_mod = 0;
+ }
+
+ client.sendIC(
+ myemo.deskmod,
+ myemo.preanim,
+ mychar.name,
+ myemo.emote,
+ text,
+ myrole,
+ sfxname,
+ emote_mod,
+ sfxdelay,
+ selectedShout,
+ evi,
+ flip,
+ flash,
+ color,
+ showname,
+ pairchar,
+ pairoffset,
+ pairyoffset,
+ noninterrupting_preanim,
+ looping_sfx,
+ screenshake,
+ "-",
+ "-",
+ "-",
+ additive,
+ effect
+ );
+ }
+ return false;
+ }
+ window.onEnter = onEnter; \ No newline at end of file
diff --git a/webAO/dom/onOOCEnter.ts b/webAO/dom/onOOCEnter.ts
new file mode 100644
index 0000000..a6bde4c
--- /dev/null
+++ b/webAO/dom/onOOCEnter.ts
@@ -0,0 +1,16 @@
+import { client } from "../client";
+/**
+ * Triggered when the Return key is pressed on the out-of-character chat input box.
+ * @param {KeyboardEvent} event
+ */
+export function onOOCEnter(event: KeyboardEvent) {
+ console.log('FUCK')
+ if (event.keyCode === 13) {
+ client.sendOOC(
+ (<HTMLInputElement>document.getElementById("client_oocinputbox")).value
+ );
+ (<HTMLInputElement>document.getElementById("client_oocinputbox")).value =
+ "";
+ }
+}
+window.onOOCEnter = onOOCEnter;
diff --git a/webAO/dom/onReplayGo.ts b/webAO/dom/onReplayGo.ts
new file mode 100644
index 0000000..82a6f2f
--- /dev/null
+++ b/webAO/dom/onReplayGo.ts
@@ -0,0 +1,10 @@
+import { client } from "../client";
+
+/**
+ * Triggered when the user click replay GOOOOO
+ * @param {KeyboardEvent} event
+ */
+export function onReplayGo(_event: Event) {
+ client.handleReplay();
+}
+window.onReplayGo = onReplayGo; \ No newline at end of file