mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Added shufflebutton, name needs to be reworked. Also implemented default settings to be 'correct'
This commit is contained in:
@@ -32,6 +32,12 @@
|
||||
<span class="hover-text">Skip</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="nav-btn" href="#" id="shuffle" onclick="shuffle();">
|
||||
<i class="mdi-av-shuffle"></i>
|
||||
<span class="hover-text">Stir</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="nav-btn" href="#" data-activates="settings-bar" id="settings">
|
||||
<i class="mdi-action-settings"></i>
|
||||
@@ -42,7 +48,7 @@
|
||||
<ul class="side-nav" id="settings-bar">
|
||||
<?php include("php/panel.php");?>
|
||||
</ul>
|
||||
<form id="searchform" onsubmit="return false">
|
||||
<form id="searchform" onsubmit="return false;">
|
||||
<div>
|
||||
<input id="search" class="search_input" type="search" required title="Search for songs..." spellcheck="false" placeholder="Search" onsubmit="null;" autocomplete="off">
|
||||
<!--<label for="search"><i class="mdi-action-search"></i></label>
|
||||
|
||||
@@ -89,7 +89,7 @@ io.on('connection', function(socket){
|
||||
}else
|
||||
{
|
||||
db.createCollection(coll, function(err, docs){
|
||||
db.collection(coll).insert({"addsongs":false, "adminpass":"", "allvideos":true, "frontpage":true, "longsongs":true, "removeplay": false, "shuffle": true, "skip": false, "skips": [], "startTime":get_time(), "views": [], "vote": false}, function(err, docs)
|
||||
db.collection(coll).insert({"addsongs":false, "adminpass":"", "allvideos":false, "frontpage":true, "longsongs":false, "removeplay": false, "shuffle": true, "skip": false, "skips": [], "startTime":get_time(), "views": [], "vote": false}, function(err, docs)
|
||||
{
|
||||
db.collection(coll).find().sort({votes:-1}, function(err, docs) {
|
||||
socket.emit(coll, docs);
|
||||
@@ -225,8 +225,8 @@ io.on('connection', function(socket){
|
||||
{
|
||||
socket.emit("pw", pw);
|
||||
})
|
||||
}
|
||||
socket.emit("toast", "wrongpass");
|
||||
}else
|
||||
socket.emit("toast", "wrongpass");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -298,23 +298,31 @@ io.on('connection', function(socket){
|
||||
socket.on('shuffle', function(pass){
|
||||
var hash = hash_pass(pass);
|
||||
db.collection(coll).find({views:{$exists:true}}, function(err, docs){
|
||||
if((docs[0]["adminpass"] == hash || docs[0]["adminpass"] == "") || docs[0]["shuffle"] == true)
|
||||
if((docs[0]["adminpass"] == hash || docs[0]["adminpass"] == "") || docs[0]["shuffle"] == false)
|
||||
{
|
||||
db.collection(coll).find({now_playing:false}).forEach(function(err, docs){
|
||||
if(!docs){
|
||||
sort_list(coll, undefined, false, true);
|
||||
socket.emit("toast", "shuffled");
|
||||
return;
|
||||
}else{
|
||||
num = Math.floor(Math.random()*1000000);
|
||||
db.collection(coll).update({id:docs["id"]}, {$set:{added:num}}, function(err, d)
|
||||
{
|
||||
socket.emit("toast", "shuffled");
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
}else
|
||||
socket.emit("toast", "wrongpass");
|
||||
});
|
||||
|
||||
var complete = function(tot, curr){
|
||||
if(tot == curr)
|
||||
{
|
||||
sort_list(coll, undefined, false, true);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
socket.on('disconnect', function()
|
||||
|
||||
@@ -242,7 +242,7 @@ hide mdi-action-visibility mdi-action-visibility-off
|
||||
.switch label input[type=checkbox]:checked + .lever:after {
|
||||
background-color: white;
|
||||
}
|
||||
.switch input[type=checkbox][disabled] + .lever {
|
||||
.switch input[type=checkbox][disabled] + .lever , .switch label input[type=checkbox]:checked[disabled] + .lever{
|
||||
cursor: default;
|
||||
background-color: #939393;
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ function remove_bar()
|
||||
},1500);
|
||||
}
|
||||
|
||||
function shuffle(form)
|
||||
function shuffle()
|
||||
{
|
||||
console.log(adminpass);
|
||||
socket.emit('shuffle', adminpass);
|
||||
|
||||
Reference in New Issue
Block a user