Add quick mute buttons, fix delete not updating playlist meta

This commit is contained in:
calzoneman 2014-01-19 16:50:14 -06:00
parent cd73653451
commit 8c47221a22
3 changed files with 48 additions and 3 deletions

View file

@ -159,7 +159,8 @@ function getNameColor(rank) {
function addUserDropdown(entry) {
var name = entry.data("name"),
rank = entry.data("rank"),
leader = entry.data("leader");
leader = entry.data("leader"),
meta = entry.data("meta") || {};
entry.find(".user-dropdown").remove();
var menu = $("<div/>")
.addClass("user-dropdown")
@ -222,6 +223,49 @@ function addUserDropdown(entry) {
.appendTo(btngroup);
}
/* mute buttons */
if (hasPermission("mute")) {
var mute = $("<button/>").addClass("btn btn-xs btn-default")
.text("Mute")
.click(function () {
socket.emit("chatMsg", {
msg: "/mute " + name
});
mute.hide();
smute.hide();
unmute.show();
})
.appendTo(btngroup);
var smute = $("<button/>").addClass("btn btn-xs btn-default")
.text("Shadow Mute")
.click(function () {
socket.emit("chatMsg", {
msg: "/smute " + name
});
mute.hide();
smute.hide();
unmute.show();
})
.appendTo(btngroup);
var unmute = $("<button/>").addClass("btn btn-xs btn-default")
.text("Unmute")
.click(function () {
socket.emit("chatMsg", {
msg: "/unmute " + name
});
unmute.hide();
mute.show();
smute.show();
})
.appendTo(btngroup);
if (meta.muted) {
mute.hide();
smute.hide();
} else {
unmute.hide();
}
}
/* ban buttons */
if(hasPermission("ban")) {
$("<button/>").addClass("btn btn-xs btn-default")