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}}, |       {$match:{now_playing:false}}, | ||||||
|       {$sort:{votes:-1, added:1}}, |       {$sort:{votes:-1, added:1}}, | ||||||
|       {$limit:1}], function(err, docs){ |       {$limit:1}], function(err, docs){ | ||||||
|         db.collection(coll).update({id:docs[0]["id"]}, |         if(docs.length > 0){ | ||||||
|         {$set:{ |           db.collection(coll).update({id:docs[0]["id"]}, | ||||||
|           now_playing:true, |           {$set:{ | ||||||
|           votes:0, |             now_playing:true, | ||||||
|           guids:[], |             votes:0, | ||||||
|           added:get_time()}}, function(err, docs){ |             guids:[], | ||||||
|             db.collection(coll).update({views:{$exists:true}}, |             added:get_time()}}, function(err, docs){ | ||||||
|               {$set:{startTime:get_time()}}, function(err, docs){ |               db.collection(coll).update({views:{$exists:true}}, | ||||||
|                 sort_list(coll,undefined,true); |                 {$set:{startTime:get_time()}}, function(err, docs){ | ||||||
|             }); |                   sort_list(coll,undefined,true); | ||||||
|  |               }); | ||||||
|  |  | ||||||
|     }); |             }); | ||||||
|  |         } | ||||||
|   }); |   }); | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -82,7 +82,7 @@ function populate_list(msg) | |||||||
| 				{ | 				{ | ||||||
| 					player_name = "#jplayer"; | 					player_name = "#jplayer"; | ||||||
| 				}else player_name = "#player"; | 				}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"}); | 				$("#playlist").css({overflow: "hidden"}); | ||||||
| 				if(scroller === false) | 				if(scroller === false) | ||||||
| 				{ | 				{ | ||||||
|   | |||||||
| @@ -34,7 +34,6 @@ function populate_channels(lists) | |||||||
|         card.find(".chan-songs").text(song_count); |         card.find(".chan-songs").text(song_count); | ||||||
|         card.find(".chan-bg").attr("style", img); |         card.find(".chan-bg").attr("style", img); | ||||||
|         card.find(".chan-link").attr("href", chan); |         card.find(".chan-link").attr("href", chan); | ||||||
|  |  | ||||||
|         output+="<option value='"+chan+"'> "; |         output+="<option value='"+chan+"'> "; | ||||||
|     } |     } | ||||||
|     document.getElementById("searches").innerHTML = output; |     document.getElementById("searches").innerHTML = output; | ||||||
|   | |||||||
| @@ -51,11 +51,17 @@ socket.on(chan.toLowerCase()+",np", function(obj) | |||||||
| 	seekTo = time - conf["startTime"]; | 	seekTo = time - conf["startTime"]; | ||||||
| 	song_title = obj[0][0]["title"]; | 	song_title = obj[0][0]["title"]; | ||||||
| 	getTitle(song_title, viewers); | 	getTitle(song_title, viewers); | ||||||
| 	if(player_ready) | 	if(player_ready && !window.mobilecheck()) | ||||||
| 	{ | 	{ | ||||||
| 		if(ytplayer.getVideoUrl().split('v=')[1] != video_id) | 		if(ytplayer.getVideoUrl().split('v=')[1] != video_id) | ||||||
|  | 		{ | ||||||
| 			ytplayer.loadVideoById(video_id); | 			ytplayer.loadVideoById(video_id); | ||||||
| 		ytplayer.playVideo(); | 			notifyUser(video_id, song_title); | ||||||
|  | 			if(paused) | ||||||
|  | 				ytplayer.pauseVideo(); | ||||||
|  | 		} | ||||||
|  | 		if(!paused) | ||||||
|  | 			ytplayer.playVideo(); | ||||||
| 		ytplayer.seekTo(seekTo); | 		ytplayer.seekTo(seekTo); | ||||||
| 	} | 	} | ||||||
| }); | }); | ||||||
| @@ -139,14 +145,15 @@ function onPlayerStateChange(newState) { | |||||||
| 		case 0: | 		case 0: | ||||||
| 			socket.emit("end", video_id); | 			socket.emit("end", video_id); | ||||||
| 			playing = false; | 			playing = false; | ||||||
|  | 			paused = false; | ||||||
| 			break; | 			break; | ||||||
| 		case 1: | 		case 1: | ||||||
| 			playing = true; | 			playing = true; | ||||||
| 			if(document.getElementById("playpause").className == "play") | 			/*if(document.getElementById("playpause").className == "play") | ||||||
| 			{ | 			{ | ||||||
| 				$("#playpause").toggleClass("play"); | 				$("#playpause").toggleClass("play"); | ||||||
| 				$("#playpause").toggleClass("pause"); | 				$("#playpause").toggleClass("pause"); | ||||||
| 			} | 			}*/ | ||||||
| 			if(paused) | 			if(paused) | ||||||
| 			{ | 			{ | ||||||
| 				socket.emit('pos'); | 				socket.emit('pos'); | ||||||
| @@ -155,11 +162,11 @@ function onPlayerStateChange(newState) { | |||||||
| 			break; | 			break; | ||||||
| 		case 2: | 		case 2: | ||||||
| 			paused = true; | 			paused = true; | ||||||
| 			if(document.getElementById("playpause").className == "pause") | 			/*if(document.getElementById("playpause").className == "pause") | ||||||
| 			{ | 			{ | ||||||
| 				$("#playpause").toggleClass("play"); | 				$("#playpause").toggleClass("play"); | ||||||
| 				$("#playpause").toggleClass("pause"); | 				$("#playpause").toggleClass("pause"); | ||||||
| 			} | 			}*/ | ||||||
| 			break; | 			break; | ||||||
| 		case 3: | 		case 3: | ||||||
| 			break; | 			break; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user