diff options
author | jak1 <jak1@themanaworld.org> | 2023-01-12 13:06:10 +0100 |
---|---|---|
committer | jak1 <jak1@themanaworld.org> | 2023-01-12 13:06:10 +0100 |
commit | 3808842dc1530c879acafe6597d7c5802bdf3d23 (patch) | |
tree | 8bae5c4f5d807d868c3730adc3381731b23d05ba | |
parent | cf42b00752da9c0cbf3842194f073c83e53fde48 (diff) | |
download | thepixelworld-3808842dc1530c879acafe6597d7c5802bdf3d23.tar.gz thepixelworld-3808842dc1530c879acafe6597d7c5802bdf3d23.tar.bz2 thepixelworld-3808842dc1530c879acafe6597d7c5802bdf3d23.tar.xz thepixelworld-3808842dc1530c879acafe6597d7c5802bdf3d23.zip |
added basic chat emotes
-rw-r--r-- | app.js | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -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", "😛"); +} |