Callbacks = { error: function (reason) { window.SOCKET_ERROR_REASON = reason; }, /* fired when socket connection completes */ connect: function() { HAS_CONNECTED_BEFORE = true; SOCKETIO_CONNECT_ERROR_COUNT = 0; $("#socketio-connect-error").remove(); 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(); stopQueueSpinner(null); }, disconnect: function() { if(KICKED) return; $("
") .addClass("server-msg-disconnect") .text("Disconnected from server.") .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(""); var signature = "
\u2014" + data.from; var announcement = makeAlert(data.title, data.text + signature) .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(); }, spamFiltered: function(data) { var message = "Spam Filtered."; switch (data.reason) { case "NEW_USER_CHAT": message = "Your account is too new to chat in this channel. " + "Please wait a while and try again."; break; case "NEW_USER_CHAT_LINK": message = "Your account is too new to post links in this channel. " + "Please wait a while and try again."; break; } errDialog(message); }, 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 = $("