mirror of https://github.com/calzoneman/sync.git
Fixes, continue work
This commit is contained in:
parent
42fc2e45c8
commit
1850f009ff
24
channel.js
24
channel.js
|
@ -916,7 +916,7 @@ Channel.prototype.broadcastVoteskipUpdate = function() {
|
|||
}
|
||||
|
||||
Channel.prototype.broadcastMotd = function() {
|
||||
this.sendAll("updateMotd", this.motd);
|
||||
this.sendAll("setMotd", this.motd);
|
||||
}
|
||||
|
||||
Channel.prototype.broadcastDrinks = function() {
|
||||
|
@ -1150,7 +1150,7 @@ Channel.prototype.trySetTemp = function(user, data) {
|
|||
}
|
||||
|
||||
|
||||
Channel.prototype.dequeue = function(position) {
|
||||
Channel.prototype.dequeue = function(position, removeonly) {
|
||||
if(position < 0 || position >= this.queue.length) {
|
||||
return;
|
||||
}
|
||||
|
@ -1161,6 +1161,9 @@ Channel.prototype.dequeue = function(position) {
|
|||
});
|
||||
this.broadcastPlaylistMeta();
|
||||
|
||||
if(removeonly)
|
||||
return;
|
||||
|
||||
// If you remove the currently playing video, play the next one
|
||||
if(position == this.position) {
|
||||
this.position--;
|
||||
|
@ -1223,7 +1226,7 @@ Channel.prototype.jumpTo = function(pos) {
|
|||
|
||||
var old = this.position;
|
||||
if(this.media && this.media.temp && old != pos) {
|
||||
this.dequeue({pos: old, removeonly: true});
|
||||
this.dequeue(old, true);
|
||||
if(pos > old && pos > 0) {
|
||||
pos--;
|
||||
}
|
||||
|
@ -1293,9 +1296,9 @@ Channel.prototype.shufflequeue = function() {
|
|||
this.queue.splice(i, 1);
|
||||
}
|
||||
this.queue = n;
|
||||
for(var i = 0; i < this.users.length; i++) {
|
||||
this.sendPlaylist(this.users[i]);
|
||||
}
|
||||
this.sendAll("playlist", this.queue);
|
||||
this.sendAll("setPosition", this.position);
|
||||
this.sendAll("setPlaylistMeta", this.plmeta);
|
||||
}
|
||||
|
||||
Channel.prototype.tryShufflequeue = function(user) {
|
||||
|
@ -1343,13 +1346,16 @@ Channel.prototype.move = function(data, user) {
|
|||
var media = this.queue[data.from];
|
||||
var to = data.to > data.from ? data.to + 1 : data.to;
|
||||
var from = data.to > data.from ? data.from : data.from + 1;
|
||||
var moveby = user && user.name ? user.name : null;
|
||||
if(typeof data.moveby !== "undefined")
|
||||
moveby = data.moveby;
|
||||
|
||||
this.queue.splice(to, 0, media);
|
||||
this.queue.splice(from, 1);
|
||||
this.sendAll("moveVideo", {
|
||||
from: data.from,
|
||||
to: data.to,
|
||||
moveby: user ? user.name : ""
|
||||
moveby: moveby
|
||||
});
|
||||
|
||||
// Account for moving things around the active video
|
||||
|
@ -1369,11 +1375,11 @@ Channel.prototype.tryMove = function(user, data) {
|
|||
return;
|
||||
}
|
||||
|
||||
if(data.src == undefined || data.dest == undefined) {
|
||||
if(typeof data.from !== "number" || typeof data.to !== "number") {
|
||||
return;
|
||||
}
|
||||
|
||||
this.move(data);
|
||||
this.move(data, user);
|
||||
}
|
||||
|
||||
/* REGION Polls */
|
||||
|
|
8
user.js
8
user.js
|
@ -236,13 +236,13 @@ User.prototype.initCallbacks = function() {
|
|||
}
|
||||
}.bind(this));
|
||||
|
||||
this.socket.on("clearqueue", function() {
|
||||
this.socket.on("clearPlaylist", function() {
|
||||
if(this.channel != null) {
|
||||
this.channel.tryClearqueue(this);
|
||||
}
|
||||
}.bind(this));
|
||||
|
||||
this.socket.on("shufflequeue", function() {
|
||||
this.socket.on("shufflePlaylist", function() {
|
||||
if(this.channel != null) {
|
||||
this.channel.tryShufflequeue(this);
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ User.prototype.initCallbacks = function() {
|
|||
|
||||
this.socket.on("searchMedia", function(data) {
|
||||
if(this.channel != null) {
|
||||
if(data.yt) {
|
||||
if(data.source == "yt") {
|
||||
var callback = function(vids) {
|
||||
this.socket.emit("searchResults", {
|
||||
results: vids
|
||||
|
@ -373,7 +373,7 @@ User.prototype.initCallbacks = function() {
|
|||
}
|
||||
}.bind(this));
|
||||
|
||||
this.socket.on("updateMotd", function(data) {
|
||||
this.socket.on("setMotd", function(data) {
|
||||
if(this.channel != null) {
|
||||
this.channel.tryUpdateMotd(this, data);
|
||||
}
|
||||
|
|
|
@ -153,7 +153,7 @@ textarea::-webkit-input-placeholder {
|
|||
/* line 18, ../bootstrap/bootstrap/_sprites.scss */
|
||||
[class^="icon-"],
|
||||
[class*=" icon-"] {
|
||||
background-image: url("../img/glyphicons-halflings.png");
|
||||
background-image: url("../img/glyphicons-halflings-white.png");
|
||||
}
|
||||
|
||||
/* White icons with optional class, or on hover/active states of certain elements */
|
||||
|
@ -946,6 +946,20 @@ select:focus:invalid:focus {
|
|||
color: #ff9900;
|
||||
}
|
||||
|
||||
#usercountwrap, #currenttitle, #videowrap,
|
||||
#librarytoggle, #userpltoggle, #playlisttoggle {
|
||||
background-color: #2f2f2f;
|
||||
}
|
||||
|
||||
.queue_entry {
|
||||
background-color: #111111;
|
||||
}
|
||||
|
||||
.queue_active {
|
||||
border-color: #ff9900;
|
||||
background-color: #332200;
|
||||
}
|
||||
|
||||
#plmeta {
|
||||
background-color: rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
body, #videowrap {
|
||||
background-color: #2f2f2f;
|
||||
}
|
||||
|
||||
.queue_entry {
|
||||
background-color: #111111;
|
||||
}
|
||||
|
||||
.queue_active {
|
||||
border-color: #ff9900;
|
||||
background-color: #332200;
|
||||
}
|
||||
|
||||
#userpltoggle, #librarytoggle, #playlisttoggle {
|
||||
color: #cccccc;
|
||||
background-color: #2f2f2f;
|
||||
}
|
||||
|
||||
#currenttitle {
|
||||
color: #cccccc;
|
||||
}
|
||||
|
||||
.qe_time {
|
||||
color: #cccccc;
|
||||
}
|
||||
|
||||
#userpltoggle i[class^="icon-"], #userpltoggle i[class*=" icon-"],
|
||||
#librarytoggle i[class^="icon-"], #librarytoggle i[class*=" icon-"],
|
||||
#playlisttoggle i[class^="icon-"], #playlisttoggle i[class*=" icon-"] {
|
||||
background-image: url("../img/glyphicons-halflings-white.png");
|
||||
}
|
||||
|
||||
#plmeta {
|
||||
color: #cccccc;
|
||||
background-color: #2f2f2f;
|
||||
background-color: rgba(0, 0, 0, 0.3);
|
||||
}
|
|
@ -101,8 +101,11 @@ html, body {
|
|||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.queue_entry {
|
||||
.queue_sortable li {
|
||||
cursor: row-resize;
|
||||
}
|
||||
|
||||
.queue_entry {
|
||||
background-color: #ffffff;
|
||||
margin: 2px 0 0 auto;
|
||||
padding: 2px;
|
||||
|
@ -114,6 +117,11 @@ html, body {
|
|||
background-image: url(../img/stripe-diagonal.png);
|
||||
}
|
||||
|
||||
.queue_active {
|
||||
background-color: #d9edf7;
|
||||
border-color: #bce8f1;
|
||||
}
|
||||
|
||||
#plmeta {
|
||||
border: 1px solid #aaaaaa;
|
||||
border-top: 0;
|
||||
|
@ -286,6 +294,17 @@ html, body {
|
|||
padding: 5px;
|
||||
}
|
||||
|
||||
.user-dropdown {
|
||||
z-index: 9999;
|
||||
position: absolute;
|
||||
border: 1px solid #aaaaaa;
|
||||
border-radius: 5px;
|
||||
background-color: #ffffff;
|
||||
color: #000000;
|
||||
max-width: 200px;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.profile-image {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
|
|
|
@ -502,7 +502,7 @@ Callbacks = {
|
|||
},
|
||||
|
||||
queue: function(data) {
|
||||
var li = makeQueueEntry(data.media);
|
||||
var li = makeQueueEntry(data.media, true);
|
||||
li.hide();
|
||||
addQueueButtons(li);
|
||||
var idx = data.pos;
|
||||
|
@ -551,17 +551,25 @@ Callbacks = {
|
|||
|
||||
moveVideo: function(data) {
|
||||
if(data.moveby != CLIENT.name)
|
||||
playlistMove(data.src, data.dest);
|
||||
playlistMove(data.from, data.to);
|
||||
},
|
||||
|
||||
setPosition: function(data) {
|
||||
setPosition: function(position) {
|
||||
$("#queue li").each(function() {
|
||||
$(this).removeClass("queue_active");
|
||||
});
|
||||
if(data.position < 0)
|
||||
if(position < 0)
|
||||
return;
|
||||
POSITION = data.position;
|
||||
POSITION = position;
|
||||
var linew = $("#queue").children()[POSITION];
|
||||
// jQuery UI's sortable thingy kinda fucks this up initially
|
||||
// Wait until it's done
|
||||
if(!$(linew).hasClass("queue_entry")) {
|
||||
setTimeout(function() {
|
||||
Callbacks.setPosition(position);
|
||||
}, 100);
|
||||
return;
|
||||
}
|
||||
$(linew).addClass("queue_active");
|
||||
|
||||
$("#queue").scrollTop(0);
|
||||
|
@ -643,7 +651,7 @@ Callbacks = {
|
|||
.appendTo($("#messagebuffer"));
|
||||
scrollChat();
|
||||
|
||||
var poll = $("<div/>").addClass("well active").prependTo($("#pollcontainer"));
|
||||
var poll = $("<div/>").addClass("well active").prependTo($("#pollwrap"));
|
||||
$("<button/>").addClass("close pull-right").html("×")
|
||||
.appendTo(poll)
|
||||
.click(function() { poll.remove(); });
|
||||
|
@ -687,8 +695,8 @@ Callbacks = {
|
|||
},
|
||||
|
||||
closePoll: function() {
|
||||
if($("#pollcontainer .active").length != 0) {
|
||||
var poll = $("#pollcontainer .active");
|
||||
if($("#pollwrap .active").length != 0) {
|
||||
var poll = $("#pollwrap .active");
|
||||
poll.removeClass("active").addClass("muted");
|
||||
poll.find(".option button").each(function() {
|
||||
$(this).attr("disabled", true);
|
||||
|
|
|
@ -51,9 +51,9 @@ function getOrDefault(k, def) {
|
|||
return true;
|
||||
if(v === "false")
|
||||
return false;
|
||||
if(v.match(/[0-9]+/))
|
||||
if(v.match(/^[0-9]+$/))
|
||||
return parseInt(v);
|
||||
if(v.match(/[0-9\.]+/))
|
||||
if(v.match(/^[0-9\.]+$/))
|
||||
return parseFloat(v);
|
||||
return v;
|
||||
}
|
||||
|
|
|
@ -157,7 +157,6 @@ $("#userpl_save").click(function() {
|
|||
|
||||
/* playlist controls */
|
||||
|
||||
$(function() {
|
||||
$("#queue").sortable({
|
||||
start: function(ev, ui) {
|
||||
PL_FROM = ui.item.prevAll().length;
|
||||
|
@ -173,7 +172,6 @@ $(function() {
|
|||
}
|
||||
});
|
||||
$("#queue").disableSelection();
|
||||
});
|
||||
|
||||
function queue(pos) {
|
||||
var links = $("#mediaurl").val().split(",");
|
||||
|
@ -210,13 +208,13 @@ $("#qlockbtn").click(function() {
|
|||
|
||||
$("#getplaylist").click(function() {
|
||||
var callback = function(data) {
|
||||
PLAYER.hide();
|
||||
socket.listeners("playlist").splice(
|
||||
socket.listeners("playlist").indexOf(callback)
|
||||
);
|
||||
var list = [];
|
||||
for(var i = 0; i < data.pl.length; i++) {
|
||||
var entry = formatURL(data.pl[i]);
|
||||
// TODO formatURL in util.js
|
||||
for(var i = 0; i < data.length; i++) {
|
||||
var entry = formatURL(data[i]);
|
||||
list.push(entry);
|
||||
}
|
||||
var urls = list.join(",");
|
||||
|
@ -238,6 +236,7 @@ $("#getplaylist").click(function() {
|
|||
$("<div/>").addClass("modal-footer").appendTo(modal);
|
||||
modal.on("hidden", function() {
|
||||
modal.remove();
|
||||
PLAYER.unhide();
|
||||
});
|
||||
modal.modal();
|
||||
}
|
||||
|
@ -253,8 +252,8 @@ $("#clearplaylist").click(function() {
|
|||
});
|
||||
|
||||
$("#shuffleplaylist").click(function() {
|
||||
var clear = confirm("Are you sure you want to shuffle the playlist?");
|
||||
if(clear) {
|
||||
var shuffle = confirm("Are you sure you want to shuffle the playlist?");
|
||||
if(shuffle) {
|
||||
socket.emit("shufflePlaylist");
|
||||
}
|
||||
});
|
||||
|
|
|
@ -103,126 +103,73 @@ function getNameColor(rank) {
|
|||
return "";
|
||||
}
|
||||
|
||||
function addUserDropdown(entry, name) {
|
||||
// TODO change this
|
||||
entry.find(".dropdown").remove();
|
||||
entry.unbind();
|
||||
var div = $("<div />").addClass("dropdown").appendTo(entry);
|
||||
var ul = $("<ul />").addClass("dropdown-menu").appendTo(div);
|
||||
ul.attr("role", "menu");
|
||||
ul.attr("aria-labelledby", "dropdownMenu");
|
||||
function addUserDropdown(entry, name, aliases) {
|
||||
entry.find(".user-dropdown").remove();
|
||||
var menu = $("<div/>").addClass("user-dropdown")
|
||||
.appendTo(entry);
|
||||
menu.hide();
|
||||
|
||||
var ignore = $("<li />").appendTo(ul);
|
||||
var a = $("<a />").attr("tabindex", "-1").attr("href", "javascript:void(0);").appendTo(ignore);
|
||||
if(IGNORED.indexOf(name) != -1) {
|
||||
a.text("Unignore User");
|
||||
}
|
||||
else {
|
||||
a.text("Ignore User");
|
||||
}
|
||||
a.click(function() {
|
||||
if(IGNORED.indexOf(name) != -1) {
|
||||
IGNORED.splice(IGNORED.indexOf(name), 1);
|
||||
this.text("Ignore User");
|
||||
}
|
||||
else {
|
||||
IGNORED.push(name);
|
||||
this.text("Unignore User");
|
||||
}
|
||||
}.bind(a));
|
||||
|
||||
if(hasPermission("kick")) {
|
||||
var kick = $("<li />").appendTo(ul);
|
||||
var a = $("<a />").attr("tabindex", "-1").attr("href", "javascript:void(0);").appendTo(kick);
|
||||
a.text("Kick");
|
||||
a.click(function() {
|
||||
$("<strong/>").text(name).appendTo(menu);
|
||||
$("<br/>").appendTo(menu);
|
||||
$("<span/>").text("Aliases: " + aliases)
|
||||
.appendTo(menu);
|
||||
$("<button/>").addClass("btn btn-mini btn-block")
|
||||
.text("Kick")
|
||||
.click(function() {
|
||||
socket.emit("chatMsg", {
|
||||
msg: "/kick " + name
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if(CLIENT.rank >= Rank.Moderator) {
|
||||
$("<li />").addClass("divider").appendTo(ul);
|
||||
|
||||
var makeLeader = $("<li />").appendTo(ul);
|
||||
var a = $("<a />").attr("tabindex", "-1").attr("href", "javascript:void(0);").appendTo(makeLeader);
|
||||
a.text("Make Leader");
|
||||
a.click(function() {
|
||||
})
|
||||
.appendTo(menu);
|
||||
$("<button/>").addClass("btn btn-mini btn-block")
|
||||
.text("Give Leader")
|
||||
.click(function() {
|
||||
socket.emit("assignLeader", {
|
||||
name: name
|
||||
});
|
||||
});
|
||||
|
||||
var takeLeader = $("<li />").appendTo(ul);
|
||||
var a = $("<a />").attr("tabindex", "-1").attr("href", "javascript:void(0);").appendTo(takeLeader);
|
||||
a.text("Take Leader");
|
||||
a.click(function() {
|
||||
})
|
||||
.appendTo(menu);
|
||||
$("<button/>").addClass("btn btn-mini btn-block")
|
||||
.text("Take Leader")
|
||||
.click(function() {
|
||||
socket.emit("assignLeader", {
|
||||
name: ""
|
||||
});
|
||||
});
|
||||
|
||||
var ban = $("<li />").appendTo(ul);
|
||||
var a = $("<a />").attr("tabindex", "-1").attr("href", "javascript:void(0);").appendTo(ban);
|
||||
a.text("IP Ban");
|
||||
a.click(function() {
|
||||
})
|
||||
.appendTo(menu);
|
||||
$("<button/>").addClass("btn btn-mini btn-block")
|
||||
.text("Name Ban")
|
||||
.click(function() {
|
||||
socket.emit("chatMsg", {
|
||||
msg: "/ban " + name
|
||||
});
|
||||
})
|
||||
.appendTo(menu);
|
||||
$("<button/>").addClass("btn btn-mini btn-block")
|
||||
.text("IP Ban")
|
||||
.click(function() {
|
||||
socket.emit("chatMsg", {
|
||||
msg: "/ipban " + name
|
||||
});
|
||||
})
|
||||
.appendTo(menu);
|
||||
|
||||
var nameban = $("<li />").appendTo(ul);
|
||||
var a = $("<a />").attr("tabindex", "-1").attr("href", "javascript:void(0);").appendTo(nameban);
|
||||
a.text("Name Ban");
|
||||
a.click(function() {
|
||||
socket.emit("banName", {
|
||||
name: name
|
||||
});
|
||||
});
|
||||
|
||||
$("<li />").addClass("divider").appendTo(ul);
|
||||
|
||||
var promote = $("<li />").appendTo(ul);
|
||||
var a = $("<a />").attr("tabindex", "-1").attr("href", "javascript:void(0);").appendTo(promote);
|
||||
a.text("Promote");
|
||||
a.click(function() {
|
||||
socket.emit("promote", {
|
||||
name: name
|
||||
});
|
||||
});
|
||||
|
||||
var demote = $("<li />").appendTo(ul);
|
||||
var a = $("<a />").attr("tabindex", "-1").attr("href", "javascript:void(0);").appendTo(demote);
|
||||
a.text("Demote");
|
||||
a.click(function() {
|
||||
socket.emit("demote", {
|
||||
name: name
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
entry.click(function() {
|
||||
if(ul.css("display") == "none") {
|
||||
// Hide others
|
||||
$("#userlist ul.dropdown-menu").each(function() {
|
||||
if(this != ul) {
|
||||
$(this).css("display", "none");
|
||||
}
|
||||
});
|
||||
ul.css("display", "block");
|
||||
entry.contextmenu(function(ev) {
|
||||
ev.preventDefault();
|
||||
if(menu.css("display") == "none") {
|
||||
menu.show();
|
||||
}
|
||||
else {
|
||||
ul.css("display", "none");
|
||||
menu.hide();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
return ul;
|
||||
}
|
||||
|
||||
/* queue stuff */
|
||||
|
||||
function makeQueueEntry(video) {
|
||||
function makeQueueEntry(video, addbtns) {
|
||||
var li = $("<li/>");
|
||||
li.addClass("queue_entry");
|
||||
li.data("media", video);
|
||||
|
@ -243,8 +190,8 @@ function makeQueueEntry(video) {
|
|||
li.addClass("queue_temp");
|
||||
}
|
||||
|
||||
if(addbtns)
|
||||
addQueueButtons(li);
|
||||
|
||||
return li;
|
||||
}
|
||||
|
||||
|
@ -268,8 +215,9 @@ function addQueueButtons(li) {
|
|||
.click(function() {
|
||||
var i = $("#queue").children().index(li);
|
||||
socket.emit("moveMedia", {
|
||||
src: i,
|
||||
dest: i < POSITION ? POSITION : POSITION + 1
|
||||
from: i,
|
||||
to: i < POSITION ? POSITION : POSITION + 1,
|
||||
moveby: null
|
||||
});
|
||||
})
|
||||
.appendTo(menu);
|
||||
|
@ -344,6 +292,7 @@ function showOptionsMenu() {
|
|||
var themeselect = $("<select/>");
|
||||
$("<option/>").attr("value", "default").text("Default").appendTo(themeselect);
|
||||
$("<option/>").attr("value", "assets/css/darkstrap.css").text("Dark").appendTo(themeselect);
|
||||
$("<option/>").attr("value", "assets/css/semidark.css").text("Semidark").appendTo(themeselect);
|
||||
themeselect.val(USEROPTS.theme);
|
||||
addOption("Theme", themeselect);
|
||||
|
||||
|
@ -421,7 +370,7 @@ function showOptionsMenu() {
|
|||
.text("Profile has moved to the account page");
|
||||
addOption("Profile", profile);
|
||||
|
||||
if(RANK >= Rank.Moderator) {
|
||||
if(CLIENT.rank >= Rank.Moderator) {
|
||||
$("<hr>").appendTo(form);
|
||||
var modhatcontainer = $("<label/>").addClass("checkbox")
|
||||
.text("Show name color");
|
||||
|
@ -446,7 +395,7 @@ function showOptionsMenu() {
|
|||
USEROPTS.blink_title = blink.prop("checked");
|
||||
USEROPTS.chatbtn = sendbtn.prop("checked");
|
||||
USEROPTS.altsocket = altsocket.prop("checked");
|
||||
if(RANK >= Rank.Moderator) {
|
||||
if(CLIENT.rank >= Rank.Moderator) {
|
||||
USEROPTS.modhat = modhat.prop("checked");
|
||||
}
|
||||
saveOpts();
|
||||
|
@ -543,6 +492,8 @@ function applyOpts() {
|
|||
}
|
||||
}
|
||||
|
||||
applyOpts();
|
||||
|
||||
function showLoginMenu() {
|
||||
PLAYER.hide();
|
||||
var modal = $("<div/>").addClass("modal hide fade")
|
||||
|
@ -678,8 +629,7 @@ function showPollMenu() {
|
|||
}
|
||||
|
||||
function scrollChat() {
|
||||
// TODO add check
|
||||
$("#messagebuffer").scrollTop($("#messagebuffer").prop("scrollheight"));
|
||||
$("#messagebuffer").scrollTop($("#messagebuffer").prop("scrollHeight"));
|
||||
}
|
||||
|
||||
function hasPermission(key) {
|
||||
|
@ -713,6 +663,15 @@ function handlePermissionChange() {
|
|||
$("#queue_next").attr("disabled", !hasPermission("playlistnext"));
|
||||
setVisible("#qlockbtn", CLIENT.rank >= 2);
|
||||
|
||||
if(hasPermission("playlistmove")) {
|
||||
$("#queue").sortable("enable");
|
||||
$("#queue").addClass("queue_sortable");
|
||||
}
|
||||
else {
|
||||
$("#queue").sortable("disable");
|
||||
$("#queue").removeClass("queue_sortable");
|
||||
}
|
||||
|
||||
setVisible("#getplaylist", hasPermission("playlistgeturl"));
|
||||
setVisible("#clearplaylist", hasPermission("playlistclear"));
|
||||
setVisible("#shuffleplaylist", hasPermission("playlistshuffle"));
|
||||
|
@ -764,7 +723,7 @@ function loadSearchPage(page) {
|
|||
var results = $("#library").data("entries");
|
||||
var start = page * 100;
|
||||
for(var i = start; i < start + 100 && i < results.length; i++) {
|
||||
var li = makeQueueEntry(results[i]);
|
||||
var li = makeQueueEntry(results[i], false);
|
||||
if(hasPermission("playlistadd")) {
|
||||
if(results[i].thumb) {
|
||||
addLibraryButtons(li, results[i].id, "yt");
|
||||
|
@ -785,6 +744,7 @@ function loadSearchPage(page) {
|
|||
|
||||
function addLibraryButtons(li, id, type) {
|
||||
var btns = $("<div/>").addClass("btn-group")
|
||||
.addClass("pull-left")
|
||||
.prependTo(li);
|
||||
|
||||
if(hasPermission("playlistadd")) {
|
||||
|
@ -811,6 +771,19 @@ function addLibraryButtons(li, id, type) {
|
|||
})
|
||||
.appendTo(btns);
|
||||
}
|
||||
if(CLIENT.rank >= 2) {
|
||||
$("<button/>").addClass("btn btn-mini btn-danger")
|
||||
.html("<i class='icon-trash'></i>")
|
||||
.click(function() {
|
||||
socket.emit("uncache", {
|
||||
id: id
|
||||
});
|
||||
li.hide("blind", function() {
|
||||
li.remove();
|
||||
});
|
||||
})
|
||||
.appendTo(btns);
|
||||
}
|
||||
}
|
||||
|
||||
/* queue stuff */
|
||||
|
@ -824,7 +797,7 @@ function playlistMove(from, to) {
|
|||
|
||||
var old = $(q.children()[from]);
|
||||
old.hide("blind", function() {
|
||||
old.remove();
|
||||
old.detach();
|
||||
if(to >= q.children().length)
|
||||
old.appendTo(q);
|
||||
else
|
||||
|
@ -935,8 +908,60 @@ function parseMediaLink(url) {
|
|||
}
|
||||
}
|
||||
|
||||
function sendVideoUpdate() {
|
||||
PLAYER.getTime(function(seconds) {
|
||||
socket.emit("mediaUpdate", {
|
||||
id: PLAYER.id,
|
||||
currentTime: seconds,
|
||||
paused: PLAYER.paused,
|
||||
type: PLAYER.type
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/* chat */
|
||||
|
||||
function formatChatMessage(data) {
|
||||
var skip = data.username == LASTCHATNAME;
|
||||
if(data.msgclass == "drink" || data.msgclass == "shout") {
|
||||
skip = false;
|
||||
}
|
||||
LASTCHATNAME = data.username;
|
||||
LASTCHATTIME = data.time;
|
||||
var div = $("<div/>");
|
||||
if(USEROPTS.show_timestamps) {
|
||||
var time = $("<span/>").addClass("timestamp").appendTo(div);
|
||||
var timestamp = new Date(data.time).toTimeString().split(" ")[0];
|
||||
time.text("["+timestamp+"] ");
|
||||
}
|
||||
var name = $("<span/>");
|
||||
if(!skip) {
|
||||
name.appendTo(div);
|
||||
}
|
||||
$("<strong/>").addClass("username").text(data.username + ": ").appendTo(name);
|
||||
var message = $("<span/>").appendTo(div);
|
||||
message[0].innerHTML = data.msg;
|
||||
if(data.modflair) {
|
||||
name.addClass(getNameColor(data.modflair));
|
||||
}
|
||||
if(data.msgclass == "action") {
|
||||
name.remove();
|
||||
message.addClass("action");
|
||||
message[0].innerHTML = data.username + " " + data.msg;
|
||||
}
|
||||
else if(data.msgclass == "drink") {
|
||||
div.addClass("drink");
|
||||
}
|
||||
else if(data.msgclass == "shout") {
|
||||
message.addClass("shout");
|
||||
name.addClass("shout");
|
||||
}
|
||||
else {
|
||||
message.addClass(data.msgclass);
|
||||
}
|
||||
return div;
|
||||
}
|
||||
|
||||
function addChatMessage(data) {
|
||||
if(IGNORED.indexOf(data.username) != -1) {
|
||||
return;
|
||||
|
@ -985,3 +1010,26 @@ function addChatMessage(data) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* layouts */
|
||||
|
||||
function fluidLayout() {
|
||||
$(".row").each(function() {
|
||||
$(this).removeClass("row").addClass("row-fluid");
|
||||
});
|
||||
$(".container").each(function() {
|
||||
$(this).removeClass("container").addClass("container-fluid");
|
||||
});
|
||||
VWIDTH = $("#ytapiplayer").parent().css("width").replace("px", "");
|
||||
VHEIGHT = ""+parseInt(parseInt(VWIDTH) * 9 / 16);
|
||||
$("#messagebuffer").css("height", (VHEIGHT - 31) + "px");
|
||||
$("#userlist").css("height", (VHEIGHT - 31) + "px");
|
||||
$("#ytapiplayer").attr("width", VWIDTH);
|
||||
$("#ytapiplayer").attr("height", VHEIGHT);
|
||||
$("#chatline").removeClass().addClass("span12");
|
||||
}
|
||||
|
||||
function synchtubeLayout() {
|
||||
$("#videowrap").detach().insertBefore($("#chatwrap"));
|
||||
$("#rightpane-outer").detach().insertBefore($("#leftpane-outer"));
|
||||
}
|
||||
|
|
|
@ -88,10 +88,10 @@
|
|||
<!-- left pane - Library + user playlists -->
|
||||
<div class="span5" id="leftpane-outer">
|
||||
<div class="row-fluid" id="leftpane-inner">
|
||||
<button class="btn btn-primary btn-small" id="newpollbtn">New Poll</button>
|
||||
<!-- poll container -->
|
||||
<div class="span12" id="pollwrap">
|
||||
<!-- new poll controls -->
|
||||
<button class="btn btn-primary btn-small" id="newpollbtn">New Poll</button>
|
||||
</div>
|
||||
<!-- library search -->
|
||||
<div class="span12 pointer" id="librarytoggle">
|
||||
|
@ -106,6 +106,8 @@
|
|||
<button class="btn" id="library_search">Library</button>
|
||||
<button class="btn" id="youtube_search">YouTube</button>
|
||||
</div>
|
||||
<ul class="span12 videolist" id="library">
|
||||
</ul>
|
||||
</div>
|
||||
<!-- user playlists -->
|
||||
<div class="span12 pointer" id="userpltoggle">
|
||||
|
@ -182,12 +184,6 @@
|
|||
<script src="./assets/js/ui.js"></script>
|
||||
<script src="./assets/js/callbacks.js"></script>
|
||||
<script src="./assets/js/notwebsocket.js"></script>
|
||||
<!--
|
||||
<script src="./assets/js/iourl.js"></script>
|
||||
<script src="./assets/js/functions.js"></script>
|
||||
<script src="./assets/js/client.js"></script>
|
||||
<script src="./assets/js/callbacks.js"></script>
|
||||
-->
|
||||
<!-- APIs -->
|
||||
<script src="http://api.dmcdn.net/all.js"></script>
|
||||
<script src="http://jwpsrv.com/library/QouFCLBMEeKC+CIACpYGxA.js"></script>
|
||||
|
|
Loading…
Reference in New Issue