mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
12
js/admin.js
12
js/admin.js
@@ -11,24 +11,26 @@ function admin()
|
||||
|
||||
function submitAdmin(form)
|
||||
{
|
||||
vote = form.vote.checked,
|
||||
voting = form.vote.checked,
|
||||
addSongs = form.addSongs.checked,
|
||||
longSongs = form.longSongs.checked,
|
||||
frontpage = form.frontPage.checked,
|
||||
onlyMusic = form.onlyMusic.checked,
|
||||
removePlay = form.removePlay.checked,
|
||||
pass = form.pass.value;
|
||||
adminpass = form.pass.value;
|
||||
|
||||
conf = $.ajax({
|
||||
confRes = $.ajax({
|
||||
type: "POST",
|
||||
url: "php/change.php",
|
||||
async: false,
|
||||
data: "conf=start&vote="+vote+"&addsongs="+addSongs+"&longsongs="+longSongs+"&frontpage="+frontpage+"&onlymusic="+onlyMusic+"&removeplay="+removePlay+"&pass="+pass,
|
||||
data: "conf=start&vote="+voting+"&addsongs="+addSongs+"&longsongs="+longSongs+"&frontpage="+frontpage+"&onlymusic="+onlyMusic+"&removeplay="+removePlay+"&pass="+adminpass,
|
||||
|
||||
success: function() {
|
||||
console.log("configurations response: "+response);
|
||||
}
|
||||
}).responseText;
|
||||
|
||||
console.log(conf);
|
||||
pass = confRes;
|
||||
console.log(pass);
|
||||
|
||||
}
|
||||
|
||||
18
js/list.js
18
js/list.js
@@ -14,6 +14,15 @@ function updateList()
|
||||
async: false
|
||||
}).responseText;
|
||||
list = $.parseJSON(list);
|
||||
conf = list["conf"];
|
||||
if(conf.hasOwnProperty("addsongs") && conf["addsongs"] == "true") adminadd = 1;
|
||||
else adminadd = 0;
|
||||
if(conf.hasOwnProperty("onlymusic") && conf["onlymusic"] == "true") music = 1;
|
||||
else music = 0;
|
||||
if(conf.hasOwnProperty("longsongs") && conf["longsongs"] == "true") longS = 1;
|
||||
else longS = 0;
|
||||
if(conf.hasOwnProperty("vote") && conf["vote"] == "true") adminvote = 1;
|
||||
else adminvote = 0;
|
||||
/*list[0].shift();
|
||||
list[3].shift();
|
||||
list[2].shift();*/
|
||||
@@ -67,15 +76,22 @@ function updateList()
|
||||
document.getElementById("player").style.display="none";
|
||||
ytplayer.pauseVideo();
|
||||
}
|
||||
document.getElementsByName("vote")[0].checked = (conf["vote"] === "true");
|
||||
document.getElementsByName("addSongs")[0].checked = (conf["addsongs"] === "true");
|
||||
document.getElementsByName("longSongs")[0].checked = (conf["longsongs"] === "true");
|
||||
document.getElementsByName("frontPage")[0].checked = (conf["frontpage"] === "true");
|
||||
document.getElementsByName("onlyMusic")[0].checked = (conf["onlymusic"] === "true");
|
||||
document.getElementsByName("removePlay")[0].checked = (conf["removeplay"] === "true");
|
||||
}, 2500);
|
||||
}
|
||||
|
||||
function vote(id, vote){
|
||||
console.log(adminpass);
|
||||
console.log($.ajax({
|
||||
type: "GET",
|
||||
url: "php/change.php",
|
||||
async: false,
|
||||
data: "vote="+vote+"&id="+id,
|
||||
data: "vote="+vote+"&id="+id+"&pass="+adminpass,
|
||||
success: function() {
|
||||
console.log("voted "+vote+" on "+id);
|
||||
if(vote=="pos"){ $("#playlist").addClass("success");}
|
||||
|
||||
@@ -39,8 +39,8 @@ $(document).ready(function()
|
||||
{
|
||||
$.each(response.data.items, function(i,data)
|
||||
{
|
||||
if(data.duration > 720){return;}
|
||||
if(data["category"] == "Music"){
|
||||
if(data.duration > 720 && longS == 0){return;}
|
||||
if(data["category"] == "Music" || music == 0){
|
||||
var video_title=encodeURIComponent(data.title).replace(/'/g, "\\\'");
|
||||
var views=data.viewCount;
|
||||
var video_thumb = "http://i.ytimg.com/vi/"+data.id+"/default.jpg";
|
||||
@@ -74,7 +74,7 @@ $(document).ready(function()
|
||||
type: "GET",
|
||||
url: "php/change.php",
|
||||
async: false,
|
||||
data: "v="+id+"&n="+title,
|
||||
data: "v="+id+"&n="+title+"&pass="+adminpass,
|
||||
success: function() {
|
||||
console.log("added "+id);
|
||||
document.getElementById("search").value = "";
|
||||
|
||||
@@ -22,6 +22,14 @@ var interval;
|
||||
var viewers;
|
||||
var video_id;
|
||||
var changed = false;
|
||||
var conf = [];
|
||||
var adminvote = 0;
|
||||
var adminadd = 0;
|
||||
var adminskip = 0;
|
||||
var music = 0;
|
||||
var longS = 0;
|
||||
var frontpage = 1;
|
||||
var adminpass = "";
|
||||
|
||||
$(document).ready(function()
|
||||
{
|
||||
@@ -43,6 +51,8 @@ $(document).ready(function()
|
||||
//console.log(response);
|
||||
response = $.parseJSON(response);
|
||||
console.log(response["nowPlaying"].length);
|
||||
conf = response["conf"];
|
||||
console.log(conf);
|
||||
try{
|
||||
for(first in response["nowPlaying"]) break;
|
||||
console.log(first);
|
||||
|
||||
Reference in New Issue
Block a user