Implement emotes

This commit is contained in:
calzoneman 2014-02-12 23:33:42 -06:00
parent 53138fe1f0
commit 002888a0de
8 changed files with 185 additions and 15 deletions

View file

@ -609,6 +609,19 @@ $("#cs-chatfilters-newsubmit").click(function () {
$("#cs-chatfilters-newreplace").val("");
});
$("#cs-emotes-newsubmit").click(function () {
var name = $("#cs-emotes-newname").val();
var image = $("#cs-emotes-newimage").val();
socket.emit("updateEmote", {
name: name,
image: image,
});
$("#cs-emotes-newname").val("");
$("#cs-emotes-newimage").val("");
});
$("#cs-chatfilters-export").click(function () {
var callback = function (data) {
socket.listeners("chatFilters").splice(
@ -644,6 +657,38 @@ $("#cs-chatfilters-import").click(function () {
socket.emit("importFilters", data);
});
$("#cs-emotes-export").click(function () {
var em = CHANNEL.emotes.map(function (f) {
return {
name: f.name,
image: f.image
};
});
$("#cs-emotes-exporttext").val(JSON.stringify(em));
});
$("#cs-emotes-import").click(function () {
var text = $("#cs-emotes-exporttext").val();
var choose = confirm("You are about to import emotes from the contents of the textbox below the import button. If this is empty, it will clear all of your emotes. Are you sure you want to continue?");
if (!choose) {
return;
}
if (text.trim() === "") {
text = "[]";
}
var data;
try {
data = JSON.parse(text);
} catch (e) {
alert("Invalid import data: " + e);
return;
}
socket.emit("importEmotes", data);
});
var toggleUserlist = function () {
if ($("#userlist").css("display") === "none") {
$("#userlist").show();