aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstonedDiscord <stoned@derpymail.org>2017-10-10 18:52:54 +0200
committerstonedDiscord <stoned@derpymail.org>2017-10-10 18:52:54 +0200
commit2d274135c38d4770f9b70d1ec27b8f7601d07f48 (patch)
tree21fad3d83b57f64b6fc0828c09d15b29a5080447
parent2e5d2e93cd1e9ea73bd33fdd25192204c523c73e (diff)
escape + guide
-rw-r--r--README.md2
-rw-r--r--client.js15
2 files changed, 12 insertions, 5 deletions
diff --git a/README.md b/README.md
index 8c415fa..56da082 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Attorney Online Web Client
-Go to stonedDiscord.github.io to open it
+Guide: https://docs.google.com/document/d/1X4OjG0tfoTZayqY9MM6fqzL_aGMKFAECg7NSQRYafAU/edit
This is a client for the Attorney Online roleplaying chatroom written in HTML and Javascript.
It works with the serverD software when the server has WebSockets enabled.
diff --git a/client.js b/client.js
index 944ed2e..8893618 100644
--- a/client.js
+++ b/client.js
@@ -3,8 +3,8 @@ glorious webao
made by sD
credits to aleks for original idea and source
*/
-var AO_HOST = "http://weedlan.de/";
-//var AO_HOST = "../client/base/";
+//var AO_HOST = "http://weedlan.de/";
+var AO_HOST = "../client/base/";
var MUSIC_HOST = AO_HOST + "sounds/music/";
var BAR_WIDTH = 90;
var BAR_HEIGHT = 20;
@@ -105,9 +105,16 @@ function parseINI(data) {
return value;
}
+function escapeChat(string) {
+string.replace("#","<pound>");
+string.replace("&","<and>");
+string.replace("%","<percent>");
+string.replace("$","<dollar>");
+}
+
function onOOCEnter(event) {
if (event.keyCode == 13) {
- serv.send("CT#web" + pid + "#" + document.getElementById("client_oocinputbox").value + "#%");
+ serv.send("CT#web" + pid + "#" + escapeChat(document.getElementById("client_oocinputbox").value) + "#%");
document.getElementById("client_oocinputbox").value = "";
}
}
@@ -116,7 +123,7 @@ function onEnter(event) {
if (event.keyCode == 13) {
mychar = chars[me]
myemo = emotes[myemotion]
- serv.send("MS#chat#" + myemo.speaking + "#" + mychar.name + "#" + myemo.silent + "#" + document.getElementById("client_inputbox").value + "#"+mychar.side+"#0#0#0#0#0#0#0#0#0#0#0#0#0#%" );
+ serv.send("MS#chat#" + myemo.speaking + "#" + mychar.name + "#" + myemo.silent + "#" + escapeChat(document.getElementById("client_inputbox").value) + "#"+mychar.side+"#0#0#0#0#0#0#0#0#0#0#0#0#0#%" );
document.getElementById("client_inputbox").value = '';
}
}