mirror of
				https://github.com/KevinMidboe/zoff.git
				synced 2025-10-29 18:00:23 +00:00 
			
		
		
		
	Trying out not skipping for the first 20 seconds of the video
This commit is contained in:
		@@ -304,11 +304,14 @@ io.on('connection', function(socket){
 | 
			
		||||
  	db.collection(coll).find({skip: false}, function(err, docs){
 | 
			
		||||
  		if(docs.length == 1)
 | 
			
		||||
  		{
 | 
			
		||||
  			if(lists[coll].length/2 <= docs[0]["skips"].length+1 && !contains(docs[0]["skips"], guid))
 | 
			
		||||
  			if(lists[coll].length/2 <= docs[0]["skips"].length+1 && !contains(docs[0]["skips"], guid) && get_time() - docs[0]["startTime"] >= 20)
 | 
			
		||||
  			{
 | 
			
		||||
  				change_song(coll);
 | 
			
		||||
          socket.emit("toast", "skip");
 | 
			
		||||
  			}else if(!contains(docs[0]["skips"], guid)){
 | 
			
		||||
  			}else if(get_time() - docs[0]["startTime"] < 20)
 | 
			
		||||
        {
 | 
			
		||||
          socket.emit("toast", "notyetskip");
 | 
			
		||||
        }else if(!contains(docs[0]["skips"], guid) && get_time() - docs[0]["startTime"] >= 30){
 | 
			
		||||
  				db.collection(coll).update({views:{$exists:true}}, {$push:{skips:guid}}, function(err, d){
 | 
			
		||||
            socket.emit("toast", (Math.ceil(lists[coll].length/2) - docs[0]["skips"].length-1) + " more are needed to skip!");
 | 
			
		||||
  				});
 | 
			
		||||
 
 | 
			
		||||
@@ -39,6 +39,9 @@ socket.on("toast", function(msg)
 | 
			
		||||
		case "alreadyskip":
 | 
			
		||||
			msg=rnd(["Skipping is democratic, only one vote per person!", "More people have to vote to skip, not just you!", "Get someone else to skip too! You can't do it on yourself."])
 | 
			
		||||
			break;
 | 
			
		||||
		case "notyetskip":
 | 
			
		||||
			msg="Skipping is disabled the first 30 seconds of the video.";
 | 
			
		||||
			break;
 | 
			
		||||
	}
 | 
			
		||||
	Materialize.toast(msg, 4000);
 | 
			
		||||
});
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user