mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-23 07:26:05 +00:00
* tgchat (#52426) Replaces goonchat with a tgui based chat panel Fixes #52898 Fixes #52663 It is as fast as goonchat was (if not faster in certain circumstances), and is very extensible. It has all the necessary code for sorting messages into categories, which means that one of the next features will be multiple tab support. Additional features that you will get with tgchat right now: Massively faster server-side performance compared to goonchat, especially if batching multiple messages to one client. Message persistence across rounds and reconnects. (All messages are stored client-side in IndexedDB) More robust scroll tracking. If you scroll up, it will not change the scroll position on new messages like goonchat did. Multiple message combining. (Currently set to combine up to 5 messages over last 5 seconds). If using the highlighting feature, it highlights the whole message as well as the matching word. "Now playing" widget, with preview of the song title, a knob for adjusting the volume and a stop button. Architecture is as following: ``` to_chat() -+ | SSchat (queue, batching) | window.send_message() | v +-------------+ | tgui-panel | |+-----------+| || tgchat || |+-----------+| +-------------+ ``` Subsystem is basically goonchat, but without all the garbage that slows the servers down (string concatenation, double urlencoding, sanitizing, etc). Now, instead of all that, it's being slowed down by json_encode in /datum/tgui_window/proc/send_message, which IMO is completely worth it, and allows sending various templates and widgets to tgchat. /datum/tgui_window abstracts the whole window away from you, establishes a nice message-passing interface between DM and JS, with two message queues on each side, automatically loads js/css assets for you, basically does everything. You as a developer only have to worry about sending/receiving messages and write javascript. tgui-panel is a slimmed down version of tgui, and functions as a container for various widgets, and tgchat is one of them. It of course can be expanded with more stuff. It's also a separate entry point and a JS bundle, so it's not bloating the main tgui bundle, and is currently sitting at about 230kB. * tgchat Co-authored-by: Aleksej Komarov <stylemistake@gmail.com>
87 lines
2.2 KiB
JavaScript
87 lines
2.2 KiB
JavaScript
/**
|
|
* All possible browser keycodes, in one file.
|
|
*
|
|
* @file
|
|
* @copyright 2020 Aleksej Komarov
|
|
* @license MIT
|
|
*/
|
|
|
|
export const KEY_BACKSPACE = 8;
|
|
export const KEY_TAB = 9;
|
|
export const KEY_ENTER = 13;
|
|
export const KEY_SHIFT = 16;
|
|
export const KEY_CTRL = 17;
|
|
export const KEY_ALT = 18;
|
|
export const KEY_PAUSE = 19;
|
|
export const KEY_CAPSLOCK = 20;
|
|
export const KEY_ESCAPE = 27;
|
|
export const KEY_SPACE = 32;
|
|
export const KEY_PAGEUP = 33;
|
|
export const KEY_PAGEDOWN = 34;
|
|
export const KEY_END = 35;
|
|
export const KEY_HOME = 36;
|
|
export const KEY_LEFT = 37;
|
|
export const KEY_UP = 38;
|
|
export const KEY_RIGHT = 39;
|
|
export const KEY_DOWN = 40;
|
|
export const KEY_INSERT = 45;
|
|
export const KEY_DELETE = 46;
|
|
export const KEY_0 = 48;
|
|
export const KEY_1 = 49;
|
|
export const KEY_2 = 50;
|
|
export const KEY_3 = 51;
|
|
export const KEY_4 = 52;
|
|
export const KEY_5 = 53;
|
|
export const KEY_6 = 54;
|
|
export const KEY_7 = 55;
|
|
export const KEY_8 = 56;
|
|
export const KEY_9 = 57;
|
|
export const KEY_A = 65;
|
|
export const KEY_B = 66;
|
|
export const KEY_C = 67;
|
|
export const KEY_D = 68;
|
|
export const KEY_E = 69;
|
|
export const KEY_F = 70;
|
|
export const KEY_G = 71;
|
|
export const KEY_H = 72;
|
|
export const KEY_I = 73;
|
|
export const KEY_J = 74;
|
|
export const KEY_K = 75;
|
|
export const KEY_L = 76;
|
|
export const KEY_M = 77;
|
|
export const KEY_N = 78;
|
|
export const KEY_O = 79;
|
|
export const KEY_P = 80;
|
|
export const KEY_Q = 81;
|
|
export const KEY_R = 82;
|
|
export const KEY_S = 83;
|
|
export const KEY_T = 84;
|
|
export const KEY_U = 85;
|
|
export const KEY_V = 86;
|
|
export const KEY_W = 87;
|
|
export const KEY_X = 88;
|
|
export const KEY_Y = 89;
|
|
export const KEY_Z = 90;
|
|
export const KEY_F1 = 112;
|
|
export const KEY_F2 = 113;
|
|
export const KEY_F3 = 114;
|
|
export const KEY_F4 = 115;
|
|
export const KEY_F5 = 116;
|
|
export const KEY_F6 = 117;
|
|
export const KEY_F7 = 118;
|
|
export const KEY_F8 = 119;
|
|
export const KEY_F9 = 120;
|
|
export const KEY_F10 = 121;
|
|
export const KEY_F11 = 122;
|
|
export const KEY_F12 = 123;
|
|
export const KEY_SEMICOLON = 186;
|
|
export const KEY_EQUAL = 187;
|
|
export const KEY_COMMA = 188;
|
|
export const KEY_MINUS = 189;
|
|
export const KEY_PERIOD = 190;
|
|
export const KEY_SLASH = 191;
|
|
export const KEY_LEFT_BRACKET = 219;
|
|
export const KEY_BACKSLASH = 220;
|
|
export const KEY_RIGHT_BRACKET = 221;
|
|
export const KEY_QUOTE = 222;
|