diff options
| -rw-r--r-- | webAO/client.html | 6 | ||||
| -rw-r--r-- | webAO/client.js | 32 | ||||
| -rw-r--r-- | webAO/styles/chatbox/aa.css | 2 |
3 files changed, 39 insertions, 1 deletions
diff --git a/webAO/client.html b/webAO/client.html index 9e18c5a..dde43e0 100644 --- a/webAO/client.html +++ b/webAO/client.html @@ -404,6 +404,12 @@ <input type="checkbox" id="client_hdviewport_offset" id="client_hdviewport_offset" onclick="switchChatOffset()"> <br> <br> + <label for="client_callwords">Callwords:</label> + <br> + <textarea id="client_callwords" name="client_callwords" rows="4" cols="10" + placeholder="Put 1 callword per line here" onchange="changeCallwords()"></textarea> + <br> + <br> <span style="color:red">↓ Only touch these settings if you know what you are doing. ↓</span> <br> <br> diff --git a/webAO/client.js b/webAO/client.js index d4365dd..aad1895 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -121,6 +121,8 @@ class Client extends EventEmitter { this.areas = []; this.musics = []; + this.callwords = []; + this.resources = { "holdit": { "src": AO_HOST + "misc/default/holdit_bubble.png", @@ -1651,6 +1653,8 @@ async changeBackground(position) { appendICLog(this.chatmsg.content, displayname); + checkCallword(this.chatmsg.content); + // start checking the files try { const { url: speakUrl } = await this.oneSuccess([ @@ -2216,6 +2220,14 @@ export function reloadTheme() { window.reloadTheme = reloadTheme; /** + * Triggered by a changed callword list + */ +export function changeCallwords() { + client.callwords = document.getElementById("client_callwords").value.split('\n'); +} +window.changeCallwords = changeCallwords; + +/** * Triggered by the modcall sfx dropdown */ export function modcall_test() { @@ -2436,6 +2448,26 @@ function appendICLog(msg, name = "", time = new Date()) { } /** + * check if the message contains an entry on our callword list + * @param {String} message + */ +export function checkCallword(message) { + client.callwords.forEach(testCallword); + + function testCallword(item) + { + if(item !== "" && message.toLowerCase().includes(item.toLowerCase())) + { + viewport.sfxaudio.pause(); + viewport.sfxaudio.src = AO_HOST + "sounds/general/sfx-gallery.wav"; + viewport.sfxaudio.play(); + } + } +} + + + +/** * Triggered when the music search bar is changed * @param {MouseEvent} event */ diff --git a/webAO/styles/chatbox/aa.css b/webAO/styles/chatbox/aa.css index f8cb7bc..434c33a 100644 --- a/webAO/styles/chatbox/aa.css +++ b/webAO/styles/chatbox/aa.css @@ -101,7 +101,7 @@ border-color: rgba(255, 255, 255, 0.5); border-style: ridge groove groove ridge; border-width: 0.15em; - border-radius: 0.3em; + border-radius: 0.2em; background-color: rgba(0, 0, 16, 0.5); font-size: 1.6em; word-break: keep-all; |
