diff options
| author | sD <stoned@derpymail.org> | 2019-12-19 19:12:15 +0100 |
|---|---|---|
| committer | sD <stoned@derpymail.org> | 2019-12-19 19:12:15 +0100 |
| commit | 6531a5c803f2144025273448e7d43bd5f43d11da (patch) | |
| tree | 6ec4e3390cb815da9318162251ed2d9a1a236171 | |
| parent | 5918b204c206b39909d56009cab785bd213c8dfe (diff) | |
fix nameplate and load cookies with the settings tab
| -rw-r--r-- | webAO/client.html | 2 | ||||
| -rw-r--r-- | webAO/client.js | 23 |
2 files changed, 21 insertions, 4 deletions
diff --git a/webAO/client.html b/webAO/client.html index d338e46..b781a6c 100644 --- a/webAO/client.html +++ b/webAO/client.html @@ -214,7 +214,7 @@ </span> <!-- Settings section --> - <span class="menu_content" id="content_3"> + <span class="menu_content" id="content_3" onload="loadSettings()"> <meta name="frame-title" lang="en" content="Settings"> <label for="OOC_name">Server chat name:</label> <input id="OOC_name" name="OOC_name" class="short" type="text"> 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() { |
