Send textbased emoticons, Closes #96

This commit is contained in:
Jeremy Zhang 2018-03-19 19:41:24 +00:00
parent c62a7a3752
commit c2659c39a9

View File

@ -1449,6 +1449,26 @@
} }
}); });
function stringToDefaultEmote(input) {
var map = {
"<3": "\u2764\uFE0F",
"</3": "\uD83D\uDC94",
":D": "\uD83D\uDE00",
":)": "\uD83D\uDE03",
";)": "\uD83D\uDE09",
":(": "\uD83D\uDE12",
":p": "\uD83D\uDE1B",
";p": "\uD83D\uDE1C",
":'(": "\uD83D\uDE22"
};
for (var i in map) {
var escaped = i.replace(/([()[{*+.$^\\|?])/g, '\\$1');
var regex = new RegExp(escaped, 'gim');
input = input.replace(regex, map[i]);
}
return input;
}
$("#chatcontent").bind("click", function () { $("#chatcontent").bind("click", function () {
$("#mention-picker").hide(); $("#mention-picker").hide();
}); });
@ -1571,6 +1591,7 @@
emojiConvertor.replace_mode = "unified"; emojiConvertor.replace_mode = "unified";
emojiConvertor.allow_native = true; emojiConvertor.allow_native = true;
var messageInput = emojiConvertor.replace_colons($(this).val()); var messageInput = emojiConvertor.replace_colons($(this).val());
messageInput = stringToDefaultEmote(messageInput);
var funct = post(selected_channel, messageInput); var funct = post(selected_channel, messageInput);
funct.done(function(data) { funct.done(function(data) {
$("#messagebox").val(""); $("#messagebox").val("");