summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app.js17
1 files changed, 15 insertions, 2 deletions
diff --git a/app.js b/app.js
index 3601207..efee026 100644
--- a/app.js
+++ b/app.js
@@ -96,7 +96,7 @@ io.sockets.on('connection', function(socket){
socket.on('sendMsgToServer', function(data){
if (data)
for (var i in SOCKET_LIST){
- SOCKET_LIST[i].emit('addToChat', {ctimestamp: getTimeStamp(0), content: socket.playerName + ': ' + escapeHTML(data), tab: "world"});
+ SOCKET_LIST[i].emit('addToChat', {ctimestamp: getTimeStamp(0), content: socket.playerName + ': ' + escapeHTML(chatEmote(data)), tab: "world"});
}
});
@@ -328,4 +328,17 @@ escapeHTML = function(unsafe) {
.replace(/>/g, ">")
.replace(/"/g, """)
.replace(/'/g, "'");
- } \ No newline at end of file
+ }
+
+chatEmote = function(msg) {
+ return msg.replace(":D", "😀")
+ .replace("O:)", "😇")
+ .replace("0:)", "😇")
+ .replace(":)", "🙂")
+ .replace(":(", "🙁")
+ .replace(":o", "😮")
+ .replace(":O", "😲")
+ .replace(":'(", "😢")
+ .replace(":')", "🥲")
+ .replace(":P", "😛");
+}