mirror of https://github.com/calzoneman/sync.git
Various fixes
This commit is contained in:
parent
87f44b69e0
commit
b1e6f696e8
|
@ -11,6 +11,7 @@ var ChatCommand = require("./chatcommand");
|
|||
|
||||
var fs = require("fs");
|
||||
var path = require("path");
|
||||
var url = require("url");
|
||||
|
||||
var DEFAULT_FILTERS = [
|
||||
new Filter("monospace", "`(.+?)`", "g", "<code>$1</code>"),
|
||||
|
@ -889,8 +890,6 @@ Channel.prototype.sendBanlist = function (users) {
|
|||
return;
|
||||
}
|
||||
|
||||
console.log(banlist);
|
||||
|
||||
for (var i = 0; i < banlist.length; i++) {
|
||||
bans.push({
|
||||
id: banlist[i].id,
|
||||
|
@ -1496,6 +1495,10 @@ Channel.prototype.addMedia = function (data, callback) {
|
|||
media.pos = data.pos;
|
||||
media.queueby = data.queueby;
|
||||
media.temp = data.temp;
|
||||
if (data.title && media.type === "cu") {
|
||||
media.title = data.title;
|
||||
}
|
||||
|
||||
var res = self.playlist.addMedia(media);
|
||||
if (res.error) {
|
||||
callback(res.error, null);
|
||||
|
@ -1701,7 +1704,9 @@ Channel.prototype.handleQueuePlaylist = function (user, data) {
|
|||
* Handles a user message to delete a playlist item
|
||||
*/
|
||||
Channel.prototype.handleDelete = function (user, data) {
|
||||
if (!this.hasPermission(user, "playlistdelete")) {
|
||||
var self = this;
|
||||
|
||||
if (!self.hasPermission(user, "playlistdelete")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1709,9 +1714,11 @@ Channel.prototype.handleDelete = function (user, data) {
|
|||
return;
|
||||
}
|
||||
|
||||
this.deleteMedia(data, function (err) {
|
||||
if (!err) {
|
||||
this.logger.log("### " + user.name + " deleted " + plitem.media.title);
|
||||
var plitem = self.playlist.items.find(data);
|
||||
|
||||
self.deleteMedia(data, function (err) {
|
||||
if (!err && plitem && plitem.media) {
|
||||
self.logger.log("### " + user.name + " deleted " + plitem.media.title);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
@ -265,6 +265,7 @@ User.prototype.initChannelCallbacks = function () {
|
|||
});
|
||||
|
||||
wrapTypecheck("queue", function (data) {
|
||||
console.log("queue", data);
|
||||
self.channel.handleQueue(self, data);
|
||||
});
|
||||
|
||||
|
@ -276,7 +277,7 @@ User.prototype.initChannelCallbacks = function () {
|
|||
self.channel.handleMove(self, data);
|
||||
});
|
||||
|
||||
wrapTypecheck("delete", function (data) {
|
||||
wrap("delete", function (data) {
|
||||
self.channel.handleDelete(self, data);
|
||||
});
|
||||
|
||||
|
@ -284,8 +285,8 @@ User.prototype.initChannelCallbacks = function () {
|
|||
self.channel.handleUncache(self, data);
|
||||
});
|
||||
|
||||
wrapTypecheck("jumpto", function (data) {
|
||||
self.channel.handleJump(self, data);
|
||||
wrap("jumpTo", function (data) {
|
||||
self.channel.handleJumpTo(self, data);
|
||||
});
|
||||
|
||||
wrap("playNext", function () {
|
||||
|
|
|
@ -119,14 +119,16 @@ html(lang="en")
|
|||
#customembed.collapse.plcontrol-collapse.col-lg-12.col-md-12
|
||||
.vertical-spacer
|
||||
.input-group
|
||||
input#customembed_title.form-control(type="text", placeholder="Title (optional)")
|
||||
input#customembed-title.form-control(type="text", placeholder="Title (optional)")
|
||||
span.input-group-btn
|
||||
button#ce_queue_next.btn.btn-default Next
|
||||
span.input-group-btn
|
||||
button#ce_queue_end.btn.btn-default At End
|
||||
| Paste the embed code below and click Next or At End.
|
||||
| Acceptable embed codes are <code><iframe></code> and <code><object></code> tags.
|
||||
textarea#customembed_code.input-block-level.form-control(rows="3")
|
||||
textarea#customembed-content.input-block-level.form-control(rows="3")
|
||||
#queuefail.col-lg-12.col-md-12
|
||||
.vertical-spacer
|
||||
.col-lg-12.col-md-12
|
||||
#queue.videolist
|
||||
#plmeta
|
||||
|
|
|
@ -796,12 +796,12 @@ Callbacks = {
|
|||
: "Added by: Unknown");
|
||||
if (data.after === "prepend") {
|
||||
li.prependTo(q);
|
||||
li.show("blind", function () {
|
||||
li.show("fade", function () {
|
||||
plq.release();
|
||||
});
|
||||
} else if (data.after === "append") {
|
||||
li.appendTo(q);
|
||||
li.show("blind", function () {
|
||||
li.show("fade", function () {
|
||||
plq.release();
|
||||
});
|
||||
} else {
|
||||
|
@ -811,7 +811,7 @@ Callbacks = {
|
|||
return;
|
||||
}
|
||||
li.insertAfter(liafter);
|
||||
li.show("blind", function () {
|
||||
li.show("fade", function () {
|
||||
plq.release();
|
||||
});
|
||||
}
|
||||
|
@ -854,7 +854,7 @@ Callbacks = {
|
|||
PL_ACTION_QUEUE.queue(function (plq) {
|
||||
PL_WAIT_SCROLL = true;
|
||||
var li = $(".pluid-" + data.uid);
|
||||
li.hide("blind", function() {
|
||||
li.hide("fade", function() {
|
||||
li.remove();
|
||||
plq.release();
|
||||
PL_WAIT_SCROLL = false;
|
||||
|
|
|
@ -270,65 +270,56 @@ $("#queue").sortable({
|
|||
});
|
||||
$("#queue").disableSelection();
|
||||
|
||||
// TODO no more comma separated queueing.
|
||||
function queue(pos) {
|
||||
if($("#customembed_code").val()) {
|
||||
var title = false;
|
||||
if($("#customembed_title").val()) {
|
||||
title = $("#customembed_title").val();
|
||||
}
|
||||
socket.emit("queue", {
|
||||
id: $("#customembed_code").val(),
|
||||
title: title,
|
||||
type: "cu",
|
||||
pos: pos
|
||||
});
|
||||
$("#customembed_code").val("");
|
||||
$("#customembed_title").val("");
|
||||
return;
|
||||
function queue(pos, src) {
|
||||
if (!src) {
|
||||
src = "url";
|
||||
}
|
||||
var links = $("#mediaurl").val().split(",");
|
||||
var parsed = [];
|
||||
links.forEach(function(link) {
|
||||
var data = parseMediaLink(link);
|
||||
if(data.id === null || data.type === null) {
|
||||
makeAlert("Error", "Invalid link. Please double check it and remove extraneous information", "alert-danger")
|
||||
.insertBefore($("#extended_controls"));
|
||||
}
|
||||
else {
|
||||
$("#mediaurl").val("");
|
||||
}
|
||||
parsed.push({
|
||||
id: data.id,
|
||||
type: data.type
|
||||
});
|
||||
});
|
||||
|
||||
if(parsed.length > 1) {
|
||||
if (src === "customembed") {
|
||||
var title = $("#customembed-title").val();
|
||||
if (!title) {
|
||||
title = false;
|
||||
}
|
||||
var content = $("#customembed-content").val();
|
||||
|
||||
socket.emit("queue", {
|
||||
id: false,
|
||||
list: parsed,
|
||||
type: "list",
|
||||
pos: pos
|
||||
id: content,
|
||||
title: title,
|
||||
pos: pos,
|
||||
type: "cu"
|
||||
});
|
||||
}
|
||||
else {
|
||||
parsed[0].pos = pos;
|
||||
socket.emit("queue", parsed[0]);
|
||||
} else {
|
||||
var link = $("#mediaurl").val();
|
||||
var data = parseMediaLink(link);
|
||||
if (data.id == null || data.type == null) {
|
||||
makeAlert("Error", "Failed to parse link. Please check that it is correct",
|
||||
"alert-danger")
|
||||
.insertAfter($("#addfromurl"));
|
||||
} else {
|
||||
$("#mediaurl").val("");
|
||||
socket.emit("queue", {
|
||||
id: data.id,
|
||||
type: data.type,
|
||||
pos: pos
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$("#queue_next").click(function() {
|
||||
queue("next");
|
||||
});
|
||||
|
||||
$("#queue_end").click(function() {
|
||||
queue("end");
|
||||
});
|
||||
$("#queue_next").click(queue.bind(this, "next", "url"));
|
||||
$("#queue_end").click(queue.bind(this, "end", "url"));
|
||||
$("#ce_queue_next").click(queue.bind(this, "next", "customembed"));
|
||||
$("#ce_queue_end").click(queue.bind(this, "end", "customembed"));
|
||||
|
||||
$("#mediaurl").keydown(function(ev) {
|
||||
if(ev.keyCode == 13) {
|
||||
queue("end");
|
||||
if (ev.keyCode === 13) {
|
||||
queue("end", "url");
|
||||
}
|
||||
});
|
||||
|
||||
$("#customembed-content").keydown(function(ev) {
|
||||
if (ev.keyCode === 13) {
|
||||
queue("end", "customembed");
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -341,13 +332,6 @@ $("#voteskip").click(function() {
|
|||
$("#voteskip").attr("disabled", true);
|
||||
});
|
||||
|
||||
$("#customembed_btn").click(function () {
|
||||
if($("#customembed_entry").css("display") == "none")
|
||||
$("#customembed_entry").show("blind");
|
||||
else
|
||||
$("#customembed_entry").hide("blind");
|
||||
});
|
||||
|
||||
$("#getplaylist").click(function() {
|
||||
var callback = function(data) {
|
||||
hidePlayer();
|
||||
|
|
|
@ -21,7 +21,7 @@ function makeAlert(title, text, klass) {
|
|||
$("<strong/>").text(title).prependTo(al);
|
||||
$("<button/>").addClass("close pull-right").html("×")
|
||||
.click(function() {
|
||||
al.hide("blind", function() {
|
||||
al.hide("fade", function() {
|
||||
al.remove();
|
||||
});
|
||||
})
|
||||
|
@ -817,7 +817,7 @@ function handlePermissionChange() {
|
|||
.click(function() {
|
||||
USEROPTS.first_visit = false;
|
||||
storeOpts();
|
||||
al.hide("blind", function() {
|
||||
al.hide("fade", function() {
|
||||
al.remove();
|
||||
});
|
||||
});
|
||||
|
@ -881,7 +881,7 @@ function addLibraryButtons(li, id, source) {
|
|||
.addClass("pull-left")
|
||||
.prependTo(li);
|
||||
|
||||
var type = (source === "library") ? undefined : source;
|
||||
var type = (source === "library") ? "lib" : source;
|
||||
|
||||
if(hasPermission("playlistadd")) {
|
||||
if(hasPermission("playlistnext")) {
|
||||
|
@ -914,7 +914,7 @@ function addLibraryButtons(li, id, source) {
|
|||
socket.emit("uncache", {
|
||||
id: id
|
||||
});
|
||||
li.hide("blind", function() {
|
||||
li.hide("fade", function() {
|
||||
li.remove();
|
||||
});
|
||||
})
|
||||
|
@ -999,17 +999,17 @@ function playlistMove(from, after, cb) {
|
|||
var q = $("#queue");
|
||||
|
||||
if(after === "prepend") {
|
||||
lifrom.hide("blind", function() {
|
||||
lifrom.hide("fade", function() {
|
||||
lifrom.detach();
|
||||
lifrom.prependTo(q);
|
||||
lifrom.show("blind", cb);
|
||||
lifrom.show("fade", cb);
|
||||
});
|
||||
}
|
||||
else if(after === "append") {
|
||||
lifrom.hide("blind", function() {
|
||||
lifrom.hide("fade", function() {
|
||||
lifrom.detach();
|
||||
lifrom.appendTo(q);
|
||||
lifrom.show("blind", cb);
|
||||
lifrom.show("fade", cb);
|
||||
});
|
||||
}
|
||||
else {
|
||||
|
@ -1018,10 +1018,10 @@ function playlistMove(from, after, cb) {
|
|||
cb(false);
|
||||
return;
|
||||
}
|
||||
lifrom.hide("blind", function() {
|
||||
lifrom.hide("fade", function() {
|
||||
lifrom.detach();
|
||||
lifrom.insertAfter(liafter);
|
||||
lifrom.show("blind", cb);
|
||||
lifrom.show("fade", cb);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -245,11 +245,7 @@
|
|||
border-color: #bce8f1;
|
||||
}
|
||||
|
||||
#queue {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
#queue li:last-child {
|
||||
#queue > li:last-child {
|
||||
border-bottom: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
@ -479,3 +475,11 @@
|
|||
padding-top: 0;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.qfalert {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
#customembed-content {
|
||||
font-family: Monospace;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue