Merge branch 'dev' of github.com:nixolas1/Zoff into dev

Conflicts:
	static/js/search.js
This commit is contained in:
Nicolas A. Tonne
2015-04-29 00:27:29 +02:00
4 changed files with 31 additions and 13 deletions

View File

@@ -138,7 +138,7 @@ io.on('connection', function(socket){
}else }else
{ {
console.log(np[0]["title"] + " before if"); console.log(np[0]["title"] + " before if");
if(startTime+np[0]["duration"]<=get_time()+2) if(startTime+parseInt(np[0]["duration"])<=get_time()+2)
{ {
console.log(np[0]["title"] + " after if"); console.log(np[0]["title"] + " after if");
db.collection(coll).update({now_playing:true, id:id}, db.collection(coll).update({now_playing:true, id:id},
@@ -197,7 +197,7 @@ io.on('connection', function(socket){
var id = arr[0]; var id = arr[0];
var title = arr[1]; var title = arr[1];
var hash = hash_pass(arr[2]); var hash = hash_pass(arr[2]);
var duration = arr[3]; var duration = parseInt(arr[3]);
db.collection(coll).find({views:{$exists:true}}, function(err, docs) db.collection(coll).find({views:{$exists:true}}, function(err, docs)
{ {
if((docs[0]["addsongs"] == true && (hash == docs[0]["adminpass"] || docs[0]["adminpass"] == "")) || docs[0]["addsongs"] == false) if((docs[0]["addsongs"] == true && (hash == docs[0]["adminpass"] || docs[0]["adminpass"] == "")) || docs[0]["addsongs"] == false)
@@ -214,7 +214,6 @@ io.on('connection', function(socket){
np = false; np = false;
db.collection(coll).insert({"added":get_time(),"guids":guids,"id":id,"now_playing":np,"title":title,"votes":votes, "duration":duration}, function(err, docs){ db.collection(coll).insert({"added":get_time(),"guids":guids,"id":id,"now_playing":np,"title":title,"votes":votes, "duration":duration}, function(err, docs){
sort_list(coll, undefined, np, true); sort_list(coll, undefined, np, true);
socket.emit("toast", "addedsong");
}); });
}); });
}else{ }else{

View File

@@ -28,7 +28,7 @@ socket.on("skipping", function(obj)
function populate_list(msg, conf_only) function populate_list(msg, conf_only)
{ {
console.log(msg); //console.log(msg);
console.log(conf_only); console.log(conf_only);
if(!conf_only) if(!conf_only)
$("#wrapper").empty(); $("#wrapper").empty();

View File

@@ -21,10 +21,22 @@ $(document).ready(function()
} }
}); });
$("body").keyup(function(event) {
if(event.keyCode == 27){
$("#results").html("");
$(".main").removeClass("blurT");
$("#controls").removeClass("blurT");
$(".main").removeClass("clickthrough");
if(!contains($("#search-wrapper").attr("class").split(" "), "hide"))
$("#search-wrapper").toggleClass("hide");
if(contains($("#song-title").attr("class").split(" "), "hide"))
$("#song-title").toggleClass("hide");
}
});
$(".search_input").focus(); $(".search_input").focus();
$(".search_input").keyup(function(event) { $(".search_input").keyup(function(event) {
search_input = $(this).val(); search_input = $(this).val();
console.log(search_input);
if(event.keyCode == 13 && search_input == "fireplace") if(event.keyCode == 13 && search_input == "fireplace")
{ {
if(!peis) if(!peis)
@@ -45,12 +57,6 @@ $(document).ready(function()
if(search_input.length < 3){$("#results").html("");} if(search_input.length < 3){$("#results").html("");}
if(event.keyCode == 13){ if(event.keyCode == 13){
search(search_input); search(search_input);
}else if(event.keyCode == 27){
$("#results").html("");
$(".main").removeClass("blurT");
$("#controls").removeClass("blurT");
$(".main").removeClass("clickthrough");
showSearch();
}else{ }else{
i = 0; i = 0;
timer=100; timer=100;
@@ -250,3 +256,14 @@ function durationToSeconds(duration) {
seconds= parseInt(matches[16])||0 seconds= parseInt(matches[16])||0
return hours*60*60+minutes*60+seconds; return hours*60*60+minutes*60+seconds;
} }
function contains(a, obj) {
var i = a.length;
while (i--) {
if (a[i] === obj) {
return true;
}
}
return false;
}

View File

@@ -224,6 +224,8 @@ function errorHandler(newState)
{ {
if(video_id !== undefined) if(video_id !== undefined)
{ {
console.log(video_id);
console.log(ytplayer.getVideoUrl());
console.log("errorskip"); console.log("errorskip");
socket.emit("skip"); socket.emit("skip");
} }