Callbacks = { error: function (reason) { window.SOCKET_ERROR_REASON = reason; }, /* fired when socket connection completes */ connect: function() { socket.emit("initChannelCallbacks"); socket.emit("joinChannel", { name: CHANNEL.name }); if (CHANNEL.opts.password) { socket.emit("channelPassword", CHANNEL.opts.password); } if (CLIENT.name && CLIENT.guest) { socket.emit("login", { name: CLIENT.name }); } $("
").addClass("server-msg-reconnect") .text("Connected") .appendTo($("#messagebuffer")); scrollChat(); }, disconnect: function() { if(KICKED) return; $("
") .addClass("server-msg-disconnect") .text("Disconnected from server. Attempting reconnection...") .appendTo($("#messagebuffer")); scrollChat(); }, errorMsg: function(data) { if (data.alert) { alert(data.msg); } else { errDialog(data.msg); } }, costanza: function (data) { hidePlayer(); $("#costanza-modal").modal("hide"); var modal = makeModal(); modal.attr("id", "costanza-modal") .appendTo($("body")); var body = $("
").addClass("modal-body") .appendTo(modal.find(".modal-content")); $("").attr("src", "http://i0.kym-cdn.com/entries/icons/original/000/005/498/1300044776986.jpg") .appendTo(body); $("").text(data.msg).appendTo(body); hidePlayer(); modal.modal(); }, announcement: function(data) { $("#announcements").html(""); makeAlert(data.title, data.text) .appendTo($("#announcements")); }, kick: function(data) { KICKED = true; $("
").addClass("server-msg-disconnect") .text("Kicked: " + data.reason) .appendTo($("#messagebuffer")); scrollChat(); }, noflood: function(data) { $("
") .addClass("server-msg-disconnect") .text(data.action + ": " + data.msg) .appendTo($("#messagebuffer")); scrollChat(); }, needPassword: function (wrongpw) { var div = $("
"); $("").text("Channel Password") .appendTo(div); if (wrongpw) { $("
").appendTo(div); $("").addClass("text-error") .text("Wrong Password") .appendTo(div); } var pwbox = $("").addClass("form-control") .attr("type", "password") .appendTo(div); var submit = $("