Redesign playlist management
This commit is contained in:
parent
bd7288bed3
commit
b87dd8b5e7
8 changed files with 117 additions and 31 deletions
|
|
@ -760,11 +760,62 @@ Callbacks = {
|
|||
}
|
||||
else {
|
||||
var pls = data.pllist;
|
||||
$("#userpl_dropdown").html("");
|
||||
pls.sort(function(a, b) {
|
||||
var x = a.name.toLowerCase();
|
||||
var y = b.name.toLowerCase();
|
||||
if(x < y) return -1;
|
||||
if(x > y) return 1;
|
||||
return 0;
|
||||
});
|
||||
$("#userpl_list").html("");
|
||||
for(var i = 0; i < pls.length; i++) {
|
||||
$("<option/>").attr("value", pls[i].name)
|
||||
.text(pls[i].name)
|
||||
.appendTo($("#userpl_dropdown"));
|
||||
var li = $("<li/>").appendTo($("#userpl_list"))
|
||||
.addClass("well");
|
||||
li.data("pl-name", pls[i].name);
|
||||
$("<div/>").text(pls[i].name).appendTo(li)
|
||||
.css("float", "left")
|
||||
.css("margin-left", "1em");
|
||||
var bg = $("<div/>").addClass("btn-group")
|
||||
.css("float", "left")
|
||||
.prependTo(li);
|
||||
var del = $("<button/>")
|
||||
.addClass("btn btn-mini btn-danger")
|
||||
.prependTo(bg);
|
||||
$("<i/>").addClass("icon-trash").appendTo(del);
|
||||
(function(li) {
|
||||
del.click(function() {
|
||||
socket.emit("deletePlaylist", {
|
||||
name: li.data("pl-name")
|
||||
});
|
||||
});
|
||||
})(li);
|
||||
if(hasPermission("playlistaddlist")) {
|
||||
(function(li) {
|
||||
$("<button/>").addClass("btn btn-mini")
|
||||
.text("End")
|
||||
.prependTo(bg)
|
||||
.click(function() {
|
||||
socket.emit("queuePlaylist", {
|
||||
name: li.data("pl-name"),
|
||||
pos: "end"
|
||||
});
|
||||
});
|
||||
})(li);
|
||||
|
||||
if(hasPermission("playlistnext")) {
|
||||
(function(li) {
|
||||
$("<button/>").addClass("btn btn-mini")
|
||||
.text("Next")
|
||||
.prependTo(bg)
|
||||
.click(function() {
|
||||
socket.emit("queuePlaylist", {
|
||||
name: li.data("pl-name"),
|
||||
pos: "next"
|
||||
});
|
||||
});
|
||||
})(li);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -572,20 +572,6 @@ $("#userpl_name").keydown(function(ev) {
|
|||
}
|
||||
});
|
||||
|
||||
$("#userpl_queuenext").click(function() {
|
||||
socket.emit("queuePlaylist", {
|
||||
name: $("#userpl_dropdown").val(),
|
||||
pos: "next"
|
||||
});
|
||||
});
|
||||
|
||||
$("#userpl_queueend").click(function() {
|
||||
socket.emit("queuePlaylist", {
|
||||
name: $("#userpl_dropdown").val(),
|
||||
pos: "end"
|
||||
});
|
||||
});
|
||||
|
||||
$("#show_userpl").click(function() {
|
||||
$("#show_library").parent().removeClass("active");
|
||||
$("#show_userpl").parent().addClass("active");
|
||||
|
|
|
|||
|
|
@ -784,8 +784,8 @@ function handlePermissionChange() {
|
|||
setVisible("#clearplaylist", hasPermission("playlistclear"));
|
||||
setVisible("#shuffleplaylist", hasPermission("playlistshuffle"));
|
||||
|
||||
$("#userpl_queueend").attr("disabled", !hasPermission("playlistadd"));
|
||||
$("#userpl_queuenext").attr("disabled", !hasPermission("playlistnext"));
|
||||
$("#userpl_queueend").attr("disabled", !hasPermission("playlistaddlist"));
|
||||
$("#userpl_queuenext").attr("disabled", !hasPermission("playlistaddlist") || !hasPermission("playlistnext"));
|
||||
|
||||
setVisible("#modnav", RANK >= 2);
|
||||
setVisible("#chanperms_tab", RANK >= 3);
|
||||
|
|
@ -1268,6 +1268,7 @@ function genPermissionsEditor() {
|
|||
makeOption("Move playlist items", "oplaylistmove", standard, CHANPERMS.oplaylistmove+"");
|
||||
makeOption("Delete playlist items", "oplaylistdelete", standard, CHANPERMS.oplaylistdelete+"");
|
||||
makeOption("Jump to video", "oplaylistjump", standard, CHANPERMS.oplaylistjump+"");
|
||||
makeOption("Queue playlist", "oplaylistaddlist", standard, CHANPERMS.oplaylistaddlist+"");
|
||||
|
||||
addDivider("General playlist permissions");
|
||||
makeOption("Add to playlist", "playlistadd", standard, CHANPERMS.playlistadd+"");
|
||||
|
|
@ -1275,6 +1276,7 @@ function genPermissionsEditor() {
|
|||
makeOption("Move playlist items", "playlistmove", standard, CHANPERMS.playlistmove+"");
|
||||
makeOption("Delete playlist items", "playlistdelete", standard, CHANPERMS.playlistdelete+"");
|
||||
makeOption("Jump to video", "playlistjump", standard, CHANPERMS.playlistjump+"");
|
||||
makeOption("Queue playlist", "playlistaddlist", standard, CHANPERMS.playlistaddlist+"");
|
||||
makeOption("Add nontemporary media", "addnontemp", standard, CHANPERMS.addnontemp+"");
|
||||
makeOption("Temp/untemp playlist item", "settemp", standard, CHANPERMS.settemp+"");
|
||||
makeOption("Retrieve playlist URLs", "playlistgeturl", standard, CHANPERMS.playlistgeturl+"");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue