From 2d274135c38d4770f9b70d1ec27b8f7601d07f48 Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Tue, 10 Oct 2017 18:52:54 +0200 Subject: escape + guide --- README.md | 2 +- client.js | 15 +++++++++++---- 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("#",""); +string.replace("&",""); +string.replace("%",""); +string.replace("$",""); +} + 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 = ''; } } -- cgit