Add banlist interface
This commit is contained in:
parent
3a585cbb60
commit
a5ca7d227e
6 changed files with 129 additions and 2 deletions
|
|
@ -55,6 +55,7 @@ function initCallbacks() {
|
|||
addUserDropdown(users[i], users[i].children[1].innerHTML);
|
||||
}
|
||||
|
||||
$('#modnav').show();
|
||||
$('#chancontrols').show();
|
||||
}
|
||||
RANK = data.rank;
|
||||
|
|
@ -105,6 +106,10 @@ function initCallbacks() {
|
|||
rebuildPlaylist();
|
||||
});
|
||||
|
||||
socket.on('banlist', function(data) {
|
||||
updateBanlist(data.entries);
|
||||
});
|
||||
|
||||
socket.on('usercount', function(data) {
|
||||
$('#usercount').text(data.count + " connected users");
|
||||
});
|
||||
|
|
|
|||
|
|
@ -235,6 +235,19 @@ $('#opt_submit').click(function() {
|
|||
socket.emit('channelOpts', opts);
|
||||
});
|
||||
|
||||
$('#show_chancontrols').click(function() {
|
||||
$('#show_chancontrols').parent().addClass("active");
|
||||
$('#show_banlist').parent().removeClass("active");
|
||||
$('#banlist').hide();
|
||||
$('#chancontrols').show();
|
||||
});
|
||||
|
||||
$('#show_banlist').click(function() {
|
||||
$('#show_chancontrols').parent().removeClass("active");
|
||||
$('#show_banlist').parent().addClass("active");
|
||||
$('#banlist').show();
|
||||
$('#chancontrols').hide();
|
||||
});
|
||||
|
||||
function searchLibrary() {
|
||||
socket.emit('searchLibrary', {
|
||||
|
|
|
|||
|
|
@ -599,3 +599,26 @@ function showAnnouncement(title, text) {
|
|||
$('<h3/>').text(title).appendTo(div);
|
||||
$('<p/>').html(text).appendTo(div);
|
||||
}
|
||||
|
||||
function updateBanlist(entries) {
|
||||
var tbl = $('#banlist table');
|
||||
if(tbl.children().length > 1) {
|
||||
$(tbl.children()[1]).remove();
|
||||
}
|
||||
for(var i = 0; i < entries.length; i++) {
|
||||
var tr = $('<tr/>').appendTo(tbl);
|
||||
var remove = $('<button/>').addClass("btn btn-mini btn-danger")
|
||||
.appendTo($('<td/>').appendTo(tr));
|
||||
$('<i/>').addClass("icon-remove-circle").appendTo(remove);
|
||||
var ip = $('<td/>').text(entries[i].ip).appendTo(tr);
|
||||
var name = $('<td/>').text(entries[i].name).appendTo(tr);
|
||||
var banner = $('<td/>').text(entries[i].banner).appendTo(tr);
|
||||
|
||||
var callback = (function(ip) { return function() {
|
||||
socket.emit('chatMsg', {
|
||||
msg: "/unban " + ip
|
||||
});
|
||||
} })(entries[i].ip);
|
||||
remove.click(callback);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue