Resolve merge conflict

This commit is contained in:
calzoneman 2013-08-08 18:28:10 -04:00
commit 4f6d72d6d5
6 changed files with 36 additions and 19 deletions

View File

@ -1161,6 +1161,7 @@ Channel.prototype.addMedia = function(data, user) {
return; return;
} }
data.temp = isLive(data.type) || !this.hasPermission(user, "addnontemp"); data.temp = isLive(data.type) || !this.hasPermission(user, "addnontemp");
data.queueby = user ? user.name : "";
data.maxlength = this.hasPermission(user, "exceedmaxlength") ? 0 : this.opts.maxlength; data.maxlength = this.hasPermission(user, "exceedmaxlength") ? 0 : this.opts.maxlength;
var chan = this; var chan = this;
if(data.id in this.library) { if(data.id in this.library) {
@ -1195,9 +1196,6 @@ Channel.prototype.addMedia = function(data, user) {
return; return;
} }
data.temp = isLive(data.type) || !this.hasPermission(user, "addnontemp");
data.queueby = user ? user.name : "";
this.playlist.addMedia(data, function(err, item) { this.playlist.addMedia(data, function(err, item) {
if(err) { if(err) {
if(err === true) if(err === true)
@ -1213,7 +1211,8 @@ Channel.prototype.addMedia = function(data, user) {
after: item.prev ? item.prev.uid : "prepend" after: item.prev ? item.prev.uid : "prepend"
}); });
chan.broadcastPlaylistMeta(); chan.broadcastPlaylistMeta();
chan.cacheMedia(item.media); if(!item.temp)
chan.cacheMedia(item.media);
} }
}); });
} }
@ -1237,7 +1236,8 @@ Channel.prototype.addMediaList = function(data, user) {
after: item.prev ? item.prev.uid : "prepend" after: item.prev ? item.prev.uid : "prepend"
}); });
chan.broadcastPlaylistMeta(); chan.broadcastPlaylistMeta();
chan.cacheMedia(item.media); if(!item.temp)
chan.cacheMedia(item.media);
} }
}); });
} }

View File

@ -2,7 +2,7 @@
"author": "Calvin Montgomery", "author": "Calvin Montgomery",
"name": "CyTube", "name": "CyTube",
"description": "Online media synchronizer and chat", "description": "Online media synchronizer and chat",
"version": "2.3.0", "version": "2.3.1",
"repository": { "repository": {
"url": "http://github.com/calzoneman/sync" "url": "http://github.com/calzoneman/sync"
}, },

View File

@ -6,7 +6,7 @@ var Logger = require("./logger");
var Channel = require("./channel"); var Channel = require("./channel");
var User = require("./user"); var User = require("./user");
const VERSION = "2.3.0"; const VERSION = "2.3.1";
function getIP(req) { function getIP(req) {
var raw = req.connection.remoteAddress; var raw = req.connection.remoteAddress;

View File

@ -1,4 +1,5 @@
/* /*
return null;
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2013 Calvin Montgomery Copyright (c) 2013 Calvin Montgomery
@ -485,7 +486,7 @@ Callbacks = {
setChannelRank: function(data) { setChannelRank: function(data) {
var ents = $("#channelranks").data("entries"); var ents = $("#channelranks").data("entries");
if(typeof ents === undefined) if(typeof ents === "undefined")
return; return;
for(var i = 0; i < ents.length; i++) { for(var i = 0; i < ents.length; i++) {
if(ents[i].name == data.user) { if(ents[i].name == data.user) {
@ -621,7 +622,7 @@ Callbacks = {
addUser: function(data) { addUser: function(data) {
var div = $("<div/>") var div = $("<div/>")
.addClass("userlist_item userlist-" + data.name); .addClass("userlist_item");
var flair = $("<span/>").appendTo(div); var flair = $("<span/>").appendTo(div);
var nametag = $("<span/>").text(data.name).appendTo(div); var nametag = $("<span/>").text(data.name).appendTo(div);
formatUserlistItem(div, data); formatUserlistItem(div, data);
@ -658,15 +659,19 @@ Callbacks = {
} }
} }
var user = $(".userlist-" + data.name); var user = findUserlistItem(data.name);
formatUserlistItem(user, data); if(user !== null) {
addUserDropdown(user, data); formatUserlistItem(user, data);
if(USEROPTS.sort_rank) addUserDropdown(user, data);
sortUserlist(); if(USEROPTS.sort_rank)
sortUserlist();
}
}, },
setAFK: function (data) { setAFK: function (data) {
var user = $(".userlist-" + data.name); var user = findUserlistItem(data.name);
if(user === null)
return;
user.find(".icon-time").remove(); user.find(".icon-time").remove();
$(user[0].children[1]).css("font-style", ""); $(user[0].children[1]).css("font-style", "");
if(data.afk) { if(data.afk) {
@ -679,7 +684,9 @@ Callbacks = {
}, },
userLeave: function(data) { userLeave: function(data) {
$(".userlist-" + data.name).remove(); var user = findUserlistItem(data.name);
if(user !== null)
user.remove();
}, },
drinkCount: function(count) { drinkCount: function(count) {

View File

@ -346,7 +346,7 @@ $("#customembed_btn").click(function () {
$("#getplaylist").click(function() { $("#getplaylist").click(function() {
var callback = function(data) { var callback = function(data) {
PLAYER.hide(); hidePlayer();
socket.listeners("playlist").splice( socket.listeners("playlist").splice(
socket.listeners("playlist").indexOf(callback) socket.listeners("playlist").indexOf(callback)
); );
@ -374,7 +374,7 @@ $("#getplaylist").click(function() {
$("<div/>").addClass("modal-footer").appendTo(modal); $("<div/>").addClass("modal-footer").appendTo(modal);
modal.on("hidden", function() { modal.on("hidden", function() {
modal.remove(); modal.remove();
PLAYER.unhide(); unhidePlayer();
}); });
modal.modal(); modal.modal();
} }

View File

@ -58,6 +58,16 @@ function formatURL(data) {
} }
} }
function findUserlistItem(name) {
var children = $("#userlist .userlist_item");
for(var i in children) {
var child = children[i];
if(child.children[1].innerHTML === name)
return $(child);
}
return null;
}
function formatUserlistItem(div, data) { function formatUserlistItem(div, data) {
var name = $(div.children()[1]); var name = $(div.children()[1]);
name.removeClass(); name.removeClass();
@ -152,7 +162,7 @@ function addUserDropdown(entry, data) {
.appendTo(sel); .appendTo(sel);
} }
} }
sel.click(function () { sel.change(function () {
socket.emit("setChannelRank", { socket.emit("setChannelRank", {
user: name, user: name,
rank: parseInt(sel.val()) rank: parseInt(sel.val())