Compare commits

..

22 Commits

Author SHA1 Message Date
KasperRT
53b7b45e36 Fixed playlist bug, and sizing of jazzplayer 2015-03-25 12:42:14 +01:00
KasperRT
802a623b8a Added jazzplaylist easter-egg 2015-03-25 12:32:17 +01:00
KasperRT
2f5f86cb40 Fixed shitty bug I just created 2015-03-24 11:17:08 +01:00
KasperRT
d50f193426 Added shuffle option 2015-03-24 11:11:26 +01:00
KasperRT
08bde98224 fixed small bug 2015-03-18 10:03:18 +01:00
KasperRT
403fefe38b Added so you can press enter to go to the next in find 2015-03-18 00:47:07 +01:00
KasperRT
cece1a9452 Fixed dickbug 2015-03-17 15:27:11 +01:00
KasperRT
c66e7288b0 Preparing some code for enter to next, and fixing position bugs with search 2015-03-17 15:17:30 +01:00
KasperRT
fd660f872c Merge branch 'master' of https://github.com/nixolas1/Zoff 2015-03-17 14:54:20 +01:00
KasperRT
2fb78b460f Fixed the brightness errors on finding song 2015-03-17 14:54:09 +01:00
kasperrt
a7a3499f42 Fucked up footer, reverting 2015-03-16 20:56:47 +01:00
kasperrt
635bc78f6c Added scrollbar. Just because fuk 2015-03-16 20:55:54 +01:00
KasperRT
f5b8848b61 Changed location of find to html instead of body 2015-03-08 13:23:37 +01:00
KasperRT
7d7e1d9728 Fixed submitting error 2015-03-07 04:25:42 +01:00
KasperRT
5728357ca7 more god 2015-03-07 04:17:32 +01:00
KasperRT
e7b1cc5f78 Making find more usefull and functioning 2015-03-07 04:13:46 +01:00
KasperRT
8222d62bd9 Fixed some heights 2015-03-05 15:32:36 +01:00
KasperRT
1fd6488d60 Shorter fade 2015-03-05 15:18:40 +01:00
KasperRT
dd6190e30a Added blur js, not yet in use. Alo added searchlist script 2015-03-05 15:13:35 +01:00
KasperRT
d88f3fc63a Added custom find for playlist 2015-03-05 15:13:05 +01:00
Nicolas A. Tonne
52d453c621 Google store and GitHub badge 2015-03-03 20:06:05 +01:00
KasperRT
6055e30082 Added redirect for android users if they accept to the native app 2015-02-27 15:50:11 +01:00
14 changed files with 420 additions and 75 deletions

View File

@@ -34,6 +34,7 @@
<div id="results"></div>
<div class="main">
<div id="player" class="ytplayer"></div>
<div id="jplayer" class="jp"></div>
<div class="playlist" >
<div id="buttons" class="">
<!--<a href="/php/admin.php?list=<?php echo $list; ?>" title="Channel settings" ><img src="/static/settings2.png" class="skip middle" alt="Settings"/></a>-->
@@ -42,6 +43,10 @@
</div>
<div class="result hiddenAdmin" id="adminPanel"><?php include("php/panel.php");?> </div>
<form id="findform" onsubmit="return false;">
<input id="findform-input" type="text" onsubmit="null;" placeholder="Search list..">
<label id="numfound"></label>
</form>
<div id="playlist">
<div id="wrapper">
<img src="static/ajax-loader.gif" id="loading" alt="loading">

View File

@@ -5,10 +5,22 @@ function admin()
{
adminTogg = !adminTogg;
if(adminTogg)
if(adminTogg) $("#playlist").height($("#player").height()-270+30); //opening
if(!adminTogg)$("#playlist").height($("#player").height()+30);; //closing
{
if(find)
{
eH = -10;
}else
eH = 30;
$("#playlist").height($("#player").height()-290+eH); //opening
}else if(!adminTogg)
{
if(find)
{
eH = -10;
}else
eH = 30;
$("#playlist").height($("#player").height()+eH); //closing
}
$("#adminPanel").toggleClass("hiddenAdmin");
}
@@ -23,13 +35,14 @@ function submitAdmin(form)
removeplay = form.removeplay.value;
adminpass = form.pass.value;
skipping = form.skip.value;
shuffling = form.shuffle.value;
confRes = $.ajax({
type: "POST",
url: "php/change.php",
async: false,
data: "conf=start&vote="+voting+"&addsongs="+addsongs+"&longsongs="+longsongs+"&frontpage="+frontpage+"&allvideos="+allvideos+"&removeplay="+removeplay+"&pass="+adminpass+"&skip="+skipping,
data: "conf=start&vote="+voting+"&addsongs="+addsongs+"&longsongs="+longsongs+"&frontpage="+frontpage+
"&allvideos="+allvideos+"&removeplay="+removeplay+"&pass="+adminpass+"&skip="+skipping+"&shuffling="+shuffling,
success: function() {
console.log("configurations response: "+response);

17
js/blur.min.js vendored Executable file
View File

@@ -0,0 +1,17 @@
/*
* Blur.js
* Copyright Jacob Kelley
* MIT License
*/
// Stackblur, courtesy of Mario Klingemann: http://www.quasimondo.com/StackBlurForCanvas/StackBlurDemo.html
(function(l){l.fn.blurjs=function(e){function O(){this.a=this.b=this.g=this.r=0;this.next=null}var y=document.createElement("canvas"),P=!1,H=l(this).selector.replace(/[^a-zA-Z0-9]/g,"");if(y.getContext){var e=l.extend({source:"body",radius:5,overlay:"",offset:{x:0,y:0},optClass:"",cache:!1,cacheKeyPrefix:"blurjs-",draggable:!1,debug:!1},e),R=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,
328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,
305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],S=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,
20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];return this.each(function(){var A=l(this),I=l(e.source),B=I.css("backgroundImage").replace(/"/g,"").replace(/url\(|\)$/ig,"");ctx=y.getContext("2d");tempImg=new Image;tempImg.onload=function(){if(P)j=tempImg.src;else{y.style.display="none";y.width=tempImg.width;y.height=tempImg.height;ctx.drawImage(tempImg,0,0);var j=y.width,q=y.height,k=e.radius;if(!(isNaN(k)||1>k)){var k=
k|0,M=y.getContext("2d"),l;try{try{l=M.getImageData(0,0,j,q)}catch(L){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"),l=M.getImageData(0,0,j,q)}catch(T){throw alert("Cannot access local image"),Error("unable to access local image data: "+T);}}}catch(U){throw alert("Cannot access image"),Error("unable to access image data: "+U);}var c=l.data,u,z,a,d,f,J,g,h,i,v,w,x,m,n,o,r,s,t,C;u=k+k+1;var K=j-1,N=q-1,p=k+1,D=p*(p+1)/2,E=new O,b=E;for(a=1;a<u;a++)if(b=b.next=new O,a==
p)var Q=b;b.next=E;b=a=null;J=f=0;var F=R[k],G=S[k];for(z=0;z<q;z++){m=n=o=g=h=i=0;v=p*(r=c[f]);w=p*(s=c[f+1]);x=p*(t=c[f+2]);g+=D*r;h+=D*s;i+=D*t;b=E;for(a=0;a<p;a++)b.r=r,b.g=s,b.b=t,b=b.next;for(a=1;a<p;a++)d=f+((K<a?K:a)<<2),g+=(b.r=r=c[d])*(C=p-a),h+=(b.g=s=c[d+1])*C,i+=(b.b=t=c[d+2])*C,m+=r,n+=s,o+=t,b=b.next;a=E;b=Q;for(u=0;u<j;u++)c[f]=g*F>>G,c[f+1]=h*F>>G,c[f+2]=i*F>>G,g-=v,h-=w,i-=x,v-=a.r,w-=a.g,x-=a.b,d=J+((d=u+k+1)<K?d:K)<<2,m+=a.r=c[d],n+=a.g=c[d+1],o+=a.b=c[d+2],g+=m,h+=n,i+=o,a=a.next,
v+=r=b.r,w+=s=b.g,x+=t=b.b,m-=r,n-=s,o-=t,b=b.next,f+=4;J+=j}for(u=0;u<j;u++){n=o=m=h=i=g=0;f=u<<2;v=p*(r=c[f]);w=p*(s=c[f+1]);x=p*(t=c[f+2]);g+=D*r;h+=D*s;i+=D*t;b=E;for(a=0;a<p;a++)b.r=r,b.g=s,b.b=t,b=b.next;d=j;for(a=1;a<=k;a++)f=d+u<<2,g+=(b.r=r=c[f])*(C=p-a),h+=(b.g=s=c[f+1])*C,i+=(b.b=t=c[f+2])*C,m+=r,n+=s,o+=t,b=b.next,a<N&&(d+=j);f=u;a=E;b=Q;for(z=0;z<q;z++)d=f<<2,c[d]=g*F>>G,c[d+1]=h*F>>G,c[d+2]=i*F>>G,g-=v,h-=w,i-=x,v-=a.r,w-=a.g,x-=a.b,d=u+((d=z+p)<N?d:N)*j<<2,g+=m+=a.r=c[d],h+=n+=a.g=
c[d+1],i+=o+=a.b=c[d+2],a=a.next,v+=r=b.r,w+=s=b.g,x+=t=b.b,m-=r,n-=s,o-=t,b=b.next,f+=j}M.putImageData(l,0,0)}if(!1!=e.overlay)ctx.beginPath(),ctx.rect(0,0,tempImg.width,tempImg.width),ctx.fillStyle=e.overlay,ctx.fill();var j=y.toDataURL();if(e.cache)try{e.debug&&console.log("Cache Set"),localStorage.setItem(e.cacheKeyPrefix+H+"-"+B+"-data-image",j)}catch(V){console.log(V)}}q=I.css("backgroundAttachment");k="fixed"==q?"":"-"+(A.offset().left-I.offset().left-e.offset.x)+"px -"+(A.offset().top-I.offset().top-
e.offset.y)+"px";A.css({"background-image":'url("'+j+'")',"background-repeat":I.css("backgroundRepeat"),"background-position":k,"background-attachment":q});!1!=e.optClass&&A.addClass(e.optClass);e.draggable&&(A.css({"background-attachment":"fixed","background-position":"0 0"}),A.draggable())};Storage.prototype.cacheChecksum=function(j){var q="",k;for(k in j)var l=j[k],q="[object Object]"==l.toString()?q+(l.x.toString()+l.y.toString()+",").replace(/[^a-zA-Z0-9]/g,""):q+(l+",").replace(/[^a-zA-Z0-9]/g,
"");this.getItem(e.cacheKeyPrefix+H+"-"+B+"-options-cache")!=q&&(this.removeItem(e.cacheKeyPrefix+H+"-"+B+"-options-cache"),this.setItem(e.cacheKeyPrefix+H+"-"+B+"-options-cache",q),e.debug&&console.log("Settings Changed, Cache Emptied"))};var L=null;e.cache&&(localStorage.cacheChecksum(e),L=localStorage.getItem(e.cacheKeyPrefix+H+"-"+B+"-data-image"));null!=L?(e.debug&&console.log("Cache Used"),P=!0,tempImg.src=L):(e.debug&&console.log("Source Used"),tempImg.src=B)})}}})(jQuery);

45
js/jazzscript.js Normal file
View File

@@ -0,0 +1,45 @@
function jazz_setup()
{
document.getElementsByClassName("ytplayer")[0].style.display = "none";
jplayer = new YT.Player('jplayer', {
height: window.height*0.75,
width: window.width*0.6,
videoId: response,
playerVars: { rel:"0", wmode:"transparent", controls: "0" , iv_load_policy: "3", theme:"light", color:"white"},
events: {
'onReady': onJazzReady,
'onStateChange': onJazzState
}
});
document.getElementsByClassName("jp")[0].style.display = "inline";
}
function onJazzState(state)
{
if(state.data == 0)
{
jplayer.loadVideoById("0fYL_qiDYf0");
jplayer.playVideo();
}
}
function onJazzReady(event) {
//ytplayer = document.getElementById("myytplayer");
// ytplayer.addEventListener("onStateChange", "onytplayerStateChange");
//ytplayer.addEventListener("onError", "errorHandler");
getTime();
if(!window.mobilecheck())
{
$("#jplayer").css("opacity", "1");
$("#controls").css("opacity", "1");
$(".playlist").css("opacity", "1");
//$("#player").fadeIn();
jplayer.loadVideoById("0fYL_qiDYf0");
jplayer.playVideo();
}
readyLooks();
initSlider();
//durationFixer = setInterval(durationSetter, 1000);
}

View File

@@ -36,13 +36,15 @@ function updateList()
$("#wrapper").empty();
$.each(list.songs, function(j, listeID){
var video_title=listeID.title.replace(/\\\'/g, "'").replace(/&quot;/g,"'").replace(/&amp;/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 lresult"+odd+"'>"+
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+
@@ -53,19 +55,24 @@ function updateList()
"</div>";
$("#wrapper").append(finalhtml);
});
if($("#playlist").height() != $("#player").height())
if($("#playlist").height() != $("#player").height() || ($("#chan").html().toLowerCase() == "jazz" && $("#playlist").height() != $("#jplayer").height()))
{
if(!window.mobilecheck())
{
$("#playlist").css({height: $("#player").height()-$("#adminPanel").outerHeight(true)+30});
if($("#chan").html().toLowerCase() == "jazz")
{
player_name = "#jplayer";
}else player_name = "#player";
$("#playlist").css({height: $(player_name).height()-$("#adminPanel").outerHeight(true)-$("#findform").outerHeight(true)+30});
$("#playlist").css({overflow: "hidden"});
if(scroller === false)
{
myScroll = new IScroll('#playlist', {
mouseWheel: true,
scrollbars: false,
scrollbars: true,
scrollY: true,
interactiveScrollbars: false
interactiveScrollbars: true,
fadeScrollbars: true
});
scroller = true;
}else
@@ -83,7 +90,7 @@ function updateList()
}
if(!adminTogg)
{
names=["vote","addsongs","longsongs","frontpage", "allvideos", "removeplay", "skip"];
names=["vote","addsongs","longsongs","frontpage", "allvideos", "removeplay", "skip", "shuffle"];
for (var i = 0; i < names.length; i++) {
document.getElementsByName(names[i])[0].checked = (conf[names[i]] === "true");
document.getElementsByName(names[i])[1].checked = (conf[names[i]] === "false");

View File

@@ -74,12 +74,16 @@ function initControls()
function fitToScreen()
{
if($("#chan").html().toLowerCase() == "jazz")
{
player_name = "#jplayer";
}else player_name = "#player";
//document.getElementById("controls").style.top = document.getElementById("player").offsetTop + $("#player").height() + "px";
document.getElementById("controls").style.top = $("#player").position()["top"] + $("#player").height() + "px";
document.getElementById("controls").style.top = $(player_name).position()["top"] + $(player_name).height() + "px";
//document.getElementById("controls").style.left = document.getElementById("player").offsetLeft + "px";
document.getElementById("controls").style.left = $("#player").position()["left"] + "px";
document.getElementById("controls").style.left = $(player_name).position()["left"] + "px";
//document.getElementById("controls").style.left = "10px";
$("#controls").width($("#player").width());
$("#controls").width($(player_name).width());
document.getElementById("qS").style.top = "-80px";
document.getElementById("qS").style.left = $("#controls").width()-125+"px";

122
js/searchlist.js Executable file
View File

@@ -0,0 +1,122 @@
$(document).ready(function()
{
found = null;
znum = 1;
elem = [];
bright = [];
$.expr[":"].contains = $.expr.createPseudo(function(arg) {
return function( elem ) {
return $(elem).text().toUpperCase().indexOf(arg.toUpperCase()) >= 0;
};
});
find = false;
$("html").keydown(function(event) {
if ((event.keyCode == 27 && find) || (event.ctrlKey && event.keyCode === 70))
{
find = !find;
znum = 1;
if(find)
$(".lresult").addClass("brightness");
else
{
$(".lresult").removeClass("brightness");
$(".lresult").removeClass("fullbrightness");
bright.length = 0;
}
event.preventDefault();
$("#findform").toggleClass("display");
$("#adminPanel").toggleClass("brightness");
$("#findform-input").val("");
$("#findform-input").focus();
/*
if(find) $("#playlist").height($("#player").height()-30+30);
if(!find)$("#playlist").height($("#player").height()+30);; //closing
*/
/*if(adminTogg) extraHeight = -300;
else extraHeight = -30;*/
if(find)
{
if($("#adminPanel").height() != 0)
{
extraHeight = $("#adminPanel").height()+30;
}else
{
extraHeight = 10;
}
$("#playlist").height($("#player").height()-extraHeight); //opening
}else if(!find)
{
if($("#adminPanel").height() != 0)
{
extraHeight = $("#adminPanel").height()-10;
}else
{
extraHeight = -30;
}
$("#playlist").height($("#player").height()-extraHeight);; //closing
}
myScroll.refresh();
setTimeout(function(){myScroll.refresh();}, 505);
}
});
$("body").keyup(function(event) {
var x = event.keyCode;
if(find)
{
if(x == 13)
{
if(found != "" && $("#findform-input").val() != "")
{
znum+=1;
if(znum > elem.length)
{
znum = 1;
myScroll.scrollToElement(elem[0], 10, 0, 0);
}
console.log(znum);
console.log(elem[znum]);
myScroll.scrollToElement(elem[znum-1], 10, 0, 0);
document.getElementById("numfound").innerHTML = znum + " av " + bright.length;
$("#numfound").css("margin-left", "-"+($("#numfound").width()+8));
$("#numfound").css("padding-right", 4);
$("#findform-input").css("padding", "0 "+($("#numfound").width()+8)+"px 0 5px");
}
}else
{
if(found != null)
{
last = found[0];
if(!(typeof last === "undefined"))
$(".lresult").removeClass("fullbrightness");
}
found = $("#wrapper").find(".lresult:contains('"+$("#findform-input").val()+"')");
if(found != "" && $("#findform-input").val() != "")
{
elem.length = 0;
bright.length = 0;
znum = 1;
for(i = 0; i < found.length; i++)
{
found[i].className = found[i].className + " fullbrightness";
bright.push(found[i].className.split(" ")[0]);
elem.push(found[i]);
}
document.getElementById("numfound").innerHTML = znum + " av " + bright.length;
$("#numfound").css("margin-left", "-"+($("#numfound").width()+8));
$("#numfound").css("padding-right", 4);
$("#findform-input").css("padding", "0 "+($("#numfound").width()+8)+"px 0 5px");
myScroll.scrollToElement(found[0], 10, 0, 0);
}else
{
$(".lresult").removeClass("fullbrightness");
bright.length = 0;
elem.length = 0;
znum = 1;
}
}
//console.log($("#wrapper").find(".result:contains('"+$("#findform-input").val()+"')"));
}
});
});

View File

@@ -34,7 +34,6 @@ var notified = false;
$(document).ready(function()
{
window.mobilecheck = function() {
var check = false;
(function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check = true;})(navigator.userAgent||navigator.vendor||window.opera);
@@ -86,9 +85,22 @@ $(document).ready(function()
syncInterval = setInterval(getTime, 5000);
listInterval = setInterval(updateList, 10000);
//listKillInterval = setInterval(ks, 50000);
if($("#chan").html().toLowerCase() == "jazz")
{
loadjsfile("js/jazzscript.js");
}
}
});
function loadjsfile(filename)
{
var fileref=document.createElement('script');
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", filename);
document.getElementsByTagName("head")[0].appendChild(fileref);
}
function onYouTubeIframeAPIReady() {
$("#change").css("-webkit-transition", "opacity 1s");
$("#change").css("opacity", "1");
@@ -104,6 +116,10 @@ function onYouTubeIframeAPIReady() {
'onPlaybackQualityChange': logQ
}
});
if($("#chan").html().toLowerCase() == "jazz")
{
jazz_setup();
}
$("#player").css("opacity", "0");
initYoutubeControls(ytplayer);
}

View File

@@ -8,7 +8,7 @@ if($list[1]==""||!isset($list[1])||count($list)<=1)$list="videos";
else $list = preg_replace('/[^\da-z=?]/i', '', urldecode($list[1]));
$list="../lists/".$list.".json"; //actually setting the list for the target. Under is the array for an empty list being created
$array = array("nowPlaying" => array("30H2Z8Lr-4c" => array("id" => "30H2Z8Lr-4c", "title" => "Empty Channel, search to add a video")), "songs" => array(), "conf" => array("startTime" => time(), "views" => array(), "skips" => array(), "vote" => "false", "addsongs" => "false", "longsongs" => "true", "frontpage" => "true", "allvideos" => "true", "removeplay" => "false", "skip" => "true", "adminpass" => ""));
$array = array("nowPlaying" => array("30H2Z8Lr-4c" => array("id" => "30H2Z8Lr-4c", "title" => "Empty Channel, search to add a video")), "songs" => array(), "conf" => array("startTime" => time(), "views" => array(), "skips" => array(), "vote" => "false", "addsongs" => "false", "longsongs" => "true", "frontpage" => "true", "allvideos" => "true", "removeplay" => "false", "skip" => "true", "shuffle" => "false", "adminpass" => ""));
$array = json_encode($array); //encoding the array
$f = @fopen($list,"x"); //opening a file, ignoring warnings
if($f){ fwrite($f,$array); fclose($f); } //if the file doesn't exist, we create a new one, and adds the newly made array there
@@ -24,7 +24,7 @@ $save = false; //declares t
if(isset($_REQUEST['shuffle'])){ //shuffle songs in list
$q = $data["conf"];
$q = array_key_exists("adminpass", $q);
$q = array_key_exists("shuffle", $q);
$pass = htmlspecialchars($_GET['pass']);
$x = explode("/", htmlspecialchars(strtolower($_SERVER["REQUEST_URI"])));
if($pass != "")
@@ -32,7 +32,8 @@ if(isset($_REQUEST['shuffle'])){ //shuffle songs in list
if(sizeof($data["songs"]) == 0){
die("size");
}
if($pass == $data["conf"]["adminpass"] || $data["conf"]["adminpass"] == "") {
if($pass == $data["conf"]["adminpass"] || $data["conf"]["adminpass"] == "" || $q != 1
|| $data["conf"]["shuffle"] == "true") {
//shuffle($data["songs"]);
foreach($data["songs"] as $k=>$v) {
@@ -67,18 +68,18 @@ if(isset($_REQUEST['thisUrl'])){
$firstToAdd = $firstSong[0]["id"]; //getting the id of the first in the queue
if($np[0]["id"] == $string) //if the string we're sending in matches the id of the song playing now, we proceed
{
if($action=="save" || $action == "empty"){ //action save or empty, either way goes further
if($action=="save" || $action == "empty"){ //action save or empty, either way goes further
$save = true; //small fix for the editing of viewers. Explain later in file.
//array_shift($data["songs"]);
//array_shift($data["nowPlaying"]);
if(!is_null($np[0]["id"]) && !is_null($firstToAdd)){ //Checking both the next song and the song playing now is null, if so it just skips the flipping around with songs
array_shift($data["songs"]); //already shifts the array of songs, because we have the first in the queue saved
$q = $data["conf"];
$q = array_key_exists("removeplay", $q);
if(($data["conf"]["removeplay"] == "false" || $q != 1) && ($np[0]["id"] != "30H2Z8Lr-4c" && !is_null($firstToAdd))) //checking if removeplay exists or if its false. If its true, the song we just played won't be added to the queue
{ //here we just adds the song that was just played into the queue in the songs array, take note here we set added as the current time it was added. This is because of the multisort further down
$data["songs"][$np[0]["id"]] = array("id" => $np[0]["id"], "title" => $np[0]["title"], "votes" => $np[0]["votes"], "added" => time(), "guids" => array());
}
$q = array_key_exists("removeplay", $q);
if(($data["conf"]["removeplay"] == "false" || $q != 1) && ($np[0]["id"] != "30H2Z8Lr-4c" && !is_null($firstToAdd))) //checking if removeplay exists or if its false. If its true, the song we just played won't be added to the queue
{ //here we just adds the song that was just played into the queue in the songs array, take note here we set added as the current time it was added. This is because of the multisort further down
$data["songs"][$np[0]["id"]] = array("id" => $np[0]["id"], "title" => $np[0]["title"], "votes" => $np[0]["votes"], "added" => time(), "guids" => array());
}
array_shift($data["nowPlaying"]); //shifting the nowPlaying array, and moving the first in line to the nowPlaying array
$data["nowPlaying"][$firstSong[0]["id"]] = array("id" => $firstSong[0]["id"], "title" => $firstSong[0]["title"], "votes" => 0, "added" => $firstSong[0]["added"], "guids" => $firstSong[0]["guids"]);
@@ -92,7 +93,7 @@ if(isset($_REQUEST['thisUrl'])){
$sort['votes'][$k] = $v['votes'];
$sort['added'][$k] = $v['added'];
}
array_multisort($sort['votes'], SORT_DESC, $sort['added'], SORT_ASC, $data["songs"]);
array_multisort($sort['votes'], SORT_DESC, $sort['added'], SORT_ASC, $data["songs"]);
}
/* else if($action=="delete"){
array_shift($firstSong[0]);
@@ -105,7 +106,7 @@ if(isset($_REQUEST['thisUrl'])){
$data["nowPlaying"][$firstSong[0]["id"]] = array("id" => $firstSong[0]["id"], "title" => $firstSong[0]["title"], "votes" => 0, "added" => $firstSong[0]["added"], "guids" => $firstSong[0]["guids"]);
}
if($action == "save" && !$save) //count views
if($action == "save" && !$save) //count views
{
file_put_contents($list, json_encode($data));
}
@@ -124,7 +125,7 @@ else if(isset($_GET['v'])){ //if it
$name = htmlspecialchars($_GET['n']); //name of the video
if($np[0]["id"] == "30H2Z8Lr-4c")
{
$q = array("nowPlaying" => array($video => array("id" => $video, "title" => $name, "votes" => 0, "added" => time(), "guids" => array())), "songs" => array(), "conf" => array("startTime" => time(), "views" => array(), "skips" => array(), "vote" => "false", "addsongs" => "false", "longsongs" => "true", "frontpage" => "true", "allvideos" => "true", "removeplay" => "false", "skip" => "true", "adminpass" => ""));
$q = array("nowPlaying" => array($video => array("id" => $video, "title" => $name, "votes" => 0, "added" => time(), "guids" => array())), "songs" => array(), "conf" => array("startTime" => time(), "views" => array(), "skips" => array(), "vote" => "false", "addsongs" => "false", "longsongs" => "true", "frontpage" => "true", "allvideos" => "true", "removeplay" => "false", "skip" => "true", "shuffle" => "false", "adminpass" => ""));
//$q = array("nowPlaying" => array($video => array("id" => $video, "title" => $name, "votes" => 0, "added" => time(), "guids" => array())), "songs" => array(), "conf" => array("startTime" => time(), "views" => array(), "skips" => array()));
$q["nowPlaying"][$video]["votes"] = 1; //Upping the votes, so it comes further up than the ones already played
array_push($q["nowPlaying"][$video]["guids"], $guid);
@@ -178,9 +179,9 @@ else if(isset($_GET['vote'])){ //if th
$pass=crypt($pass, '$6$rounds=9001$'.$x[1].'Fuck0ffuSn34kyn!ggerzZ$');
if($pass == $data['conf']['adminpass'] || $data['conf']['vote'] == "false" || $q != 1)
{
if($vote == 'neg'){$voteAdd = -1;} //setting the votetoadd to the array depending of what way you swing.
if($vote == 'neg'){$voteAdd = -1;} //setting the votetoadd to the array depending of what way you swing.
else if($vote == 'pos'){$voteAdd = 1;} //checking if the key exists in the array, and if we're already voted
if(array_key_exists($id, $data["songs"]) && !in_array($guid, $data["songs"][$id]["guids"]))
if(array_key_exists($id, $data["songs"]) && !in_array($guid, $data["songs"][$id]["guids"]))
{ //finally adding the vote to the votings
$data["songs"][$id]["votes"] = $data["songs"][$id]["votes"] + $voteAdd;
if($data["songs"][$id]["votes"] > -1) //but only if we're still above or equal to 0
@@ -210,63 +211,64 @@ else if(isset($_GET['vote'])){ //if th
}
}
else if(isset($_GET['skip'])){ //skip, really similar to the save function, not going in depth here.
$q = $data["conf"];
$q = $data["conf"];
$q = array_key_exists("skip", $q);
$viewers=count($data["conf"]["views"]);
$skips=count($data["conf"]["skips"]); //Counting how many GUIDS there are under the skip key
if(!in_array($guid, $data["conf"]["skips"]) && ($data["conf"]["skip"] == "true" || $q != 1 || $data["conf"]["skip"] == "")){ //If the users GUID isn't in the array, its added
array_push($data["conf"]["skips"], $guid);
$skips+=1; //and the number of skips is upped
//$data["conf"]["skips"]=$skips;
if($skips>=$viewers/2){ //checking if the skips wanted is larger than the viewers/2, if so its skipping, woohooo!
array_shift($data["songs"]);
$q = $data["conf"];
$q = array_key_exists("removeplay", $q);
if($data["conf"]["removeplay"] == "false" || $q != 1)
{
$data["songs"][$np[0]["id"]] = array("id" => $np[0]["id"], "title" => $np[0]["title"], "votes" => $np[0]["votes"], "added" => time(), "guids" => array());
}
array_shift($data["nowPlaying"]);
$data["nowPlaying"][$firstSong[0]["id"]] = array("id" => $firstSong[0]["id"], "title" => $firstSong[0]["title"], "votes" => 0, "added" => $firstSong[0]["added"], "guids" => $firstSong[0]["guids"]);
//array_push($data["songs"], $add);
$data["conf"]["skips"] = array();
$data["conf"]["startTime"] = time();
foreach($data["songs"] as $k=>$v) {
$sort['votes'][$k] = $v['votes'];
$sort['added'][$k] = $v['added'];
}
array_multisort($sort['votes'], SORT_DESC, $sort['added'], SORT_ASC, $data["songs"]);
}
file_put_contents($list, json_encode($data));
$skips=count($data["conf"]["skips"]); //Counting how many GUIDS there are under the skip key
if(!in_array($guid, $data["conf"]["skips"]) && ($data["conf"]["skip"] == "true" || $q != 1 || $data["conf"]["skip"] == "")){ //If the users GUID isn't in the array, its added
array_push($data["conf"]["skips"], $guid);
$skips+=1; //and the number of skips is upped
//$data["conf"]["skips"]=$skips;
if($skips>=$viewers/2){ //checking if the skips wanted is larger than the viewers/2, if so its skipping, woohooo!
array_shift($data["songs"]);
$q = $data["conf"];
$q = array_key_exists("removeplay", $q);
if($data["conf"]["removeplay"] == "false" || $q != 1)
{
$data["songs"][$np[0]["id"]] = array("id" => $np[0]["id"], "title" => $np[0]["title"], "votes" => $np[0]["votes"], "added" => time(), "guids" => array());
}
array_shift($data["nowPlaying"]);
$data["nowPlaying"][$firstSong[0]["id"]] = array("id" => $firstSong[0]["id"], "title" => $firstSong[0]["title"], "votes" => 0, "added" => $firstSong[0]["added"], "guids" => $firstSong[0]["guids"]);
//array_push($data["songs"], $add);
$data["conf"]["skips"] = array();
$data["conf"]["startTime"] = time();
foreach($data["songs"] as $k=>$v) {
$sort['votes'][$k] = $v['votes'];
$sort['added'][$k] = $v['added'];
}
array_multisort($sort['votes'], SORT_DESC, $sort['added'], SORT_ASC, $data["songs"]);
}
file_put_contents($list, json_encode($data));
echo($skips."/".$viewers);
}else if($data["conf"]["skip"] == "false")
}else if($data["conf"]["skip"] == "false")
{
echo("wrong!");
}
}else if(isset($_POST['conf'])) //conf, this is for admin settings/channel settings
{
$data["conf"]["vote"] = $_POST['vote']; //setting all the settings from the post gotten from admin.js
$data["conf"]["addsongs"] = $_POST['addsongs'];
$data["conf"]["longsongs"] = $_POST['longsongs'];
$data["conf"]["frontpage"] = $_POST['frontpage'];
$data["conf"]["allvideos"] = $_POST['allvideos'];
$data["conf"]["removeplay"] = $_POST['removeplay'];
$data["conf"]["vote"] = $_POST['vote']; //setting all the settings from the post gotten from admin.js
$data["conf"]["addsongs"] = $_POST['addsongs'];
$data["conf"]["longsongs"] = $_POST['longsongs'];
$data["conf"]["frontpage"] = $_POST['frontpage'];
$data["conf"]["allvideos"] = $_POST['allvideos'];
$data["conf"]["removeplay"] = $_POST['removeplay'];
$data["conf"]["skip"] = $_POST['skip'];
$pass = htmlspecialchars($_POST['pass']);
$data["conf"]["shuffle"] = $_POST['shuffling'];
$pass = htmlspecialchars($_POST['pass']);
if($pass != ""){
$x = explode("/", htmlspecialchars(strtolower($_SERVER["REQUEST_URI"])));
$pass=crypt($pass, '$6$rounds=9001$'.$x[1].'Fuck0ffuSn34kyn!ggerzZ$');
}
$q = $data["conf"];
$q = array_key_exists("adminpass", $q);
$q = array_key_exists("adminpass", $q);
if($data["conf"]["adminpass"] == $pass || $q != 1 || $data["conf"]["adminpass"] == "") //if the password is the same as the one in the jsonfile, we are updating the settings (not in use yet)
{
$data["conf"]["adminpass"] = $pass;
echo "correct";
file_put_contents($list, json_encode($data));
}else
if($data["conf"]["adminpass"] == $pass || $q != 1 || $data["conf"]["adminpass"] == "") //if the password is the same as the one in the jsonfile, we are updating the settings (not in use yet)
{
$data["conf"]["adminpass"] = $pass;
echo "correct";
file_put_contents($list, json_encode($data));
}else
{
echo "wrong";
}

View File

@@ -5,6 +5,7 @@
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
<script type="text/javascript" src="static/js/iscroll-min.js"></script>
<script type="text/javascript" src="static/js/list.js"></script>
<script type="text/javascript" src="static/js/searchlist.js"></script>
<script type="text/javascript" src="static/js/playercontrols.js"></script>
<script type="text/javascript" src="static/js/youtube.js"></script>
<script type="text/javascript" src="static/js/search.js"></script>

View File

@@ -77,7 +77,19 @@ foreach($fil as $files){
</center>
</div>
<div class="footer small centered top anim bottom">&copy; <?php echo date("Y"); ?> <a class="anim" href="//nixo.no">Nixo</a> &amp; <a class="anim" href="//kasperrt.no">KasperRT</a> </div>
<div class="footer small centered top anim bottom">
<div class="badge">
<a href="https://play.google.com/store/apps/details?id=no.lqasse.zoff">
<img alt="Get it on Google Play" src="static/google_play.png">
</a>
<a href="https://github.com/nixolas1/Zoff" class="badge">
<img alt="View the project on GitHub" src="static/GitHub_Logo.png">
</a>
</div>
&copy; <?php echo date("Y"); ?>
<a class="anim" href="//nixo.no">Nixo</a> &amp;
<a class="anim" href="//kasperrt.no">KasperRT</a>
</div>
<script type="text/javascript">
var deg = 0;
var pr = 15;
@@ -90,5 +102,37 @@ foreach($fil as $files){
window.location.href = 'https://www.youtube.com/v/mK2fNG26xFg?autoplay=1&showinfo=0&autohide=1';
});
</script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i=0; i<ca.length; i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1);
if (c.indexOf(name) == 0) return c.substring(name.length,c.length);
}
return "";
}
$(document).ready(function (){
if(navigator.userAgent.toLowerCase().indexOf("android") > -1){
console.log("android");
var ca = document.cookie.split(';');
if(getCookie("show_prompt") == "")
{
var r = confirm("Do you want to download the native app for this webpage?");
if(r)
window.location.href = 'https://play.google.com/store/apps/details?id=no.lqasse.zoff';
else
{
var d = new Date();
d.setTime(d.getTime() + (10*24*60*60*1000));
var expires = "expires="+d.toUTCString();
document.cookie = "show_prompt=false;"+expires;
}
}
}
});
</script>
</body>
</html>

View File

@@ -37,6 +37,10 @@
<label><input type="radio" class="radio" name="skip" value="true"><span>Allow</span></label> /
<label><input type="radio" class="radio" name="skip" value="false"><span>Block</span></label>
</div>
<div class="toggler">
<label><input type="radio" class="radio" name="shuffle" value="true"><span>Allow</span></label> /
<label><input type="radio" class="radio" name="shuffle" value="false"><span>Block</span></label>
</div>
</div>
<div class="toggtext">
@@ -47,6 +51,7 @@
categories allowed<br>
songs after playing<br>
skipping<br>
shuffle<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">

BIN
static/google_play.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

View File

@@ -8,6 +8,51 @@ body {
/* WebKit/Blink Browsers */
}
.brightness {
-webkit-filter:brightness(50%);
filter:brightness(50%);
background-color:rgba(0,0,0,0);
}
.fullbrightness {
-webkit-filter:brightness(100%);
filter:brightness(100%);
/*background-color:rgba(0,0,0,0.2);*/
}
#findform {
/*position: absolute;
top:50%;
width:38%;
display:none;*/
overflow:hidden;
height:0px;
padding:0px;
margin:0px;
-webkit-transition:height 0.5s;
}
#numfound {
color:white;
}
#findform-input {
color:#fff;
height:24px;
font-size:15px;
width:60%;
/*padding:0 50px 0 5px;*/
margin:5px 0;
border-radius:2px;
border:none;
text-align:left;
background-color:rgba(255,255,255,0.2);
}
.display {
height:40px !important;
}
.top {
font-family:'Open Sans',sans-serif;
font-weight:300;
@@ -119,6 +164,7 @@ body {
.footer a {
color:rgba(254,254,254,0.42);
text-decoration:none;
display: inline;
}
.footer a:hover {
@@ -135,6 +181,11 @@ body {
bottom:0;
}
.badge{
display: block;
padding-bottom: 7px;
}
.bottom {
bottom:10px;
}
@@ -444,11 +495,24 @@ input[type="radio"] {
#adminPanel {
border-bottom:none;
color:#fff;
height:250px;
height:270px;
padding:10px;
overflow:hidden;
background-color:rgba(0,0,0,0.2);
transition:height .5s;
-webkit-filter:brightness(100%) !important;
filter:brightness(100%) !important;
}
#jplayer {
display:none;
-webkit-transition: opacity 1s;
transition: opacity 1s;
height:68%;
height:calc(90% - 213px);
width:60%;
border-radius:3px;
/*box-shadow: 0 8px 11px -4px black;*/
}
.hiddenAdmin {