aboutsummaryrefslogtreecommitdiff
path: root/webAO/client.js
diff options
context:
space:
mode:
authorCaleb Mabry <36182383+caleb-mabry@users.noreply.github.com>2022-03-23 15:33:08 -0400
committerGitHub <noreply@github.com>2022-03-23 15:33:08 -0400
commit844dc7e5fe80bca530ccbf62198f183284074108 (patch)
treeb6d1641c37630f72a2ad4de958de53999a6852b1 /webAO/client.js
parenta726bdd00060876be91b6b3f134ecc6867bbeed6 (diff)
parentefe16e1c1e7d4b0ea13c04b816d046ad21eeadb0 (diff)
Merge pull request #123 from caleb-mabry/custom-ini
Adding Custom Markdown Support Based on Asset File
Diffstat (limited to 'webAO/client.js')
-rw-r--r--webAO/client.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/webAO/client.js b/webAO/client.js
index e9eb13a..dfba169 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;
/**
@@ -1927,6 +1929,7 @@ class Viewport {
* @param {object} chatmsg the new chat message
*/
async say(chatmsg) {
+
this.chatmsg = chatmsg;
this.textnow = '';
this.sfxplayed = 0;
@@ -2078,7 +2081,7 @@ class Viewport {
if (soundChecks.some((check) => this.chatmsg.sound === check)) {
this.chatmsg.sound = this.chatmsg.effects[2];
}
-
+ this.chatmsg.parsed = await attorneyMarkdown.applyMarkdown(chatmsg.content, this.colors[this.chatmsg.color])
this.tick();
}
@@ -2230,8 +2233,10 @@ class Viewport {
this.currentBlipChannel %= this.blipChannels.length;
}
this.textnow = this.chatmsg.content.substring(0, this.textnow.length + 1);
-
- chatBoxInner.innerText = this.textnow;
+ 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;
@@ -2314,6 +2319,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,