From deac6b2b4a06ca4d0e56a4683489a81b8c843c1f Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Sun, 11 Mar 2018 14:09:34 +0100 Subject: log and empty emotes --- client.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'client.js') 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, """); transfer.replace(/'/g, "'"); 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 -- cgit