aboutsummaryrefslogtreecommitdiff
path: root/webAO/dom/toggleShout.ts
blob: dcfccba53e686c9a311f29e407700f4a9f0bf82a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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";
    setSelectedShout(0);
  } else {
    document.getElementById(`button_${shout}`)!.className =
      "client_button dark";
    if (selectedShout) {
      document.getElementById(`button_${selectedShout}`)!.className =
        "client_button";
    }
    setSelectedShout(shout);
  }
}
window.toggleShout = toggleShout;