aboutsummaryrefslogtreecommitdiff
path: root/webAO/client.js
diff options
context:
space:
mode:
authorstonedDiscord <stoned@derpymail.org>2020-07-14 19:22:15 +0200
committerGitHub <noreply@github.com>2020-07-14 19:22:15 +0200
commitd720de27c51c2a4a2173f1349bad49672f65e9c5 (patch)
treef325404165f879f077e2e33efce67e484d378134 /webAO/client.js
parent0298c14f033448351b25bd0c3d0916be19e00c3a (diff)
parentc1464118ab1900382d92c2b376cd080973fdc54b (diff)
Merge pull request #62 from AttorneyOnline/callwords
Callwords
Diffstat (limited to 'webAO/client.js')
-rw-r--r--webAO/client.js32
1 files changed, 32 insertions, 0 deletions
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
*/