This commit is contained in:
Kasper Rynning-Tønnesen
2015-11-26 12:12:56 +01:00
828 changed files with 124396 additions and 675 deletions
Vendored Regular → Executable
View File
Vendored Regular → Executable
View File
+15 -1
View File
@@ -41,7 +41,7 @@
-ms-user-select: none;
user-select: none;
}
.rounded{
border-radius: 4px;
}
@@ -78,6 +78,12 @@ input[type=text]:focus:not([readonly]) + label, input[type=password]:focus:not([
color: #2D2D2D;
}
.pin{
position:absolute;
right:10px;
font-size:25px;
}
.field-settings{
margin-left: 25px !important;
color: rgb(68,68,68);
@@ -123,6 +129,10 @@ nav .brand-logo{
background-color:rgba(45,45,45,1);
}
.import-a{
width:100%;
}
#nav-mobile .green:hover{
background-color: #38803C !important;
}
@@ -849,6 +859,10 @@ nav ul li:hover, nav ul li.active {
}
.ui-resizable-e{
width:15px;
}
/************** Youtube controls **************/
Vendored Executable → Regular
+1 -1
View File
@@ -1 +1 @@
!function(){var e,t,o={blob_list:[],populate_channels:function(t){var n="",a=0;t.sort(o.sortFunction),pre_card=$(e),o.add_backdrop(t,0);for(x in t){var s=t[x][3];if(20>a){var i=t[x][1],l=t[x][0],r="background-image:url('https://img.youtube.com/vi/"+i+"/hqdefault.jpg');",c=t[x][4],d=pre_card;d.find(".chan-name").text(s),d.find(".chan-name").attr("title",s),d.find(".chan-views").text(l),d.find(".chan-songs").text(c),d.find(".chan-bg").attr("style",r),d.find(".chan-link").attr("href",s),$("#channels").append(d.html())}n+="<option value='"+s+"'> ",a++}document.getElementById("preloader").style.display="none",document.getElementById("searches").innerHTML=n,$("#channels").fadeIn(800),$("#search").focus()},sortFunction:function(e,t){var o=e[0],n=t[0],a=e[4],s=t[4];return n>o?1:o>n?-1:s>a?1:a>s?-1:0},getCookie:function(e){for(var t=e+"=",o=document.cookie.split(";"),n=0;n<o.length;n++){for(var a=o[n];" "==a.charAt(0);)a=a.substring(1);if(0==a.indexOf(t))return a.substring(t.length,a.length)}return""},add_backdrop:function(e,t){(t>=e.length||t>=8)&&(t=0);var n=e[t][1];void 0!==o.blob_list[t]?($("#mega-background").css("opacity",0),$(".room-namer").css("opacity",0),setTimeout(function(){$("#mega-background").css("background","url(data:image/png;base64,"+o.blob_list[t]+")"),$("#mega-background").css("background-size","200%"),$("#mega-background").css("opacity",1),$("#search").attr("placeholder",e[t][3]),$(".room-namer").css("opacity",1)},500)):$.ajax({type:"POST",data:{id:n},url:"/php/imageblob.php",success:function(n){o.blob_list.push(n),$("#mega-background").css("opacity",0),setTimeout(function(){$("#mega-background").css("background","url(data:image/png;base64,"+n+")"),$("#mega-background").css("background-size","200%"),$("#mega-background").css("opacity",1),$("#search").attr("placeholder",e[t][3])},500)}}),setTimeout(function(){o.add_backdrop(e,t+1)},6e3)}};String.prototype.capitalizeFirstLetter=function(){return this.charAt(0).toUpperCase()+this.slice(1)},$(document).ready(function(){"#donation"==window.location.hash&&$("#donation").openModal(),e=$("#channel-list-container").html(),window.list_html=e,$("#channels").empty();var n=io.connect("//"+window.location.hostname+":8880");n.emit("frontpage_lists"),n.on("playlists",function(e){o.populate_channels(e)});var a=0;if(document.getElementById("zicon").addEventListener("click",function(){a+=10,document.getElementById("zicon").style.paddingLeft=a+"%",a>=100&&(window.location.href="https://www.youtube.com/v/0IGsNdVoEh0?autoplay=1&showinfo=0&autohide=1")}),navigator.userAgent.toLowerCase().indexOf("android")>-1&&""==o.getCookie("show_prompt")){var s=confirm("Do you want to download the native app for this webpage?");if(s)window.location.href="https://play.google.com/store/apps/details?id=no.lqasse.zoff";else{var i=new Date;i.setTime(i.getTime()+864e6);var l="expires="+i.toUTCString();document.cookie="show_prompt=false;"+l}}t=$.ajax({type:"GET",url:"https://api.github.com/repos/zoff-music/zoff/commits",async:!1}).responseText,t=$.parseJSON(t),$("#latest-commit").html("Latest Commit: <br>"+t[0].commit.author.date.substring(0,10)+": "+t[0].committer.login+"<br><a href='"+t[0].html_url+"'>"+t[0].sha.substring(0,10)+"</a>: "+t[0].commit.message+"<br")})}();
!function(){var e,t,o={blob_list:[],populate_channels:function(t){var n,a="",s=0;1==t[0][5]&&(n=t.shift()),t.sort(o.sortFunction),void 0!==n&&t.unshift(n),pre_card=$(e),o.add_backdrop(t,0);for(x in t){var i=t[x][3];if(20>s){var l=t[x][1],r=t[x][0],c="background-image:url('https://img.youtube.com/vi/"+l+"/hqdefault.jpg');",d=t[x][4],u=pre_card;1==t[x][5]?(u.find(".pin").attr("style","display:block;"),u.find(".card").attr("title","Pinned!")):(u.find(".pin").attr("style","display:none;"),u.find(".card").attr("title","")),u.find(".chan-name").text(i),u.find(".chan-name").attr("title",i),u.find(".chan-views").text(r),u.find(".chan-songs").text(d),u.find(".chan-bg").attr("style",c),u.find(".chan-link").attr("href",i),$("#channels").append(u.html())}a+="<option value='"+i+"'> ",s++}document.getElementById("preloader").style.display="none",document.getElementById("searches").innerHTML=a,$("#channels").fadeIn(800),$("#search").focus()},sortFunction:function(e,t){var o=e[0],n=t[0],a=e[4],s=t[4];return n>o?1:o>n?-1:s>a?1:a>s?-1:0},getCookie:function(e){for(var t=e+"=",o=document.cookie.split(";"),n=0;n<o.length;n++){for(var a=o[n];" "==a.charAt(0);)a=a.substring(1);if(0==a.indexOf(t))return a.substring(t.length,a.length)}return""},add_backdrop:function(e,t){(t>=e.length||t>=8)&&(t=0);var n=e[t][1];void 0!==o.blob_list[t]?($("#mega-background").css("opacity",0),$(".room-namer").css("opacity",0),setTimeout(function(){$("#mega-background").css("background","url(data:image/png;base64,"+o.blob_list[t]+")"),$("#mega-background").css("background-size","200%"),$("#mega-background").css("opacity",1),$("#search").attr("placeholder",e[t][3]),$(".room-namer").css("opacity",1)},500)):$.ajax({type:"POST",data:{id:n},url:"/php/imageblob.php",success:function(n){o.blob_list.push(n),$("#mega-background").css("opacity",0),setTimeout(function(){$("#mega-background").css("background","url(data:image/png;base64,"+n+")"),$("#mega-background").css("background-size","200%"),$("#mega-background").css("opacity",1),$("#search").attr("placeholder",e[t][3])},500)}}),setTimeout(function(){o.add_backdrop(e,t+1)},6e3)}};String.prototype.capitalizeFirstLetter=function(){return this.charAt(0).toUpperCase()+this.slice(1)},$(document).ready(function(){"#donation"==window.location.hash&&$("#donation").openModal(),e=$("#channel-list-container").html(),window.list_html=e,$("#channels").empty();var n=io.connect("//"+window.location.hostname+":8880");n.emit("frontpage_lists"),n.on("playlists",function(e){o.populate_channels(e)}),window.socket=n;var a=0;if(document.getElementById("zicon").addEventListener("click",function(){a+=10,document.getElementById("zicon").style.paddingLeft=a+"%",a>=100&&(window.location.href="https://www.youtube.com/v/0IGsNdVoEh0?autoplay=1&showinfo=0&autohide=1")}),navigator.userAgent.toLowerCase().indexOf("android")>-1&&""==o.getCookie("show_prompt")){var s=confirm("Do you want to download the native app for this webpage?");if(s)window.location.href="https://play.google.com/store/apps/details?id=no.lqasse.zoff";else{var i=new Date;i.setTime(i.getTime()+864e6);var l="expires="+i.toUTCString();document.cookie="show_prompt=false;"+l}}t=$.ajax({type:"GET",url:"https://api.github.com/repos/zoff-music/zoff/commits",async:!1}).responseText,t=$.parseJSON(t),$("#latest-commit").html("Latest Commit: <br>"+t[0].commit.author.date.substring(0,10)+": "+t[0].committer.login+"<br><a href='"+t[0].html_url+"'>"+t[0].sha.substring(0,10)+"</a>: "+t[0].commit.message+"<br")})}();
Vendored Regular → Executable
View File
Vendored Regular → Executable
View File
Vendored Executable → Regular
+2 -1
View File
File diff suppressed because one or more lines are too long
View File
View File
View File

Before

Width:  |  Height:  |  Size: 322 KiB

After

Width:  |  Height:  |  Size: 322 KiB

View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
Regular → Executable
View File

Before

Width:  |  Height:  |  Size: 786 B

After

Width:  |  Height:  |  Size: 786 B

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 299 B

+20 -10
View File
@@ -1,7 +1,10 @@
var Admin = {
beginning:true,
admin_listener: function()
{
socket.on("toast", function(msg)
{
switch(msg) {
@@ -13,9 +16,7 @@ var Admin = {
break;
case "wrongpass":
msg=Helper.rnd(["That's not the right password!", "Wrong! Better luck next time...", "You seem to have mistyped the password", "Incorrect. Have you tried meditating?","Nope, wrong password!", "Wrong password. The authorities have been notified."])
if(localStorage[chan.toLowerCase()]){
localStorage.removeItem(chan.toLowerCase());
}
Crypt.remove_pass(chan.toLowerCase());
Admin.display_logged_out();
w_p = true;
break;
@@ -64,7 +65,7 @@ var Admin = {
names = ["vote","addsongs","longsongs","frontpage", "allvideos",
"removeplay", "skip", "shuffle"];
localStorage.setItem(chan.toLowerCase(), msg);
Crypt.set_pass(chan.toLowerCase(), Crypt.decrypt_pass(msg))
for (var i = 0; i < names.length; i++) {
$("input[name="+names[i]+"]").attr("disabled", false);
@@ -81,21 +82,30 @@ var Admin = {
socket.on("conf", function(msg)
{
Crypt.init();
Admin.set_conf(msg[0]);
if(Crypt.get_pass(chan.toLowerCase()) !== undefined && Admin.beginning && Crypt.get_pass(chan.toLowerCase()) != ""){
socket.emit("password", [Crypt.crypt_pass(Crypt.get_pass(chan.toLowerCase())), chan.toLowerCase()]);
Admin.beginning = false;
}
});
},
pass_save: function()
{
if(!w_p)
socket.emit('password', [CryptoJS.SHA256(document.getElementById("password").value).toString(), chan.toLowerCase(), localStorage[chan.toLowerCase()]]);
{
socket.emit('password', [Crypt.crypt_pass(CryptoJS.SHA256(document.getElementById("password").value).toString()), chan.toLowerCase(), Crypt.crypt_pass(Crypt.get_pass(chan.toLowerCase()))]);
}
else
socket.emit('password', [CryptoJS.SHA256(document.getElementById("password").value).toString(), chan.toLowerCase()]);
{
socket.emit('password', [Crypt.crypt_pass(CryptoJS.SHA256(document.getElementById("password").value).toString()), chan.toLowerCase()]);
}
},
log_out: function(){
if(localStorage[chan.toLowerCase()]){
localStorage.removeItem(chan.toLowerCase());
if(Crypt.get_pass(chan.toLowerCase())){
Crypt.remove_pass(chan.toLowerCase());
Admin.display_logged_out();
Materialize.toast("Logged out", 4000);
}else{
@@ -151,9 +161,9 @@ var Admin = {
$("input[name="+names[i]+"]").attr("disabled", hasadmin);
}
if((hasadmin && !localStorage[chan.toLowerCase()])){
if((hasadmin)){
Admin.display_logged_out();
}else if(!hasadmin && !localStorage[chan.toLowerCase()]){
}else if(!hasadmin && Crypt.get_pass(chan.toLowerCase()) === undefined){
$("#password").attr("placeholder", "Create channel password");
}
+141
View File
@@ -0,0 +1,141 @@
var Crypt = {
conf_arr: {},
init: function(){
try{
conf_arr = Crypt.decrypt(Crypt.getCookie("_opt"), "_opt");
conf_pass = Crypt.decrypt(Crypt.getCookie(chan.toLowerCase()), chan.toLowerCase());
}catch(err){
console.log("err")
conf_arr = Crypt.decrypt(Crypt.create_cookie("_opt"), "_opt");
conf_pass = Crypt.decrypt(Crypt.create_cookie(chan.toLowerCase()), chan.toLowerCase());
}
Hostcontroller.change_enabled(conf_arr.remote);
},
decrypt: function(cookie, name){
if(Crypt.getCookie(name) === undefined) {
cookie = Crypt.create_cookie(name);
}
var decrypted = CryptoJS.AES.decrypt(
cookie,navigator.userAgent+navigator.languages,
{
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7
}
);
return $.parseJSON(decrypted.toString(CryptoJS.enc.Utf8));
},
decrypt_pass: function(pass){
var decrypted = CryptoJS.AES.decrypt(
pass,socket.io.engine.id,
{
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7
}
);
return decrypted.toString(CryptoJS.enc.Utf8);
},
encrypt: function(json_formated, cookie){
var to_encrypt = JSON.stringify(json_formated);
var encrypted = CryptoJS.AES.encrypt(
to_encrypt,
navigator.userAgent+navigator.languages,
{
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7
}
);
var CookieDate = new Date;
CookieDate.setFullYear(CookieDate.getFullYear( ) +1);
if(cookie != "_opt") add = chan.toLowerCase()+";";
else add = ";"
document.cookie = cookie+"="+encrypted.toString()+";expires="+CookieDate.toGMTString()+";path=/"+add
},
get_volume: function(){
return Crypt.decrypt(Crypt.getCookie("_opt"), "_opt").volume;
//return conf_arr.volume;
},
set_volume: function(val){
conf_arr.volume = val;
Crypt.encrypt(conf_arr, "_opt");
},
create_cookie: function(name){
if(name == "_opt") cookie_object = {volume: 100, width: 100, remote: true};
else cookie_object = {passwords: {}};
var string_it = JSON.stringify(cookie_object);
var encrypted = CryptoJS.AES.encrypt(
string_it,
navigator.userAgent+navigator.languages,
{
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7
}
);
var CookieDate = new Date;
CookieDate.setFullYear(CookieDate.getFullYear( ) +1);
if(name != "_opt") add = chan.toLowerCase();
else add = ";"
document.cookie = name+"="+encrypted.toString()+";expires="+CookieDate.toGMTString()+";path=/"+add
//document.cookie = name+"="+encrypted.toString()+";expires="+CookieDate.toGMTString()+";path=/;"
//document.cookie = na"="+encrypted.toString()+";expires="+CookieDate.toGMTString()+";path=/;"
return Crypt.getCookie(name);
},
set_pass: function(chan, pass){
conf_pass.passwords[chan] = pass;
Crypt.encrypt(conf_pass, chan);
},
remove_pass:function(chan){
delete conf_pass.passwords[chan];
Crypt.encrypt(conf_pass, chan.toLowerCase());
},
get_pass: function(chan){
return conf_pass.passwords[chan];
},
set_remote: function(val){
conf_arr.remote = val;
Crypt.encrypt(conf_arr, "_opt");
},
get_remote: function(val){
return conf_arr.remote;
},
crypt_pass: function(pass){
var encrypted = CryptoJS.AES.encrypt(
pass,
socket.io.engine.id,
{
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7
}
);
return encrypted.toString();
},
getCookie: function(name) {
var value = "; " + document.cookie;
var parts = value.split("; " + name + "=");
if (parts.length == 2) return parts.pop().split(";").shift();
}
}
+19 -6
View File
@@ -1,5 +1,7 @@
var Hostcontroller = {
enabled: true,
host_listener: function() {
var old_id;
@@ -22,14 +24,13 @@ var Hostcontroller = {
began = true;
socket.on(id, function(arr)
{
if(arr[0] == "volume")
{
if(enabled){
if(arr[0] == "volume"){
$("#volume").slider("value", arr[1]);
ytplayer.setVolume(arr[1]);
localStorage.setItem("volume", arr[1]);
Playercontrols.choose_button(arr[1], false);
}else if(arr[0] == "channel")
{
}else if(arr[0] == "channel"){
socket.emit("change_channel");
chan = arr[1].toLowerCase();
@@ -38,8 +39,7 @@ var Hostcontroller = {
w_p = true;
socket.emit("list", chan.toLowerCase());
if(localStorage[chan.toLowerCase()])
{
if(localStorage[chan.toLowerCase()]){
//localStorage.removeItem(chan.toLowerCase());
if(localStorage[chan.toLowerCase()].length != 64)
localStorage.removeItem(chan.toLowerCase());
@@ -54,8 +54,21 @@ var Hostcontroller = {
ytplayer.playVideo();
else if(arr[0] == "skip")
List.skip();
}
});
}
});
$('input[class=remote_switch_class]').change(function()
{
enabled = document.getElementsByName("remote_switch")[0].checked;
Crypt.set_remote(enabled);
});
},
change_enabled:function(val){
enabled = val;
document.getElementsByName("remote_switch")[0].checked = enabled;
}
}
+15 -9
View File
@@ -68,18 +68,24 @@ var List = {
},
deleted_song: function(deleted){
var index = List.getIndexOfSong(deleted);
var to_delete = $("#wrapper").children()[index];
to_delete.style.height = 0;
try{
to_delete.style.height = 0;
setTimeout(function()
{
$("#"+deleted).remove();
setTimeout(function()
{
$("#"+deleted).remove();
full_playlist.splice(List.getIndexOfSong(deleted), 1);
}, 305);
document.getElementById('wrapper').scrollTop += 1;
document.getElementById('wrapper').scrollTop += -1;
}catch(err){
full_playlist.splice(List.getIndexOfSong(deleted), 1);
}, 305);
document.getElementById('wrapper').scrollTop += 1;
document.getElementById('wrapper').scrollTop += -1;
$("#wrapper").children()[$("#wrapper").children().length-1].remove();
}
},
voted_song: function(voted, time){
@@ -117,7 +123,7 @@ var List = {
},
skip: function(){
socket.emit('skip', [chan, localStorage[chan.toLowerCase()]]);
socket.emit('skip', [chan, adminpass]);
return true;
},
+11 -3
View File
@@ -43,7 +43,9 @@ var connection_options = {
'sync disconnect on unload':true
};
var socket = io.connect('http://'+window.location.hostname+':8880', connection_options);
if(window.location.hostname == "zoff.no") add = "dev.zoff.no";
else add = "localhost";
var socket = io.connect('http://'+add+':8880', connection_options);
socket.on("get_list", function(){
socket.emit('list', chan.toLowerCase());
});
@@ -71,17 +73,23 @@ $(document).ready(function()
});
//awdwad
$(".video-container").resizable({
start: function(event, ui) {
$('iframe').css('pointer-events','none');
},
stop: function(event, ui) {
$('iframe').css('pointer-events','auto');
},
handles: "e",
minWidth: 350
});
/*
if(localStorage[chan.toLowerCase()])
{
if(localStorage[chan.toLowerCase()].length != 64)
localStorage.removeItem(chan.toLowerCase());
else
socket.emit("password", [localStorage[chan.toLowerCase()], chan.toLowerCase()]);
}
}*/
if(window.mobilecheck()){
document.getElementById("search").blur();
+21 -2
View File
@@ -22,8 +22,14 @@ var Nochan = {
{
var output = "";
var num = 0;
var pinned;
if(lists[0][5] == 1){
pinned = lists.shift();
}
lists.sort(Nochan.sortFunction);
if(pinned !== undefined){
lists.unshift(pinned);
}
pre_card = $(list_html);
Nochan.add_backdrop(lists, 0);
@@ -42,6 +48,17 @@ var Nochan = {
//$("#channels").append(list_html);
var card = pre_card;
if(lists[x][5] == 1)
{
card.find(".pin").attr("style", "display:block;");
card.find(".card").attr("title", "Pinned!");
}
else
{
card.find(".pin").attr("style", "display:none;");
card.find(".card").attr("title", "");
}
card.find(".chan-name").text(chan);
card.find(".chan-name").attr("title", chan);
card.find(".chan-views").text(viewers);
@@ -158,7 +175,9 @@ $(document).ready(function (){
socket.emit('frontpage_lists');
socket.on('playlists', function(msg){
Nochan.populate_channels(msg);
})
});
window.socket = socket;
var pad = 0;
document.getElementById("zicon").addEventListener("click", function(){
+11 -7
View File
@@ -17,10 +17,12 @@ var Playercontrols = {
{
if(localStorage.volume)
{
vol = localStorage.getItem("volume");
//vol = localStorage.getItem("volume");
vol = (Crypt.get_volume());
}else{
vol = 100;
localStorage.setItem("volume", vol);
//localStorage.setItem("volume", vol);
Crypt.set_volume(vol);
}
$("#volume").slider({
min: 0,
@@ -29,11 +31,13 @@ var Playercontrols = {
range: "min",
animate: true,
slide: function(event, ui) {
Playercontrols.setVolume(ui.value);
localStorage.setItem("volume", ui.value);
Playercontrols.setVolume(ui.value);
//localStorage.setItem("volume", ui.value);
Crypt.set_volume(ui.value);
}
});
Playercontrols.choose_button(vol, false);
Playercontrols.choose_button(vol, false);
//$("#volume").slider("value", ytplayer.getVolume());
},
@@ -88,13 +92,13 @@ var Playercontrols = {
setVolume: function(vol)
{
ytplayer.setVolume(vol);
Playercontrols.choose_button(vol, false);
Playercontrols.choose_button(vol, false);
if(ytplayer.isMuted())
ytplayer.unMute();
},
choose_button: function(vol, mute)
{
{
if(!mute){
if(vol >= 0 && vol <= 33){
if(document.getElementById("v-full").className.split(" ").length == 1)
+1 -1
View File
@@ -130,7 +130,7 @@ var Youtube = {
Youtube.readyLooks();
Playercontrols.initYoutubeControls(ytplayer);
Playercontrols.initSlider();
ytplayer.setVolume(localStorage.getItem("volume"));
ytplayer.setVolume(Crypt.get_volume());
},
readyLooks: function()