Chan page is nice

This commit is contained in:
Nicolas A. Tonne
2015-04-10 01:24:42 +02:00
parent f997de2a36
commit 00dcb03727
7 changed files with 136 additions and 103 deletions

View File

@@ -5,13 +5,14 @@ var myScroll;
var scroller = false;
var showToggle =true;
var chan = $("#chan").html();
var list_html = $("#list-song-html").html();
var hasadmin=0;
function updateList()
{
console.log("updating list");
list = $.ajax({ type: "GET",
url: "php/change.php",
list = $.ajax({ type: "GET",
url: "php/change.php",
async: false
}).responseText;
list = $.parseJSON(list);
@@ -38,23 +39,18 @@ function updateList()
$.each(list.songs, function(j, listeID){
var video_title=listeID.title.replace(/\\\'/g, "'").replace(/"/g,"'").replace(/&/g,"&");
var video_id = listeID.id;
if(find && $.inArray(video_id, bright) == -1) brightness = "brightness";
else if(find && $.inArray(video_id, bright) != -1) brightness = "brightness fullbrightness";
else brightness = "";
var video_thumb = "http://i.ytimg.com/vi/"+video_id+"/mqdefault.jpg";
var odd = ""; if(j%2===0)odd=" oddlist";
var delsong = ""; if(pass_corr=="correct")delsong="<input id='del' title='Remove' type='button' class='button' value='X' onclick=\"vote('"+video_id+"','del')\">";
var finalhtml="<div id='result' class='"+video_id+" result "+brightness+" lresult"+odd+"'>"+
"<img class='thumb lthumb' src='"+video_thumb+"'>"+
"<div class='ltitle'>"+video_title+"</div>"+
"<div class='votes'>"+listeID.votes+
"<a onclick=\"vote('"+video_id+"','pos');\" id='plus'>+</a>"+
"<a onclick=\"vote('"+video_id+"','neg');\" id='minus'>-</a>"+
delsong+
"</div>"+
"</div>";
$("#wrapper").append(finalhtml);
var video_thumb = "background-image:url('http://img.youtube.com/vi/"+video_id+"/mqdefault.jpg');";
//var delsong = ""; if(pass_corr=="correct");
var video_votes = listeID.votes;
$("#wrapper").append(list_html);
var song = $("#list-song");
song.find(".list-title").text(video_title);
song.find(".list-votes").text(video_votes);
song.find(".votebg").attr("onclick", "vote('"+video_id+"','pos')");
song.find(".list-image").attr("style",video_thumb);
song.attr("id",video_id);
});
if($("#playlist").height() != $("#player").height() || (peis && $("#playlist").height() != $("#jplayer").height()))
{
if(!window.mobilecheck())
@@ -95,15 +91,12 @@ function updateList()
document.getElementsByName(names[i])[0].checked = (conf[names[i]] === "true");
document.getElementsByName(names[i])[1].checked = (conf[names[i]] === "false");
}
if(hasadmin)
$("#setpass").text("Channel has admin");
else
$("#setpass").text("Channel has no admin");
}
$("#settings").css("visibility", "visible");
$("#settings").css("opacity", "0.7");
$("#wrapper").css("opacity", "1");
}, 2500);
}
@@ -198,8 +191,8 @@ function show(){
function ks()
{
list = $.ajax({ type: "GET",
url: "php/change.php",
list = $.ajax({ type: "GET",
url: "php/change.php",
async: false
}).responseText;
list = $.parseJSON(list);
@@ -213,5 +206,5 @@ function ks()
scrollY: true,
interactiveScrollbars: false
});
scroller = true;
}
scroller = true;
}

View File

@@ -11,14 +11,11 @@ function getCookie(cname) {
$(document).ready(function (){
Materialize.showStaggeredList('#channels');
var deg = 0;
var pr = 15;
var pad = 0;
document.getElementById("zicon").addEventListener("click", function(){
deg = deg + 365;
pr = pr + 0.5;
document.getElementById("zicon").style.transform = "rotate("+deg+"deg)";
document.getElementById("zicon").style.width = pr+"%";
if(pr >= 60)
pad+=10;
document.getElementById("zicon").style.paddingLeft = pad+"%";
if(pad >= 100)
window.location.href = 'https://www.youtube.com/v/mK2fNG26xFg?autoplay=1&showinfo=0&autohide=1';
});
if(navigator.userAgent.toLowerCase().indexOf("android") > -1){

View File

@@ -11,7 +11,7 @@ var beginning;
var diffVideo;
var serverTime;
var url;
var response;
var response;
var url;
var tag;
var firstScriptTag;
@@ -37,6 +37,7 @@ var colorThief;
$(document).ready(function()
{
$("#settings").sideNav();
colorThief = new ColorThief();
window.mobilecheck = function() {
var check = false;
@@ -46,8 +47,6 @@ $(document).ready(function()
if(!window.mobilecheck())
{
$("#change").css("opacity", "0");
$("#wrapper").css("opacity", "0");
Notification.requestPermission();
}
@@ -56,8 +55,8 @@ $(document).ready(function()
beginning = true;
diffVideo = false;
interval = false;
response = $.ajax({ type: "GET",
url: "php/change.php",
response = $.ajax({ type: "GET",
url: "php/change.php",
async: false
}).responseText;
//console.log(response);
@@ -65,14 +64,14 @@ $(document).ready(function()
console.log(response.nowPlaying.length);
conf = response.conf;
console.log(conf);
try{
try{
for(var first in response.nowPlaying) break;
console.log(first);
response = first;
}catch(err){
response = "1";
}
if(window.mobilecheck()){
//syncInterval = setInterval(getTime, 50000);
//listInterval = setInterval(updateList, 50000);
@@ -135,7 +134,7 @@ function onPlayerStateChange(newState) {
console.log("new state: "+newState.data);
console.log("beginning: "+beginning);
//ytplayer.seekTo(15);
if((newState.data === 0 && checkEnd()) || (newState.data == 1 && checkEnd()))
if((newState.data === 0 && checkEnd()) || (newState.data == 1 && checkEnd()))
{
console.log("nummer 1");
startNextSong();
@@ -226,7 +225,7 @@ function startNextSong()
}
beginning = true;
setBGimage(response);
},2500);
updateList();
changed = true;
@@ -239,7 +238,7 @@ function startNextSong()
console.log("starter intervallen. Interval: " + interval);
}, 2500);
}
}
function getTime()
@@ -279,7 +278,7 @@ function getTime()
}
}
//if(interval){syncInterval = setInterval(getTime, 5000);interval = false;}
if(response != timeDifference[1])
{
//clearInterval(syncInterval);
@@ -324,8 +323,8 @@ function getTime()
function getTitle()
{
$.ajax({ type: "GET",
url: "php/timedifference.php",
$.ajax({ type: "GET",
url: "php/timedifference.php",
async: false,
success: function(data) {
viewers = $.parseJSON(data);
@@ -345,7 +344,7 @@ function getTitle()
}
function errorHandler(newState)
function errorHandler(newState)
{
setTimeout(function(){
arr = $.ajax({
@@ -369,19 +368,19 @@ function errorHandler(newState)
},2500);
/*
setTimeout(function(){
response = $.ajax({ type: "GET",
url: "change.php",
response = $.ajax({ type: "GET",
url: "change.php",
async: false
}).responseText;
var url = $.parseJSON(response);
response = url[0][0];
ytplayer.loadVideoById(response);
},2500);*/
}
function onPlayerReady(event) {
function onPlayerReady(event) {
//ytplayer = document.getElementById("myytplayer");
// ytplayer.addEventListener("onStateChange", "onytplayerStateChange");
// ytplayer.addEventListener("onStateChange", "onytplayerStateChange");
//ytplayer.addEventListener("onError", "errorHandler");
getTime();
if(!window.mobilecheck())