From 38739ca7ad89a3b743696e9b3b95c26d1a50b07a Mon Sep 17 00:00:00 2001 From: "caleb.mabry.15@cnu.edu" Date: Sun, 20 Mar 2022 14:08:10 -0400 Subject: Adding custom markdown based on asset file --- webAO/client.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'webAO/client.js') diff --git a/webAO/client.js b/webAO/client.js index 14bfd08..a59508e 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -10,7 +10,7 @@ import fileExistsSync from './utils/fileExistsSync'; import { escapeChat, encodeChat, prepChat, safeTags, } from './encoding.js'; - +import mlConfig from './utils/aoml'; // Load some defaults for the background and evidence dropdowns import vanilla_character_arr from './constants/characters.js'; import vanilla_music_arr from './constants/music.js'; @@ -43,6 +43,8 @@ const DEFAULT_HOST = 'http://attorneyoffline.de/base/'; let AO_HOST = asset || DEFAULT_HOST; const THEME = theme || 'default'; +const attorneyMarkdown = mlConfig(AO_HOST) + const UPDATE_INTERVAL = 60; /** @@ -1938,6 +1940,7 @@ class Viewport { * @param {object} chatmsg the new chat message */ async say(chatmsg) { + this.chatmsg = chatmsg; this.textnow = ''; this.sfxplayed = 0; @@ -2089,7 +2092,7 @@ class Viewport { if (soundChecks.some((check) => this.chatmsg.sound === check)) { this.chatmsg.sound = this.chatmsg.effects[2]; } - + this.chatmsg.parsed = attorneyMarkdown.applyMarkdown(chatmsg.content) this.tick(); } @@ -2242,7 +2245,7 @@ class Viewport { } this.textnow = this.chatmsg.content.substring(0, this.textnow.length + 1); - chatBoxInner.innerText = this.textnow; + chatBoxInner.appendChild(this.chatmsg.parsed[this.textnow.length - 1]); // scroll to bottom chatBox.scrollTop = chatBox.scrollHeight; @@ -2325,6 +2328,7 @@ export function onEnter(event) { if (emote_mod === 0) { emote_mod = 1; } } else if (emote_mod === 1) { emote_mod = 0; } + client.sendIC( 'chat', myemo.preanim, -- cgit From 79db229a94aa3f407399158470e3d027d2b035e8 Mon Sep 17 00:00:00 2001 From: "caleb.mabry.15@cnu.edu" Date: Mon, 21 Mar 2022 17:26:05 -0400 Subject: Fixing bugs --- webAO/client.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'webAO/client.js') diff --git a/webAO/client.js b/webAO/client.js index a59508e..87db272 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -2092,7 +2092,7 @@ class Viewport { if (soundChecks.some((check) => this.chatmsg.sound === check)) { this.chatmsg.sound = this.chatmsg.effects[2]; } - this.chatmsg.parsed = attorneyMarkdown.applyMarkdown(chatmsg.content) + this.chatmsg.parsed = attorneyMarkdown.applyMarkdown(chatmsg.content, this.colors[this.chatmsg.color]) this.tick(); } @@ -2244,7 +2244,6 @@ class Viewport { this.currentBlipChannel %= this.blipChannels.length; } this.textnow = this.chatmsg.content.substring(0, this.textnow.length + 1); - chatBoxInner.appendChild(this.chatmsg.parsed[this.textnow.length - 1]); // scroll to bottom -- cgit From 4d09a4a7105de76189fae41e86c9186ba7ff76fd Mon Sep 17 00:00:00 2001 From: "caleb.mabry.15@cnu.edu" Date: Tue, 22 Mar 2022 00:16:52 -0400 Subject: ez error handling --- webAO/client.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'webAO/client.js') diff --git a/webAO/client.js b/webAO/client.js index 87db272..44cc8bd 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -2244,7 +2244,10 @@ class Viewport { this.currentBlipChannel %= this.blipChannels.length; } this.textnow = this.chatmsg.content.substring(0, this.textnow.length + 1); - chatBoxInner.appendChild(this.chatmsg.parsed[this.textnow.length - 1]); + const characterElement = this.chatmsg.parsed[this.textnow.length - 1] + if (characterElement) { + chatBoxInner.appendChild(this.chatmsg.parsed[this.textnow.length - 1]); + } // scroll to bottom chatBox.scrollTop = chatBox.scrollHeight; -- cgit From 7c88c0bcca6e47cca4e2632df8ced778fa38c341 Mon Sep 17 00:00:00 2001 From: "caleb.mabry.15@cnu.edu" Date: Wed, 23 Mar 2022 00:33:18 -0400 Subject: Final commit --- webAO/client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'webAO/client.js') diff --git a/webAO/client.js b/webAO/client.js index 44cc8bd..eed1293 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -2092,7 +2092,7 @@ class Viewport { if (soundChecks.some((check) => this.chatmsg.sound === check)) { this.chatmsg.sound = this.chatmsg.effects[2]; } - this.chatmsg.parsed = attorneyMarkdown.applyMarkdown(chatmsg.content, this.colors[this.chatmsg.color]) + this.chatmsg.parsed = await attorneyMarkdown.applyMarkdown(chatmsg.content, this.colors[this.chatmsg.color]) this.tick(); } -- cgit