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>
|
<span class="hover-text">Skip</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</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>
|
<li>
|
||||||
<a class="nav-btn" href="#" data-activates="settings-bar" id="settings">
|
<a class="nav-btn" href="#" data-activates="settings-bar" id="settings">
|
||||||
<i class="mdi-action-settings"></i>
|
<i class="mdi-action-settings"></i>
|
||||||
@@ -42,7 +48,7 @@
|
|||||||
<ul class="side-nav" id="settings-bar">
|
<ul class="side-nav" id="settings-bar">
|
||||||
<?php include("php/panel.php");?>
|
<?php include("php/panel.php");?>
|
||||||
</ul>
|
</ul>
|
||||||
<form id="searchform" onsubmit="return false">
|
<form id="searchform" onsubmit="return false;">
|
||||||
<div>
|
<div>
|
||||||
<input id="search" class="search_input" type="search" required title="Search for songs..." spellcheck="false" placeholder="Search" onsubmit="null;" autocomplete="off">
|
<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>
|
<!--<label for="search"><i class="mdi-action-search"></i></label>
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ io.on('connection', function(socket){
|
|||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
db.createCollection(coll, function(err, docs){
|
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) {
|
db.collection(coll).find().sort({votes:-1}, function(err, docs) {
|
||||||
socket.emit(coll, docs);
|
socket.emit(coll, docs);
|
||||||
@@ -225,8 +225,8 @@ io.on('connection', function(socket){
|
|||||||
{
|
{
|
||||||
socket.emit("pw", pw);
|
socket.emit("pw", pw);
|
||||||
})
|
})
|
||||||
}
|
}else
|
||||||
socket.emit("toast", "wrongpass");
|
socket.emit("toast", "wrongpass");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -298,23 +298,31 @@ io.on('connection', function(socket){
|
|||||||
socket.on('shuffle', function(pass){
|
socket.on('shuffle', function(pass){
|
||||||
var hash = hash_pass(pass);
|
var hash = hash_pass(pass);
|
||||||
db.collection(coll).find({views:{$exists:true}}, function(err, docs){
|
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){
|
db.collection(coll).find({now_playing:false}).forEach(function(err, docs){
|
||||||
if(!docs){
|
if(!docs){
|
||||||
sort_list(coll, undefined, false, true);
|
sort_list(coll, undefined, false, true);
|
||||||
|
socket.emit("toast", "shuffled");
|
||||||
return;
|
return;
|
||||||
}else{
|
}else{
|
||||||
num = Math.floor(Math.random()*1000000);
|
num = Math.floor(Math.random()*1000000);
|
||||||
db.collection(coll).update({id:docs["id"]}, {$set:{added:num}}, function(err, d)
|
db.collection(coll).update({id:docs["id"]}, {$set:{added:num}}, function(err, d)
|
||||||
{
|
{
|
||||||
socket.emit("toast", "shuffled");
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}else
|
}else
|
||||||
socket.emit("toast", "wrongpass");
|
socket.emit("toast", "wrongpass");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var complete = function(tot, curr){
|
||||||
|
if(tot == curr)
|
||||||
|
{
|
||||||
|
sort_list(coll, undefined, false, true);
|
||||||
|
}
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on('disconnect', function()
|
socket.on('disconnect', function()
|
||||||
|
|||||||
@@ -242,7 +242,7 @@ hide mdi-action-visibility mdi-action-visibility-off
|
|||||||
.switch label input[type=checkbox]:checked + .lever:after {
|
.switch label input[type=checkbox]:checked + .lever:after {
|
||||||
background-color: white;
|
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;
|
cursor: default;
|
||||||
background-color: #939393;
|
background-color: #939393;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ function remove_bar()
|
|||||||
},1500);
|
},1500);
|
||||||
}
|
}
|
||||||
|
|
||||||
function shuffle(form)
|
function shuffle()
|
||||||
{
|
{
|
||||||
console.log(adminpass);
|
console.log(adminpass);
|
||||||
socket.emit('shuffle', adminpass);
|
socket.emit('shuffle', adminpass);
|
||||||
|
|||||||
Reference in New Issue
Block a user