aboutsummaryrefslogtreecommitdiff
path: root/webAO/dom/toggleShout.ts
diff options
context:
space:
mode:
authorstonedDiscord <Tukz@gmx.de>2022-09-07 19:53:44 +0200
committerGitHub <noreply@github.com>2022-09-07 19:53:44 +0200
commit5362069a05b4bfbef03f37605af979aa3cf0e066 (patch)
tree4228d606b206aa9f7f9438a5e69e3e721bc02643 /webAO/dom/toggleShout.ts
parent84184b35c8564a1c51cc67d9781d2463fd159527 (diff)
parentccec95a9d3b68e25e24a9168400fc47099a85c81 (diff)
Merge pull request #168 from caleb-mabry/more-window-functions
More window functions
Diffstat (limited to 'webAO/dom/toggleShout.ts')
-rw-r--r--webAO/dom/toggleShout.ts22
1 files changed, 22 insertions, 0 deletions
diff --git a/webAO/dom/toggleShout.ts b/webAO/dom/toggleShout.ts
new file mode 100644
index 0000000..8094691
--- /dev/null
+++ b/webAO/dom/toggleShout.ts
@@ -0,0 +1,22 @@
+import { selectedShout, setSelectedShout } from "../client";
+
+
+/**
+ * Highlights and selects a shout for in-character chat.
+ * If the same shout button is selected, then the shout is canceled.
+ * @param {number} shout the new shout to be selected
+ */
+export function toggleShout(shout: number) {
+ if (shout === selectedShout) {
+ document.getElementById(`button_${shout}`)!.className = "client_button";
+ selectedShout = 0;
+ } else {
+ document.getElementById(`button_${shout}`)!.className = "client_button dark";
+ if (selectedShout) {
+ document.getElementById(`button_${selectedShout}`)!.className =
+ "client_button";
+ }
+ selectedShout = shout;
+ }
+}
+window.toggleShout = toggleShout;