mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Added shufflebutton
This commit is contained in:
33
js/admin.js
33
js/admin.js
@@ -4,8 +4,9 @@ var pass_corr = "";
|
||||
function admin()
|
||||
{
|
||||
adminTogg = !adminTogg;
|
||||
if(adminTogg)
|
||||
|
||||
if(adminTogg) $("#playlist").height($("#player").height()-210+30); //opening
|
||||
if(adminTogg) $("#playlist").height($("#player").height()-250+30); //opening
|
||||
if(!adminTogg)$("#playlist").height($("#player").height()+30);; //closing
|
||||
|
||||
$("#adminPanel").toggleClass("hiddenAdmin");
|
||||
@@ -41,7 +42,7 @@ function submitAdmin(form)
|
||||
document.getElementById("sBar").innerHTML = "Successfully applied settings.";
|
||||
$("#sBar").addClass("opacityFull");
|
||||
document.getElementById("passbox").value = "";
|
||||
}else{ $("#eBar").addClass("opacityFull");/*$("#adminPanel").addClass("fadeerror");*/}
|
||||
}else{ $("#eBar").addClass("opacityFull");document.getElementById("passbox").value = "";/*$("#adminPanel").addClass("fadeerror");*/}
|
||||
|
||||
console.log(pass_corr);
|
||||
updateList();
|
||||
@@ -52,3 +53,31 @@ function submitAdmin(form)
|
||||
$("#sBar").removeClass("opacityFull");
|
||||
},1500);
|
||||
}
|
||||
|
||||
function shuffle(form)
|
||||
{
|
||||
console.log(adminpass);
|
||||
confRes = $.ajax({
|
||||
type: "GET",
|
||||
url: "php/change.php",
|
||||
async: false,
|
||||
data: "shuffle=true&pass="+adminpass,
|
||||
|
||||
success: function() {
|
||||
console.log("configurations response: "+response);
|
||||
}
|
||||
}).responseText;
|
||||
if(confRes == "shuffled")
|
||||
{
|
||||
document.getElementById("sBar").innerHTML = "Successfully shuffled playlist.";
|
||||
$("#sBar").addClass("opacityFull");
|
||||
updateList();
|
||||
}else if(confRes = "wrong!")
|
||||
$("#eBar").addClass("opacityFull");
|
||||
setTimeout(function(){
|
||||
$("#adminPanel").removeClass("success");
|
||||
$("#adminPanel").removeClass("fadeerror");
|
||||
$("#eBar").removeClass("opacityFull");
|
||||
$("#sBar").removeClass("opacityFull");
|
||||
},1500);
|
||||
}
|
||||
|
||||
@@ -24,11 +24,11 @@ $save = false; //declares t
|
||||
if(isset($_REQUEST['shuffle'])){ //shuffle songs in list
|
||||
|
||||
$q = $data["conf"];
|
||||
$q = array_key_exists("addsongs", $q);
|
||||
$q = array_key_exists("adminpass", $q);
|
||||
$pass = htmlspecialchars($_GET['pass']);
|
||||
$x = explode("/", htmlspecialchars(strtolower($_SERVER["REQUEST_URI"])));
|
||||
$pass=crypt($pass, '$6$rounds=9001$'.$x[1].'Fuck0ffuSn34kyn!ggerzZ$');
|
||||
if($pass == $data['conf']['adminpass'] || $data['conf']['addsongs'] == "false" || $q != 1) {
|
||||
if($pass == $data["conf"]["adminpass"]) {
|
||||
|
||||
//shuffle($data["songs"]);
|
||||
foreach($data["songs"] as $k=>$v) {
|
||||
@@ -39,7 +39,8 @@ if(isset($_REQUEST['shuffle'])){ //shuffle songs in list
|
||||
array_multisort($sort['votes'], SORT_DESC, $sort['added'], SORT_ASC, $data["songs"]);
|
||||
file_put_contents($list, json_encode($data));
|
||||
//die("shuffeled");
|
||||
|
||||
echo "shuffled";
|
||||
die();
|
||||
}else{
|
||||
die("wrong!");
|
||||
}
|
||||
|
||||
@@ -15,14 +15,12 @@ foreach($dir as $files){
|
||||
$time_lasted = time() - filemtime('./lists/'.$files);
|
||||
if($time_lasted > $to)
|
||||
{
|
||||
$file = file_get_contents('./lists/'.$files); //Checking if the channel has the setting for showing on the frontpage set to true.
|
||||
$file = file_get_contents('./lists/'.$files);
|
||||
$data = json_decode($file, TRUE);
|
||||
$q = array_values($data["nowPlaying"]);
|
||||
if($q[0]["id"] == "30H2Z8Lr-4c");
|
||||
{
|
||||
unlink("./lists/".$files);
|
||||
}
|
||||
}
|
||||
if($time_lasted < $time){
|
||||
$file = file_get_contents('./lists/'.$files); //Checking if the channel has the setting for showing on the frontpage set to true.
|
||||
$data = json_decode($file, TRUE);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<b>Admin Panel</b> <span id="setpass"></span>
|
||||
<b>Admin Panel</b> <span id="setpass"></span><input type="button" class="button" value="Shuffle" onclick="shuffle(this.form);" title="Shuffle the playlist">
|
||||
|
||||
<form id="adminForm" onsubmit="return false" name="ufo" action="" class="daform nomargin" id="base">
|
||||
<div class="toggles">
|
||||
@@ -41,7 +41,6 @@
|
||||
categories allowed<br>
|
||||
songs after playing<br>
|
||||
</div>
|
||||
|
||||
<input type="password" name="pass" id="passbox" class="passbox" placeholder="Password">
|
||||
<input type="submit" class="button" value="Login/Save" onclick="submitAdmin(this.form);" title="Save settings/Login">
|
||||
</form>
|
||||
|
||||
@@ -95,7 +95,7 @@ input[type="radio"]{display: none;}
|
||||
|
||||
.clickthrough{pointer-events: none;}
|
||||
|
||||
#adminPanel{border-bottom: none; color:white; height:190px; padding: 10px; overflow:hidden; background-color: rgba(0,0,0,0.2); transition: height 0.5s;}
|
||||
#adminPanel{border-bottom: none; color:white; height:230px; padding: 10px; overflow:hidden; background-color: rgba(0,0,0,0.2); transition: height 0.5s;}
|
||||
.hiddenAdmin{padding:0 !important; margin:0 !important; height: 0 !important;}
|
||||
.button{background-color: rgba(255,255,255,0.2); border-radius: 4px; border: none;color: white;padding: 5px 15px; margin-top: 15px; transition: all 0.1s ease-in-out;}
|
||||
.button:hover{background-color: rgba(255,255,255,0.4); }
|
||||
|
||||
Reference in New Issue
Block a user