mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Fixed some minor playpause bugs on change song, and reimplemented desktop notifications. Also fixed height on playlist
This commit is contained in:
@@ -327,18 +327,20 @@ function change_song_post(coll)
|
||||
{$match:{now_playing:false}},
|
||||
{$sort:{votes:-1, added:1}},
|
||||
{$limit:1}], function(err, docs){
|
||||
db.collection(coll).update({id:docs[0]["id"]},
|
||||
{$set:{
|
||||
now_playing:true,
|
||||
votes:0,
|
||||
guids:[],
|
||||
added:get_time()}}, function(err, docs){
|
||||
db.collection(coll).update({views:{$exists:true}},
|
||||
{$set:{startTime:get_time()}}, function(err, docs){
|
||||
sort_list(coll,undefined,true);
|
||||
});
|
||||
if(docs.length > 0){
|
||||
db.collection(coll).update({id:docs[0]["id"]},
|
||||
{$set:{
|
||||
now_playing:true,
|
||||
votes:0,
|
||||
guids:[],
|
||||
added:get_time()}}, function(err, docs){
|
||||
db.collection(coll).update({views:{$exists:true}},
|
||||
{$set:{startTime:get_time()}}, function(err, docs){
|
||||
sort_list(coll,undefined,true);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ function populate_list(msg)
|
||||
{
|
||||
player_name = "#jplayer";
|
||||
}else player_name = "#player";
|
||||
$("#playlist").css({height: $(player_name).height()-$("#adminPanel").outerHeight(true)-$("#findform").outerHeight(true)+30});
|
||||
$("#playlist").css({height: $(".video-container").height()});
|
||||
$("#playlist").css({overflow: "hidden"});
|
||||
if(scroller === false)
|
||||
{
|
||||
|
||||
@@ -34,7 +34,6 @@ function populate_channels(lists)
|
||||
card.find(".chan-songs").text(song_count);
|
||||
card.find(".chan-bg").attr("style", img);
|
||||
card.find(".chan-link").attr("href", chan);
|
||||
|
||||
output+="<option value='"+chan+"'> ";
|
||||
}
|
||||
document.getElementById("searches").innerHTML = output;
|
||||
|
||||
@@ -51,11 +51,17 @@ socket.on(chan.toLowerCase()+",np", function(obj)
|
||||
seekTo = time - conf["startTime"];
|
||||
song_title = obj[0][0]["title"];
|
||||
getTitle(song_title, viewers);
|
||||
if(player_ready)
|
||||
if(player_ready && !window.mobilecheck())
|
||||
{
|
||||
if(ytplayer.getVideoUrl().split('v=')[1] != video_id)
|
||||
{
|
||||
ytplayer.loadVideoById(video_id);
|
||||
ytplayer.playVideo();
|
||||
notifyUser(video_id, song_title);
|
||||
if(paused)
|
||||
ytplayer.pauseVideo();
|
||||
}
|
||||
if(!paused)
|
||||
ytplayer.playVideo();
|
||||
ytplayer.seekTo(seekTo);
|
||||
}
|
||||
});
|
||||
@@ -139,14 +145,15 @@ function onPlayerStateChange(newState) {
|
||||
case 0:
|
||||
socket.emit("end", video_id);
|
||||
playing = false;
|
||||
paused = false;
|
||||
break;
|
||||
case 1:
|
||||
playing = true;
|
||||
if(document.getElementById("playpause").className == "play")
|
||||
/*if(document.getElementById("playpause").className == "play")
|
||||
{
|
||||
$("#playpause").toggleClass("play");
|
||||
$("#playpause").toggleClass("pause");
|
||||
}
|
||||
}*/
|
||||
if(paused)
|
||||
{
|
||||
socket.emit('pos');
|
||||
@@ -155,11 +162,11 @@ function onPlayerStateChange(newState) {
|
||||
break;
|
||||
case 2:
|
||||
paused = true;
|
||||
if(document.getElementById("playpause").className == "pause")
|
||||
/*if(document.getElementById("playpause").className == "pause")
|
||||
{
|
||||
$("#playpause").toggleClass("play");
|
||||
$("#playpause").toggleClass("pause");
|
||||
}
|
||||
}*/
|
||||
break;
|
||||
case 3:
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user