aboutsummaryrefslogtreecommitdiff
path: root/webAO/client.js
diff options
context:
space:
mode:
authorsD <stoned@derpymail.org>2019-12-19 19:12:15 +0100
committersD <stoned@derpymail.org>2019-12-19 19:12:15 +0100
commit6531a5c803f2144025273448e7d43bd5f43d11da (patch)
tree6ec4e3390cb815da9318162251ed2d9a1a236171 /webAO/client.js
parent5918b204c206b39909d56009cab785bd213c8dfe (diff)
fix nameplate and load cookies with the settings tab
Diffstat (limited to 'webAO/client.js')
-rw-r--r--webAO/client.js23
1 files changed, 20 insertions, 3 deletions
diff --git a/webAO/client.js b/webAO/client.js
index 67bbcab..7a0f467 100644
--- a/webAO/client.js
+++ b/webAO/client.js
@@ -341,7 +341,6 @@ class Client extends EventEmitter {
* Triggered when a connection is established to the server.
*/
onOpen(_e) {
- client.loadResources();
client.joinServer();
}
@@ -408,16 +407,26 @@ class Client extends EventEmitter {
// TODO: this if-statement might be a bug.
if (args[4] !== viewport.chatmsg.content) {
document.getElementById("client_inner_chat").innerHTML = "";
+
+ let msg_nameplate = args[3];
+ let msg_blips = "male";
+ try {
+ msg_nameplate = this.chars[args[9]].showname;
+ msg_blips = this.chars[args[9]].gender;
+ } catch(e) {
+ //we already set defaults
+ }
+
const chatmsg = {
preanim: escape(args[2]).toLowerCase(), // get preanim
- nameplate: this.chars[args[9]].showname,
+ nameplate: msg_nameplate,
name: args[3].toLowerCase(),
speaking: "(b)" + escape(args[4]).toLowerCase(),
silent: "(a)" + escape(args[4]).toLowerCase(),
content: this.prepChat(args[5]), // Escape HTML tag
side: args[6].toLowerCase(),
sound: escape(args[7]).toLowerCase(),
- blips: this.chars[args[9]].gender,
+ blips: msg_blips,
type: args[8],
charid: args[9],
snddelay: args[10],
@@ -1654,6 +1663,14 @@ async function changeBackground(position) {
}
/**
+ * Triggered when the settings tab is fully loaded.
+ */
+export function loadSettings() {
+ client.loadResources();
+}
+window.loadSettings = loadSettings;
+
+/**
* Triggered when the reconnect button is pushed.
*/
export function ReconnectButton() {