aboutsummaryrefslogtreecommitdiff
path: root/client.js
diff options
context:
space:
mode:
authorstonedDiscord <stoned@derpymail.org>2018-03-11 14:09:34 +0100
committerstonedDiscord <stoned@derpymail.org>2018-03-11 14:09:34 +0100
commitdeac6b2b4a06ca4d0e56a4683489a81b8c843c1f (patch)
treeb1bee47aeb0ac2cf0168513e6c7438f0a51a3e92 /client.js
parent10f6da9805c04cf38db6c7628cbd5557839a32fb (diff)
log and empty emotes
Diffstat (limited to 'client.js')
-rw-r--r--client.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/client.js b/client.js
index eb6fca2..2ae12ee 100644
--- a/client.js
+++ b/client.js
@@ -230,7 +230,7 @@ function changebg(position) {
}
function updateText() {
- if (chatmsg.content == "") {
+ if (chatmsg.content.trim() == "") {
document.getElementById("client_name").style.display = "none";
document.getElementById("client_chat").style.display = "none";
} else {
@@ -375,7 +375,7 @@ function onMessage(e) {
chatmsg.name = arguments[3];
chatmsg.speaking = "(b)" + escape(arguments[4]);
chatmsg.silent = "(a)" + escape(arguments[4]);
- chatmsg.content = arguments[5];
+ chatmsg.content = escapeHtml(arguments[5]);
chatmsg.side = arguments[6];
chatmsg.sound = escape(arguments[7]);
chatmsg.type = arguments[8];
@@ -387,6 +387,7 @@ function onMessage(e) {
chatmsg.flash = arguments[14];
chatmsg.color = arguments[15];
chatmsg.isnew = true;
+ addlog(chatmsg.nameplate + ": " + escapeHtml(arguments[5]))
changebg(chatmsg.side);
textnow = '';
sfxplayed = 0
@@ -624,4 +625,12 @@ function escapeHtml(unsafe) {
transfer.replace(/"/g, "&quot;");
transfer.replace(/'/g, "&#039;");
return transfer;
+}
+
+if(typeof(String.prototype.trim) === "undefined")
+{
+ String.prototype.trim = function()
+ {
+ return String(this).replace(/^\s+|\s+$/g, '');
+ };
} \ No newline at end of file