From c905106ff41f39409a8538349d9f7eb1fbf30c8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Rynning-T=C3=B8nnesen?= Date: Wed, 6 May 2015 14:14:20 +0200 Subject: [PATCH 1/2] Fixed some skipping bugs --- server/server.js | 17 +++++++++++++---- static/js/youtube.js | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/server/server.js b/server/server.js index dd269ac6..46f223e4 100755 --- a/server/server.js +++ b/server/server.js @@ -309,11 +309,19 @@ io.on('connection', function(socket){ io.sockets.emit(coll+",viewers", lists[coll].length); } - adminpass = list[2]; + adminpass = ""; + + var error = false; + if(list != "5" && list != "100" && list != "101" && list != "150" && list !== undefined) + { + adminpass = list[2]; + }else if(list == "5" || list == "100" || list == "101" || list == "150"){ + error = true; + } console.log(adminpass); - if(adminpass !== undefined && adminpass !== null) + if(adminpass !== undefined && adminpass !== null && adminpass != "") var hash = hash_pass(adminpass); else var hash = ""; @@ -321,14 +329,15 @@ io.on('connection', function(socket){ db.collection(coll).find({views: {$exists:true}}, function(err, docs){ console.log(adminpass); console.log(docs[0]["adminpass"]); - if(!docs[0]["skip"] || (docs[0]["adminpass"] == hash && docs[0]["adminpass"] != "")) + console.log(error); + if(!docs[0]["skip"] || (docs[0]["adminpass"] == hash && docs[0]["adminpass"] != "") || error) { if((lists[coll].length/2 <= docs[0]["skips"].length+1 && !contains(docs[0]["skips"], guid) && (get_time() - docs[0]["startTime"] >= 10 || lists[coll].length != 2)) || (docs[0]["adminpass"] == adminpass && docs[0]["adminpass"] != "")) { change_song(coll); socket.emit("toast", "skip"); - }else if(get_time() - docs[0]["startTime"] < 10 && lists[coll].length == 2) + }else if(get_time() - docs[0]["startTime"] < 10 && lists[coll].length == 2 && !error) { socket.emit("toast", "notyetskip"); }else if(!contains(docs[0]["skips"], guid) && get_time() - docs[0]["startTime"] >= 30){ diff --git a/static/js/youtube.js b/static/js/youtube.js index 7d22f407..b76e96b4 100755 --- a/static/js/youtube.js +++ b/static/js/youtube.js @@ -203,7 +203,7 @@ function errorHandler(newState) var failsafe = ytplayer.getVideoUrl().split("https://www.youtube.com/watch"); if(newState.data == 5 || newState.data == 100 || newState.data == 101 || newState.data == 150) { - socket.emit("skip"); + socket.emit("skip", newState.data); } } From d27d9c953e7b9cf1ddcddfa1939a16221dc750f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Rynning-T=C3=B8nnesen?= Date: Wed, 6 May 2015 14:18:33 +0200 Subject: [PATCH 2/2] preloader shit is cool --- php/nochan.php | 3 +++ static/js/nochan.js | 1 + 2 files changed, 4 insertions(+) diff --git a/php/nochan.php b/php/nochan.php index d192962e..9c134994 100755 --- a/php/nochan.php +++ b/php/nochan.php @@ -81,6 +81,9 @@ if(isset($_GET['chan'])){
+
+
+
  • diff --git a/static/js/nochan.js b/static/js/nochan.js index d9e8a740..7144a130 100755 --- a/static/js/nochan.js +++ b/static/js/nochan.js @@ -48,6 +48,7 @@ function populate_channels(lists) num++; if(num>19)break; } + document.getElementById("preloader").style.display = "none"; document.getElementById("searches").innerHTML = output; }