aboutsummaryrefslogtreecommitdiff
path: root/webAO/dom/pickEmotion.ts
blob: 619d0abff751591e940fc9d62a6bd5b560d0e3cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { client } from '../client'
/**
 * Highlights and selects an emotion for in-character chat.
 * @param {string} emo the new emotion to be selected
 */
export function pickEmotion(emo: number) {
    try {
        if (client.selectedEmote !== -1) {
            document.getElementById(`emo_${client.selectedEmote}`)!.className =
                "emote_button";
        }
    } catch (err) {
        // do nothing
    }
    client.selectedEmote = emo;
    document.getElementById(`emo_${emo}`)!.className = "emote_button dark";

    (<HTMLInputElement>document.getElementById("sendsfx")).checked =
        client.emote.sfx.length > 1;

    (<HTMLInputElement>document.getElementById("sendpreanim")).checked =
        client.emote.zoom == 1;

    (<HTMLInputElement>document.getElementById("client_inputbox")).focus();
}
window.pickEmotion = pickEmotion;