/** * Copyright 2013 Calvin 'calzoneman' Montgomery * * Licensed under Creative Commons Attribution-NonCommercial 3.0 * See http://creativecommons.org/licenses/by-nc/3.0/ * */ // Wrapped in a function so I can ensure that the socket // is defined before these statements are run function initCallbacks() { socket.on('disconnect', function() { $('
').addClass('alert').addClass('alert-error') .insertAfter($('.row')[0])[0] .innerHTML = "

Disconnected from server

"; }); socket.on('channelNotRegistered', function() { showChannelRegistration(); }); socket.on('announcement', function(data) { showAnnouncement(data.title, data.text); }); socket.on('registerChannel', function(data) { if(data.success) { $('#chregnotice').remove(); } else { alert(data.error); } }); socket.on('rank', function(data) { if(data.rank >= Rank.Moderator) { $('#playlist_controls').css("display", "block"); $('#playlist_controls button').each(function() { $(this).attr('disabled', false); }); $('#qlockbtn').css("display", "block"); var poll = $('#pollcontainer .active'); if(poll.length > 0) { $('