mirror of
https://github.com/KevinMidboe/zoff.git
synced 2026-02-14 21:39:33 +00:00
Removed some old functions and indented code
This commit is contained in:
2
server/public/assets/dist/embed.min.js
vendored
2
server/public/assets/dist/embed.min.js
vendored
File diff suppressed because one or more lines are too long
2
server/public/assets/dist/main.min.js
vendored
2
server/public/assets/dist/main.min.js
vendored
File diff suppressed because one or more lines are too long
2
server/public/assets/dist/remote.min.js
vendored
2
server/public/assets/dist/remote.min.js
vendored
@@ -1 +1 @@
|
||||
!function(){var e=!0;mobilecheck=function(){var e=!1;return function(o){(/(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(o)||/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(o.substr(0,4)))&&(e=!0)}(navigator.userAgent||navigator.vendor||window.opera),e},$(document).ready(function(){document.title="Zoff Remote",setTimeout(function(){$("#search").focus()},500);var e={"sync disconnect on unload":!0,secure:!0};$("#about").modal(),$("#contact").modal(),"remote.zoff.me"==window.location.hostname?add="https://zoff.me":add="localhost",socket=io.connect(add+":8080",e),socket.on("update_required",function(){window.location.reload(!0)}),id=window.location.pathname.split("/")[1],id&&(id=id.toLowerCase(),o.control())}),$(document).on("click","#playbutton",function(){socket.emit("id",{id:id,type:"play",value:"mock"})}),$(document).on("click","#pausebutton",function(){socket.emit("id",{id:id,type:"pause",value:"mock"})}),$(document).on("click","#skipbutton",function(){socket.emit("id",{id:id,type:"skip",value:"mock"})}),$(document).on("submit","#remoteform",function(e){e.preventDefault(),o.control()});var o={control:function(){e?(id||(id=document.getElementById("remoteform").chan.value,window.history.pushState("object or string","Title","/"+id)),document.getElementById("remoteform").chan.value="",e=!1,$(".rc").css("display","block"),$("#remote-text").text("Controlling "+id.toUpperCase()),document.getElementById("search").setAttribute("length","18"),document.getElementById("search").setAttribute("maxlength","18"),$("#forsearch").html("Type new channel name to change to"),$("#volume-control").slider({min:0,max:100,value:100,range:"min",animate:!0,stop:function(e,o){socket.emit("id",{id:id,type:"volume",value:o.value})}})):(socket.emit("id",{id:id,type:"channel",value:$("#search").val().toLowerCase()}),$("#search").val(""))}}}();
|
||||
!function(){var e=!0;mobilecheck=function(){var e=!1;return function(t){(/(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(t)||/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(t.substr(0,4)))&&(e=!0)}(navigator.userAgent||navigator.vendor||window.opera),e},$(document).ready(function(){document.title="Zoff Remote",setTimeout(function(){$("#search").focus()},500);var e={"sync disconnect on unload":!0,secure:!0};$("#about").modal(),$("#contact").modal(),"remote.zoff.me"==window.location.hostname?add="https://zoff.me":add="localhost",socket=io.connect(add+":8080",e),socket.on("update_required",function(){window.location.reload(!0)}),id=window.location.pathname.split("/")[1],id&&(id=id.toLowerCase(),t.control())}),$(document).on("click","#playbutton",function(){socket.emit("id",{id:id,type:"play",value:"mock"})}),$(document).on("click","#pausebutton",function(){socket.emit("id",{id:id,type:"pause",value:"mock"})}),$(document).on("click","#skipbutton",function(){socket.emit("id",{id:id,type:"skip",value:"mock"})}),$(document).on("submit","#remoteform",function(e){e.preventDefault(),t.control()});var t={control:function(){e?(id||(id=document.getElementById("remoteform").chan.value,window.history.pushState("object or string","Title","/"+id)),document.getElementById("remoteform").chan.value="",e=!1,$(".rc").css("display","block"),$("#remote-text").text("Controlling "+id.toUpperCase()),document.getElementById("search").setAttribute("length","18"),document.getElementById("search").setAttribute("maxlength","18"),$("#forsearch").html("Type new channel name to change to"),$("#volume-control").slider({min:0,max:100,value:100,range:"min",animate:!0,stop:function(e,t){socket.emit("id",{id:id,type:"volume",value:t.value})}})):(socket.emit("id",{id:id,type:"channel",value:$("#search").val().toLowerCase()}),$("#search").val(""))}}}();
|
||||
@@ -2,8 +2,7 @@ var Admin = {
|
||||
|
||||
beginning:true,
|
||||
|
||||
toast: function(msg)
|
||||
{
|
||||
toast: function(msg) {
|
||||
switch(msg) {
|
||||
case "suggested_thumbnail":
|
||||
msg = "The thumbnail has been suggested!";
|
||||
@@ -158,8 +157,7 @@ var Admin = {
|
||||
$('ul.playlist-tabs-loggedIn').tabs('select_tab', $(".playlist-tabs li a.active").attr("href").substring(1));
|
||||
},
|
||||
|
||||
conf: function(msg)
|
||||
{
|
||||
conf: function(msg) {
|
||||
if(msg[0].adminpass == ""){
|
||||
Crypt.remove_pass(chan.toLowerCase());
|
||||
}
|
||||
@@ -170,31 +168,26 @@ var Admin = {
|
||||
}
|
||||
},
|
||||
|
||||
pass_save: function()
|
||||
{
|
||||
if(!w_p)
|
||||
{
|
||||
pass_save: function() {
|
||||
if(!w_p) {
|
||||
socket.emit('password', {password: Crypt.crypt_pass(CryptoJS.SHA256(document.getElementById("password").value).toString()), channel: chan.toLowerCase(), oldpass: Crypt.crypt_pass(Crypt.get_pass(chan.toLowerCase()))});
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
socket.emit('password', {password: Crypt.crypt_pass(CryptoJS.SHA256(document.getElementById("password").value).toString()), channel: chan.toLowerCase()});
|
||||
}
|
||||
},
|
||||
|
||||
log_out: function(){
|
||||
log_out: function() {
|
||||
before_toast();
|
||||
if(Crypt.get_pass(chan.toLowerCase())){
|
||||
if(Crypt.get_pass(chan.toLowerCase())) {
|
||||
Crypt.remove_pass(chan.toLowerCase());
|
||||
Admin.display_logged_out();
|
||||
Materialize.toast("Logged out", 4000);
|
||||
}else{
|
||||
} else {
|
||||
Materialize.toast("Not logged in", 4000);
|
||||
}
|
||||
},
|
||||
|
||||
display_logged_out: function()
|
||||
{
|
||||
display_logged_out: function() {
|
||||
w_p = true;
|
||||
adminpass = "";
|
||||
names = ["vote","addsongs","longsongs","frontpage", "allvideos",
|
||||
@@ -207,10 +200,10 @@ var Admin = {
|
||||
$("input[name="+names[i]+"]").attr("disabled", true);
|
||||
}
|
||||
|
||||
if($("#admin-lock").html() != "lock"){
|
||||
if($("#admin-lock").html() != "lock") {
|
||||
$("#admin-lock").removeClass("clickable");
|
||||
$("#admin-lock").html("lock");
|
||||
if(!Helper.mobilecheck()){
|
||||
if(!Helper.mobilecheck()) {
|
||||
$('#admin-lock').tooltip('remove');
|
||||
}
|
||||
}
|
||||
@@ -231,18 +224,13 @@ var Admin = {
|
||||
$(".change_user_pass").addClass("hide");
|
||||
}
|
||||
|
||||
if(!Helper.contains($(".playlist-tabs-loggedIn").attr("class").split(" "), "hide")){
|
||||
if(!Helper.contains($(".playlist-tabs-loggedIn").attr("class").split(" "), "hide")) {
|
||||
$(".playlist-tabs-loggedIn").addClass("hide");
|
||||
$(".playlist-tabs").removeClass("hide");
|
||||
}
|
||||
|
||||
List.dragging(false);
|
||||
|
||||
/*if($(".card-action").length !== 0 &&
|
||||
!Helper.contains($(".card-action").attr("class").split(" "), "hide") && !offline){
|
||||
$(".card-action").addClass("hide");
|
||||
}*/
|
||||
|
||||
if($("ul.playlist-tabs-loggedIn .playlist-tab-links.active").attr("href") == "#suggestions")
|
||||
{
|
||||
$('ul.playlist-tabs').tabs('select_tab', 'wrapper');
|
||||
@@ -254,12 +242,11 @@ var Admin = {
|
||||
$("#password").attr("placeholder", "Enter admin password");
|
||||
},
|
||||
|
||||
save: function(userpass){
|
||||
save: function(userpass) {
|
||||
Admin.submitAdmin(document.getElementById("adminForm").elements, userpass);
|
||||
},
|
||||
|
||||
set_conf: function(conf_array)
|
||||
{
|
||||
set_conf: function(conf_array) {
|
||||
music = conf_array.allvideos;
|
||||
longsongs = conf_array.longsongs;
|
||||
names = ["vote","addsongs","longsongs","frontpage", "allvideos",
|
||||
@@ -268,22 +255,21 @@ var Admin = {
|
||||
|
||||
if(conf_array.adminpass === "" || !w_p){
|
||||
hasadmin = false;
|
||||
if(!Helper.mobilecheck()){
|
||||
if(!Helper.mobilecheck()) {
|
||||
//$(".playlist-tabs").removeClass("hide");
|
||||
//$("#wrapper").toggleClass("tabs_height");
|
||||
}
|
||||
}
|
||||
else hasadmin = true;
|
||||
|
||||
for (var i = 0; i < names.length; i++)
|
||||
{
|
||||
for (var i = 0; i < names.length; i++) {
|
||||
document.getElementsByName(names[i])[0].checked = (conf_array[names[i]] === true);
|
||||
$("input[name="+names[i]+"]").attr("disabled", hasadmin);
|
||||
}
|
||||
|
||||
if((hasadmin)){
|
||||
if((hasadmin)) {
|
||||
if($("#admin-lock").html() != "lock") Admin.display_logged_out();
|
||||
}else if(!hasadmin && Crypt.get_pass(chan.toLowerCase()) === undefined){
|
||||
} else if(!hasadmin && Crypt.get_pass(chan.toLowerCase()) === undefined) {
|
||||
if(!Helper.contains($(".playlist-tabs").attr("class").split(" "), "hide")) {
|
||||
$(".playlist-tabs-loggedIn").removeClass("hide");
|
||||
$(".playlist-tabs").addClass("hide");
|
||||
@@ -300,18 +286,17 @@ var Admin = {
|
||||
Crypt.remove_userpass(chan.toLowerCase());
|
||||
}
|
||||
|
||||
if(conf_array.thumbnail != undefined && conf_array.thumbnail != ""){
|
||||
if(conf_array.thumbnail != undefined && conf_array.thumbnail != "") {
|
||||
$("#thumbnail_image").html("<img id='thumbnail_image_channel' src='" + conf_array.thumbnail + "' alt='thumbnail' />");
|
||||
}
|
||||
|
||||
if(conf_array.description != undefined && conf_array.description != ""){
|
||||
if(conf_array.description != undefined && conf_array.description != "") {
|
||||
$("#description_area").html(conf_array.description);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
submitAdmin: function(form, userpass_changed)
|
||||
{
|
||||
submitAdmin: function(form, userpass_changed) {
|
||||
voting = form.vote.checked;
|
||||
addsongs = form.addsongs.checked;
|
||||
longsongs = form.longsongs.checked;
|
||||
@@ -340,13 +325,12 @@ var Admin = {
|
||||
socket.emit("conf", configs);
|
||||
},
|
||||
|
||||
hide_settings: function(){
|
||||
hide_settings: function() {
|
||||
$('#settings').sideNav('hide');
|
||||
},
|
||||
|
||||
shuffle: function()
|
||||
{
|
||||
if(!offline){
|
||||
shuffle: function() {
|
||||
if(!offline) {
|
||||
socket.emit('shuffle', {adminpass: adminpass !== undefined ? Crypt.crypt_pass(adminpass) : "", channel: chan.toLowerCase(), pass: embed ? '' : Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()))});
|
||||
} else {
|
||||
for(var x = 0; x < full_playlist.length; x++){
|
||||
@@ -358,8 +342,7 @@ var Admin = {
|
||||
}
|
||||
},
|
||||
|
||||
get_admin:function()
|
||||
{
|
||||
get_admin:function() {
|
||||
return [w_p, hasadmin];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
window.addEventListener("load", function(){
|
||||
window.addEventListener("load", function() {
|
||||
var query = getQueryHash(window.location.hash);
|
||||
var redirect = window.location.protocol + "//" + window.location.hostname + "/o_callback";
|
||||
var client_id;
|
||||
var response;
|
||||
var scope;
|
||||
|
||||
if(query.spotify){
|
||||
if(query.spotify) {
|
||||
client_id = "b934ecdd173648f5bcd38738af529d58";
|
||||
response = "token";
|
||||
scope = "playlist-read-private playlist-read-collaborative user-read-private playlist-modify-public";
|
||||
@@ -26,7 +26,7 @@ window.addEventListener("load", function(){
|
||||
}
|
||||
});
|
||||
|
||||
function getQueryHash(url){
|
||||
function getQueryHash(url) {
|
||||
var temp_arr = url.substring(1).split("&");
|
||||
var done_obj = {};
|
||||
var splitted;
|
||||
|
||||
@@ -4,33 +4,31 @@ var Chat = {
|
||||
all_received: 0,
|
||||
chat_help: [/*"/name <new name> to change name", "/removename to remove name"*/ "There are no commands.. As of now!"],
|
||||
|
||||
namechange: function(newName)
|
||||
{
|
||||
namechange: function(newName) {
|
||||
socket.emit("namechange", {name: newName, channel: chan.toLowerCase()});
|
||||
Crypt.set_name(newName);
|
||||
},
|
||||
|
||||
removename: function()
|
||||
{
|
||||
removename: function() {
|
||||
socket.emit("removename");
|
||||
Crypt.remove_name();
|
||||
},
|
||||
|
||||
chat: function(data)
|
||||
{
|
||||
chat: function(data) {
|
||||
if(data.value.length > 150)
|
||||
return;
|
||||
/*if(data.value.startsWith("/name ")){
|
||||
Chat.namechange(data.value.substring(6));
|
||||
} else */ if(data.value.startsWith("/help")){
|
||||
} else */
|
||||
if(data.value.startsWith("/help")) {
|
||||
if($(".chat-tab-li a.active").attr("href") == "#all_chat"){
|
||||
if($("#chatall").children().length > 100){
|
||||
if($("#chatall").children().length > 100) {
|
||||
$("#chatall").children()[0].remove()
|
||||
}
|
||||
for(var x = 0; x < Chat.chat_help.length; x++){
|
||||
for(var x = 0; x < Chat.chat_help.length; x++) {
|
||||
var color = Helper.intToARGB(Helper.hashCode("System"));
|
||||
if(color.length < 6) {
|
||||
for(x = color.length; x < 6; x++){
|
||||
for(x = color.length; x < 6; x++) {
|
||||
color = "0" + color;
|
||||
}
|
||||
}
|
||||
@@ -42,14 +40,14 @@ var Chat = {
|
||||
document.getElementById("chatall").scrollTop = document.getElementById("chatall").scrollHeight;
|
||||
}
|
||||
} else {
|
||||
if($("#chatchannel").children().length > 100){
|
||||
if($("#chatchannel").children().length > 100) {
|
||||
$("#chatchannel").children()[0].remove()
|
||||
}
|
||||
for(var x = 0; x < Chat.chat_help.length; x++){
|
||||
for(var x = 0; x < Chat.chat_help.length; x++) {
|
||||
|
||||
var color = Helper.intToARGB(Helper.hashCode("System"));
|
||||
if(color.length < 6) {
|
||||
for(x = color.length; x < 6; x++){
|
||||
for(x = color.length; x < 6; x++) {
|
||||
color = "0" + color;
|
||||
}
|
||||
}
|
||||
@@ -60,26 +58,20 @@ var Chat = {
|
||||
$("#chatchannel li:last")[0].appendChild(in_text);
|
||||
document.getElementById("chatchannel").scrollTop = document.getElementById("chatchannel").scrollHeight;
|
||||
}
|
||||
|
||||
}
|
||||
} else if(data.value.startsWith("/removename")){
|
||||
} else if(data.value.startsWith("/removename")) {
|
||||
Chat.removename();
|
||||
} else if($(".chat-tab-li a.active").attr("href") == "#all_chat"){
|
||||
} else if($(".chat-tab-li a.active").attr("href") == "#all_chat") {
|
||||
socket.emit("all,chat", {channel: chan.toLowerCase(), data: data.value});
|
||||
} else {
|
||||
socket.emit("chat", {channel: chan.toLowerCase(), data: data.value, pass: embed ? '' : Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()))});
|
||||
}
|
||||
data.value = "";
|
||||
|
||||
return;
|
||||
},
|
||||
|
||||
allchat: function(inp)
|
||||
{
|
||||
//$("#chat-btn").css("color", "grey");
|
||||
|
||||
if(inp.msg.substring(0,1) == ":" && !chat_active)
|
||||
{
|
||||
allchat: function(inp) {
|
||||
if(inp.msg.substring(0,1) == ":" && !chat_active) {
|
||||
Chat.all_received += 1;
|
||||
$("#favicon").attr("href", "/assets/images/highlogo.png");
|
||||
unseen = true;
|
||||
@@ -89,16 +81,13 @@ var Chat = {
|
||||
}
|
||||
var to_display = Chat.channel_received + Chat.all_received > 9 ? "9+" : Chat.channel_received + Chat.all_received;
|
||||
$(".chat-link span.badge.new.white").html(to_display);
|
||||
//if(!blinking) Chat.chat_blink();
|
||||
//blink_interval = setTimeout(Chat.chat_blink, 2000);
|
||||
}
|
||||
|
||||
if(document.hidden)
|
||||
{
|
||||
if(document.hidden) {
|
||||
$("#favicon").attr("href", "/assets/images/highlogo.png");
|
||||
}
|
||||
|
||||
if($("#chatall").children().length > 100){
|
||||
if($("#chatall").children().length > 100) {
|
||||
$("#chatall").children()[0].remove()
|
||||
}
|
||||
var color = Helper.intToARGB(Helper.hashCode(inp.from));
|
||||
@@ -115,29 +104,27 @@ var Chat = {
|
||||
document.getElementById("chatall").scrollTop = document.getElementById("chatall").scrollHeight;
|
||||
},
|
||||
|
||||
channelchat: function(data)
|
||||
{
|
||||
if(data.msg.substring(0,1) == ":" && !chat_active)
|
||||
{
|
||||
channelchat: function(data) {
|
||||
if(data.msg.substring(0,1) == ":" && !chat_active) {
|
||||
$("#favicon").attr("href", "/assets/images/highlogo.png");
|
||||
unseen = true;
|
||||
chat_unseen = true;
|
||||
Chat.channel_received += 1;
|
||||
//blink_interval = setTimeout(Chat.chat_blink, 1000);
|
||||
if($(".chat-link span.badge.new.white").hasClass("hide")){
|
||||
if($(".chat-link span.badge.new.white").hasClass("hide")) {
|
||||
$(".chat-link span.badge.new.white").removeClass("hide");
|
||||
}
|
||||
var to_display = Chat.channel_received + Chat.all_received > 9 ? "9+" : Chat.channel_received + Chat.all_received;
|
||||
$(".chat-link span.badge.new.white").html(to_display);
|
||||
}
|
||||
|
||||
if($("#chatchannel").children().length > 100){
|
||||
if($("#chatchannel").children().length > 100) {
|
||||
$("#chatchannel").children()[0].remove()
|
||||
}
|
||||
|
||||
var color = Helper.intToARGB(Helper.hashCode(data.from));
|
||||
if(color.length < 6) {
|
||||
for(x = color.length; x < 6; x++){
|
||||
for(x = color.length; x < 6; x++) {
|
||||
color = "0" + color;
|
||||
}
|
||||
}
|
||||
@@ -159,5 +146,4 @@ var Chat = {
|
||||
}, 1000);
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -4,26 +4,26 @@ var Crypt = {
|
||||
user_pass: undefined,
|
||||
tmp_pass: "",
|
||||
|
||||
init: function(){
|
||||
init: function() {
|
||||
|
||||
if(window.location.pathname != "/"){
|
||||
if (location.protocol != "https:"){
|
||||
if(window.location.pathname != "/") {
|
||||
if (location.protocol != "https:") {
|
||||
document.cookie = chan.toLowerCase() + '=;path=/' + chan.toLowerCase() + ';expires=' + new Date(0).toUTCString();
|
||||
} else {
|
||||
document.cookie = chan.toLowerCase() + '=;path=/' + chan.toLowerCase() + ';secure;expires=' + new Date(0).toUTCString();
|
||||
}
|
||||
}
|
||||
|
||||
try{
|
||||
try {
|
||||
conf_arr = Crypt.decrypt(Crypt.getCookie("_opt"), "_opt");
|
||||
}catch(err){
|
||||
} catch(err) {
|
||||
conf_arr = Crypt.decrypt(Crypt.create_cookie("_opt"), "_opt");
|
||||
}
|
||||
|
||||
if(window.location.pathname != "/"){
|
||||
try{
|
||||
if(window.location.pathname != "/") {
|
||||
try {
|
||||
Crypt.conf_pass = Crypt.decrypt(Crypt.getCookie(chan.toLowerCase()), chan.toLowerCase());
|
||||
}catch(err){
|
||||
} catch(err) {
|
||||
Crypt.conf_pass = Crypt.decrypt(Crypt.create_cookie(chan.toLowerCase()), chan.toLowerCase());
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ var Crypt = {
|
||||
}
|
||||
},
|
||||
|
||||
decrypt: function(cookie, name){
|
||||
decrypt: function(cookie, name) {
|
||||
if(Crypt.getCookie(name) === undefined) {
|
||||
cookie = Crypt.create_cookie(name);
|
||||
}
|
||||
@@ -51,7 +51,7 @@ var Crypt = {
|
||||
return $.parseJSON(decrypted.toString(CryptoJS.enc.Utf8));
|
||||
},
|
||||
|
||||
decrypt_pass: function(pass){
|
||||
decrypt_pass: function(pass) {
|
||||
var key = btoa(socket.id) + btoa(socket.id);
|
||||
key = key.substring(0,32);
|
||||
key = btoa(key);
|
||||
@@ -62,11 +62,10 @@ var Crypt = {
|
||||
padding: CryptoJS.pad.Pkcs7
|
||||
}
|
||||
);
|
||||
|
||||
return decrypted.toString(CryptoJS.enc.Utf8);
|
||||
},
|
||||
|
||||
encrypt: function(json_formated, cookie){
|
||||
encrypt: function(json_formated, cookie) {
|
||||
var to_encrypt = JSON.stringify(json_formated);
|
||||
var key = btoa("0103060703080703080701") + btoa("0103060703080703080701");
|
||||
key = key.substring(0,32);
|
||||
@@ -89,12 +88,12 @@ var Crypt = {
|
||||
}
|
||||
},
|
||||
|
||||
get_volume: function(){
|
||||
get_volume: function() {
|
||||
return Crypt.decrypt(Crypt.getCookie("_opt"), "_opt").volume;
|
||||
//return conf_arr.volume;
|
||||
},
|
||||
|
||||
get_offline: function(){
|
||||
get_offline: function() {
|
||||
var temp_offline = Crypt.decrypt(Crypt.getCookie("_opt"), "_opt").offline;
|
||||
if(temp_offline != undefined){
|
||||
return Crypt.decrypt(Crypt.getCookie("_opt"), "_opt").offline;
|
||||
@@ -104,12 +103,12 @@ var Crypt = {
|
||||
}
|
||||
},
|
||||
|
||||
set_volume: function(val){
|
||||
set_volume: function(val) {
|
||||
conf_arr.volume = val;
|
||||
Crypt.encrypt(conf_arr, "_opt");
|
||||
},
|
||||
|
||||
create_cookie: function(name){
|
||||
create_cookie: function(name) {
|
||||
if(name == "_opt") cookie_object = {volume: 100, width: 100, remote: true, name: "", offline: false};
|
||||
else cookie_object = {passwords: {}};
|
||||
|
||||
@@ -139,12 +138,12 @@ var Crypt = {
|
||||
return Crypt.getCookie(name);
|
||||
},
|
||||
|
||||
set_pass: function(chan, pass){
|
||||
set_pass: function(chan, pass) {
|
||||
Crypt.conf_pass.passwords[chan] = pass;
|
||||
Crypt.encrypt(Crypt.conf_pass, chan);
|
||||
},
|
||||
|
||||
remove_pass:function(chan){
|
||||
remove_pass:function(chan) {
|
||||
delete Crypt.conf_pass.passwords[chan];
|
||||
Crypt.encrypt(Crypt.conf_pass, chan.toLowerCase());
|
||||
},
|
||||
@@ -154,27 +153,27 @@ var Crypt = {
|
||||
Crypt.encrypt(Crypt.conf_pass, chan);
|
||||
},
|
||||
|
||||
remove_userpass:function(chan){
|
||||
remove_userpass:function(chan) {
|
||||
delete Crypt.conf_pass.passwords["userpass"];
|
||||
Crypt.encrypt(Crypt.conf_pass, chan.toLowerCase());
|
||||
},
|
||||
|
||||
set_name:function(name){
|
||||
set_name:function(name) {
|
||||
conf_arr.name = encodeURIComponent(name).replace(/\W/g, '');
|
||||
Crypt.encrypt(conf_arr, "_opt");
|
||||
},
|
||||
|
||||
set_offline: function(enabled){
|
||||
set_offline: function(enabled) {
|
||||
conf_arr.offline = enabled;
|
||||
Crypt.encrypt(conf_arr, "_opt");
|
||||
},
|
||||
|
||||
remove_name:function(){
|
||||
remove_name:function() {
|
||||
conf_arr.name = "";
|
||||
Crypt.encrypt(conf_arr, "_opt");
|
||||
},
|
||||
|
||||
get_pass: function(chan){
|
||||
get_pass: function(chan) {
|
||||
if(Crypt.conf_pass !== undefined) return Crypt.conf_pass.passwords[chan];
|
||||
return undefined;
|
||||
},
|
||||
@@ -184,16 +183,16 @@ var Crypt = {
|
||||
return "";
|
||||
},
|
||||
|
||||
set_remote: function(val){
|
||||
set_remote: function(val) {
|
||||
conf_arr.remote = val;
|
||||
Crypt.encrypt(conf_arr, "_opt");
|
||||
},
|
||||
|
||||
get_remote: function(val){
|
||||
get_remote: function(val) {
|
||||
return conf_arr.remote;
|
||||
},
|
||||
|
||||
crypt_pass: function(pass){
|
||||
crypt_pass: function(pass) {
|
||||
Crypt.tmp_pass = pass;
|
||||
var key = btoa(socket.id) + btoa(socket.id);
|
||||
key = key.substring(0,32);
|
||||
@@ -212,7 +211,7 @@ var Crypt = {
|
||||
return encrypted.toString() + "$" + iv;
|
||||
},
|
||||
|
||||
makeiv: function(){
|
||||
makeiv: function() {
|
||||
var text = "";
|
||||
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
|
||||
@@ -222,11 +221,11 @@ var Crypt = {
|
||||
return text;
|
||||
},
|
||||
|
||||
get_width: function(){
|
||||
get_width: function() {
|
||||
return conf_arr.width;
|
||||
},
|
||||
|
||||
set_width: function(val){
|
||||
set_width: function(val) {
|
||||
conf_arr.width = val;
|
||||
Crypt.encrypt(conf_arr, "_opt");
|
||||
},
|
||||
|
||||
@@ -39,8 +39,7 @@ var Crypt = {
|
||||
}
|
||||
};
|
||||
|
||||
function receiveMessage(event)
|
||||
{
|
||||
function receiveMessage(event) {
|
||||
if(event.data == "parent") {
|
||||
//console.log(event);
|
||||
window.parentWindow = event.source;
|
||||
@@ -61,11 +60,11 @@ function receiveMessage(event)
|
||||
|
||||
window.addEventListener("message", receiveMessage, false);
|
||||
|
||||
$(document).ready(function(){
|
||||
$(document).ready(function() {
|
||||
|
||||
if(hash.length >= 3 && hash[2] == "autoplay"){
|
||||
autoplay = true;
|
||||
}else{
|
||||
} else {
|
||||
paused = true;
|
||||
}
|
||||
|
||||
@@ -86,7 +85,7 @@ $(document).ready(function(){
|
||||
$("#locked_channel").modal('open');
|
||||
});
|
||||
|
||||
socket.on("get_list", function(){
|
||||
socket.on("get_list", function() {
|
||||
setTimeout(function(){socket.emit('list', {channel: chan.toLowerCase(), pass: ''});},1000);
|
||||
});
|
||||
|
||||
@@ -96,8 +95,7 @@ $(document).ready(function(){
|
||||
}
|
||||
});
|
||||
|
||||
socket.on("viewers", function(view)
|
||||
{
|
||||
socket.on("viewers", function(view) {
|
||||
viewers = view;
|
||||
|
||||
if(song_title !== undefined)
|
||||
@@ -124,19 +122,19 @@ $(document).ready(function(){
|
||||
}
|
||||
});
|
||||
|
||||
function setup_host_listener(id){
|
||||
function setup_host_listener(id) {
|
||||
socket.on(id, Hostcontroller.host_on_action);
|
||||
}
|
||||
|
||||
function setup_host_initialization(){
|
||||
function setup_host_initialization() {
|
||||
socket.on("id", Hostcontroller.host_listener);
|
||||
}
|
||||
|
||||
function setup_youtube_listener(){
|
||||
function setup_youtube_listener() {
|
||||
socket.on("np", Player.youtube_listener);
|
||||
}
|
||||
|
||||
function setup_list_listener(){
|
||||
function setup_list_listener() {
|
||||
socket.on("channel", List.channel_function);
|
||||
}
|
||||
|
||||
@@ -145,21 +143,21 @@ function setVolume(val) {
|
||||
Playercontrols.setVolume(val);
|
||||
}
|
||||
|
||||
$(document).on( "click", "#zoffbutton", function(e){
|
||||
$(document).on( "click", "#zoffbutton", function(e) {
|
||||
window.open("https://zoff.me/" + chan.toLowerCase() + "/", '_blank');
|
||||
});
|
||||
|
||||
$(document).on( "click", ".vote-container", function(e){
|
||||
$(document).on( "click", ".vote-container", function(e) {
|
||||
var id = $(this).attr("data-video-id");
|
||||
List.vote(id, "pos");
|
||||
});
|
||||
|
||||
$(document).on("click", ".prev_page", function(e){
|
||||
$(document).on("click", ".prev_page", function(e) {
|
||||
e.preventDefault();
|
||||
List.dynamicContentPage(-1);
|
||||
});
|
||||
|
||||
$(document).on("click", ".next_page", function(e){
|
||||
$(document).on("click", ".next_page", function(e) {
|
||||
e.preventDefault();
|
||||
List.dynamicContentPage(1);
|
||||
});
|
||||
|
||||
@@ -27,31 +27,10 @@ var Frontpage = {
|
||||
Frontpage.set_viewers(msg.viewers);
|
||||
},
|
||||
|
||||
populate_channels: function(lists, popular)
|
||||
{
|
||||
populate_channels: function(lists, popular) {
|
||||
$("#channels").empty();
|
||||
|
||||
var num = 0;
|
||||
var pinned;
|
||||
|
||||
for(var i = 0; i < lists.length; i++) {
|
||||
/*if(!lists[i].hasOwnProperty("viewers")){
|
||||
lists[i].viewers = 0;
|
||||
}
|
||||
if(!lists[i].hasOwnProperty("accessed")) {
|
||||
lists[i].accessed = 0;
|
||||
}
|
||||
if(!lists[i].hasOwnProperty("pinned")){
|
||||
lists[i].pinned = 0;
|
||||
} else if(lists[i].pinned == 1) {
|
||||
pinned = lists[i];
|
||||
delete lists[i];
|
||||
}*/
|
||||
|
||||
if(lists[i].count == 0) {
|
||||
delete lists[i];
|
||||
}
|
||||
}
|
||||
|
||||
if(popular) {
|
||||
lists = lists.sort(Helper.predicate({
|
||||
@@ -77,8 +56,6 @@ var Frontpage = {
|
||||
}));
|
||||
}
|
||||
|
||||
//lists.unshift(pinned);
|
||||
|
||||
if(!Helper.mobilecheck()) {
|
||||
clearTimeout(rotation_timeout);
|
||||
Frontpage.add_backdrop(lists, 0);
|
||||
@@ -90,30 +67,24 @@ var Frontpage = {
|
||||
Helper.log(pre_card);
|
||||
Helper.log("-------------");
|
||||
|
||||
for(var x in lists)
|
||||
{
|
||||
|
||||
for(var x in lists) {
|
||||
var chan = lists[x]._id;
|
||||
if(num<12 || !popular)
|
||||
{
|
||||
if(num<12 || !popular) {
|
||||
var id = lists[x].id;
|
||||
var viewers = lists[x].viewers;
|
||||
var description = lists[x].description;
|
||||
var img = "background-image:url('https://img.youtube.com/vi/"+id+"/hqdefault.jpg');";
|
||||
if(lists[x].thumbnail){
|
||||
if(lists[x].thumbnail) {
|
||||
img = "background-image:url('" + lists[x].thumbnail + "');";
|
||||
}
|
||||
|
||||
var song_count = lists[x].count;
|
||||
|
||||
var card = pre_card.clone();
|
||||
if(lists[x].pinned == 1)
|
||||
{
|
||||
if(lists[x].pinned == 1) {
|
||||
card.find(".pin").attr("style", "display:block;");
|
||||
card.find(".card").attr("title", "Pinned!");
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
card.find(".pin").attr("style", "display:none;");
|
||||
card.find(".card").attr("title", "");
|
||||
}
|
||||
@@ -124,7 +95,7 @@ var Frontpage = {
|
||||
card.find(".chan-bg").attr("style", img);
|
||||
card.find(".chan-link").attr("href", chan + "/");
|
||||
|
||||
if(description != "" && description != undefined && !Helper.mobilecheck()){
|
||||
if(description != "" && description != undefined && !Helper.mobilecheck()) {
|
||||
card.find(".card-title").text(chan);
|
||||
card.find(".description_text").text(description);
|
||||
description = "";
|
||||
@@ -134,24 +105,16 @@ var Frontpage = {
|
||||
}
|
||||
|
||||
$("#channels").append(card.html());
|
||||
|
||||
//$("#channels").append(card);
|
||||
}
|
||||
num++;
|
||||
//if(num>19)break;
|
||||
}
|
||||
|
||||
var options_list = lists.slice();
|
||||
|
||||
options_list = options_list.sort(Frontpage.sortFunction_active);
|
||||
var data = {};
|
||||
//num = 0;
|
||||
for(var x in options_list){
|
||||
//if(options_list[x].count > 5 && Math.floor((new Date).getTime()/1000) - options_list[x].accessed < 604800){
|
||||
/*var chan = options_list[x].channel;
|
||||
output+="<option value='"+chan+"'> ";*/
|
||||
for(var x in options_list) {
|
||||
data[options_list[x]._id] = null;
|
||||
//}
|
||||
}
|
||||
|
||||
var to_autocomplete = "input.desktop-search";
|
||||
@@ -165,8 +128,6 @@ var Frontpage = {
|
||||
},
|
||||
});
|
||||
|
||||
//$(".autocomplete").off('keydown.autocomplete');
|
||||
|
||||
document.getElementById("preloader").style.display = "none";
|
||||
//Materialize.fadeInImage('#channels');
|
||||
$("#channels").fadeIn(800);
|
||||
@@ -269,7 +230,7 @@ var Frontpage = {
|
||||
},6000);
|
||||
},
|
||||
|
||||
get_frontpage_lists: function(){
|
||||
get_frontpage_lists: function() {
|
||||
$.ajax({
|
||||
url: "/api/frontpages",
|
||||
method: "get",
|
||||
@@ -285,7 +246,7 @@ var Frontpage = {
|
||||
});
|
||||
},
|
||||
|
||||
start_snowfall: function(){
|
||||
start_snowfall: function() {
|
||||
setTimeout(function(){
|
||||
var x = Math.floor((Math.random() * window.innerWidth) + 1);
|
||||
var snow = document.createElement("div");
|
||||
@@ -301,7 +262,7 @@ var Frontpage = {
|
||||
}, 800);
|
||||
},
|
||||
|
||||
fall_snow: function(corn){
|
||||
fall_snow: function(corn) {
|
||||
corn.style.top = (parseInt(corn.style.top.replace("px", ""))+2)+"px";
|
||||
if(parseInt(corn.style.top.replace("px", "")) < document.getElementById("mega-background").offsetHeight-2.5){
|
||||
setTimeout(function(){
|
||||
@@ -312,12 +273,11 @@ var Frontpage = {
|
||||
}
|
||||
},
|
||||
|
||||
set_viewers: function(viewers){
|
||||
set_viewers: function(viewers) {
|
||||
$("#frontpage-viewer-counter").html("<i class='material-icons frontpage-viewers'>visibility</i>" + viewers);
|
||||
},
|
||||
|
||||
to_channel: function(new_channel, popstate){
|
||||
|
||||
to_channel: function(new_channel, popstate) {
|
||||
$("#channel-load").css("display", "block");
|
||||
window.scrollTo(0, 0);
|
||||
frontpage = false;
|
||||
@@ -396,7 +356,7 @@ String.prototype.capitalizeFirstLetter = function() {
|
||||
return this.charAt(0).toUpperCase() + this.slice(1);
|
||||
};
|
||||
|
||||
function share_link_modifier_frontpage(){
|
||||
function share_link_modifier_frontpage() {
|
||||
$("#facebook-code-link").attr("href", "https://www.facebook.com/sharer/sharer.php?u=https://zoff.me/");
|
||||
$("#facebook-code-link").attr("onclick", "window.open('https://www.facebook.com/sharer/sharer.php?u=https://zoff.me/', 'Share Zoff','width=600,height=300'); return false;");
|
||||
$("#twitter-code-link").attr("href", "https://twitter.com/intent/tweet?url=https://zoff.me/&text=Check%20out%20Zoff!&via=zoffmusic");
|
||||
@@ -405,7 +365,7 @@ function share_link_modifier_frontpage(){
|
||||
$("#qr-code-image-link").attr("src", "//chart.googleapis.com/chart?chs=150x150&cht=qr&chl=https://zoff.me/&choe=UTF-8&chld=L%7C1");
|
||||
}
|
||||
|
||||
function initfp(){
|
||||
function initfp() {
|
||||
|
||||
var date = new Date();
|
||||
Frontpage.blob_list = [];
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
var Helper = {
|
||||
|
||||
log: function(to_log){
|
||||
log: function(to_log) {
|
||||
if(localStorage.debug === "true") {
|
||||
console.log(to_log);
|
||||
}
|
||||
},
|
||||
|
||||
rnd: function(arr)
|
||||
{
|
||||
rnd: function(arr) {
|
||||
return arr[Math.floor(Math.random() * arr.length)];
|
||||
},
|
||||
|
||||
@@ -86,7 +85,7 @@ var Helper = {
|
||||
return hash;
|
||||
},
|
||||
|
||||
intToARGB: function(i){
|
||||
intToARGB: function(i) {
|
||||
return ((i>>24)&0xFF).toString(16) +
|
||||
((i>>16)&0xFF).toString(16) +
|
||||
((i>>8)&0xFF).toString(16) +
|
||||
@@ -126,11 +125,10 @@ var Helper = {
|
||||
}
|
||||
|
||||
return [ r * 255, g * 255, b * 255 ];
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
pad: function(n)
|
||||
{
|
||||
pad: function(n) {
|
||||
return n < 10 ? "0"+Math.floor(n) : Math.floor(n);
|
||||
},
|
||||
|
||||
@@ -156,19 +154,7 @@ var Helper = {
|
||||
setTimeout(Helper.sample, SAMPLE_RATE);
|
||||
},
|
||||
|
||||
loadjsfile: function(filename)
|
||||
{
|
||||
if (filesadded.indexOf("["+filename+"]")==-1){
|
||||
var fileref=document.createElement('script');
|
||||
fileref.setAttribute("type","text/javascript");
|
||||
fileref.setAttribute("src", filename);
|
||||
document.getElementsByTagName("head")[0].appendChild(fileref);
|
||||
filesadded+="["+filename+"]";
|
||||
}
|
||||
},
|
||||
|
||||
msieversion: function() {
|
||||
|
||||
var ua = window.navigator.userAgent;
|
||||
var msie = ua.indexOf("MSIE ");
|
||||
|
||||
@@ -182,14 +168,14 @@ var Helper = {
|
||||
return Math.floor(Math.random() * (max - min)) + min;
|
||||
},
|
||||
|
||||
secondsToOther: function(seconds){
|
||||
secondsToOther: function(seconds) {
|
||||
var time = seconds;
|
||||
var minutes = Math.floor(time/60);
|
||||
time = time - (minutes * 60);
|
||||
return [minutes, time];
|
||||
},
|
||||
|
||||
rgbToHsl: function(arr, light){
|
||||
rgbToHsl: function(arr, light) {
|
||||
r = arr[0];
|
||||
g = arr[1];
|
||||
b = arr[2];
|
||||
@@ -238,8 +224,6 @@ var Helper = {
|
||||
},
|
||||
|
||||
send_mail: function(from, message){
|
||||
|
||||
|
||||
if(from !== "" && message !== ""){
|
||||
|
||||
$("#submit-contact-form").addClass("hide");
|
||||
@@ -261,12 +245,6 @@ var Helper = {
|
||||
}
|
||||
}
|
||||
});
|
||||
/*from = $("#contact-form-from").val();
|
||||
message = $("#contact-form-message").val();
|
||||
$("#contact-container").empty();
|
||||
newWindow = window.open("mailto:contact@zoff.no?Subject=Contact%20Zoff&Body=" + message, "_blank");
|
||||
$("#contact-container").html("Something went wrong, sorry about that. You could instead try with your own mail-client: <a title='Open in client' href='mailto:contact@zoff.no?Subject=Contact%20Zoff&Body=" + message + "'>contact@zoff.no</a>");
|
||||
setTimeout(function(){newWindow.close();},500);*/
|
||||
}
|
||||
},
|
||||
|
||||
@@ -325,13 +303,13 @@ var Helper = {
|
||||
b = (255 - parseInt(hex.slice(4, 6), 16)).toString(16);
|
||||
// pad each with zeros and return
|
||||
return '#' + padZero(r) + padZero(g) + padZero(b);
|
||||
},
|
||||
},
|
||||
|
||||
padZero: function(str, len) {
|
||||
padZero: function(str, len) {
|
||||
len = len || 2;
|
||||
var zeros = new Array(len).join('0');
|
||||
return (zeros + str).slice(-len);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -347,7 +325,6 @@ NodeList.prototype.remove = HTMLCollection.prototype.remove = function() {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
String.prototype.startsWith = function(searchString, position) {
|
||||
position = position || 0;
|
||||
return this.indexOf(searchString, position) === position;
|
||||
|
||||
@@ -79,8 +79,7 @@ var List = {
|
||||
}
|
||||
},
|
||||
|
||||
channel_function: function(msg)
|
||||
{
|
||||
channel_function: function(msg) {
|
||||
if(user_auth_started) {
|
||||
user_auth_started = false;
|
||||
$("#user_password").modal("close");
|
||||
@@ -180,8 +179,7 @@ var List = {
|
||||
}
|
||||
},
|
||||
|
||||
populate_list: function(msg, no_reset)
|
||||
{
|
||||
populate_list: function(msg, no_reset) {
|
||||
if(!Helper.mobilecheck() && !embed){
|
||||
List.can_fit = Math.round(($("#wrapper").height()) / 71)+1;
|
||||
List.element_height = (($("#wrapper").height()) / List.can_fit)-5.3;
|
||||
@@ -259,7 +257,7 @@ var List = {
|
||||
$("#wrapper").css("opacity", "1");
|
||||
},
|
||||
|
||||
dynamicContentPageJumpTo: function(page){
|
||||
dynamicContentPageJumpTo: function(page) {
|
||||
page = page * List.can_fit;
|
||||
if(page > List.page || page < List.page){
|
||||
$("#wrapper").children().slice(List.page, List.page + List.can_fit).hide();
|
||||
@@ -283,7 +281,7 @@ var List = {
|
||||
}
|
||||
},
|
||||
|
||||
dynamicContentPage: function(way){
|
||||
dynamicContentPage: function(way) {
|
||||
if(way == 1){
|
||||
$("#wrapper").children().slice(List.page, List.page + List.can_fit).hide();
|
||||
List.page = List.page + List.can_fit;
|
||||
@@ -302,7 +300,7 @@ var List = {
|
||||
$(".last_page").css("display", "none");
|
||||
}
|
||||
//$("#wrapper").scrollTop(0);
|
||||
} else if(way == 10){
|
||||
} else if(way == 10) {
|
||||
$("#wrapper").children().slice(List.page, List.page + List.can_fit).hide();
|
||||
List.page = (Math.floor(($("#wrapper").children().length - 1)/ List.can_fit) * List.can_fit);
|
||||
$("#wrapper").children().slice(List.page, List.page + List.can_fit).css("display", "inline-block");
|
||||
@@ -313,14 +311,13 @@ var List = {
|
||||
$(".first_page").css("display", "inline-flex");
|
||||
$(".first_page_hide").css("display", "none");
|
||||
}
|
||||
|
||||
if(List.page + List.can_fit >= $("#wrapper").children().length){
|
||||
$(".next_page_hide").css("display", "inline-flex");
|
||||
$(".next_page").css("display", "none");
|
||||
$(".last_page_hide").css("display", "inline-flex");
|
||||
$(".last_page").css("display", "none");
|
||||
}
|
||||
} else if(way==-10){
|
||||
} else if(way==-10) {
|
||||
$("#wrapper").children().slice(List.page, List.page + List.can_fit).hide();
|
||||
List.page = 0;
|
||||
$("#wrapper").children().slice(List.page, List.page + List.can_fit).css("display", "inline-block");
|
||||
@@ -370,7 +367,7 @@ var List = {
|
||||
$("#pageNumber").html((List.page / List.can_fit) + 1);
|
||||
},
|
||||
|
||||
added_song: function(added){
|
||||
added_song: function(added) {
|
||||
var now_playing;
|
||||
if(added != undefined){
|
||||
if(full_playlist.length !== 0){
|
||||
@@ -414,7 +411,7 @@ var List = {
|
||||
}
|
||||
},
|
||||
|
||||
deleted_song: function(deleted, removed){
|
||||
deleted_song: function(deleted, removed) {
|
||||
try{
|
||||
var index = List.getIndexOfSong(deleted);
|
||||
var to_delete = $("#wrapper").children()[index];
|
||||
@@ -442,16 +439,7 @@ var List = {
|
||||
$(".last_page_hide").css("display", "inline-flex");
|
||||
$(".last_page").css("display", "none");
|
||||
}
|
||||
/*setTimeout(function()
|
||||
{
|
||||
if(!removed){
|
||||
$("#"+deleted).remove();
|
||||
full_playlist.splice(List.getIndexOfSong(deleted), 1);
|
||||
}*/
|
||||
|
||||
|
||||
//}, 305);
|
||||
//if(removed) {
|
||||
if(List.page <= index && List.page - List.can_fit <= index) {
|
||||
$("#" + deleted).addClass("side_away");
|
||||
$("#" + deleted).find(".mobile-delete").remove();
|
||||
@@ -496,7 +484,7 @@ var List = {
|
||||
Suggestions.checkUserEmpty();
|
||||
},
|
||||
|
||||
voted_song: function(voted, time){
|
||||
voted_song: function(voted, time) {
|
||||
var index_of_song = List.getIndexOfSong(voted);
|
||||
var song_voted_on = full_playlist[index_of_song];
|
||||
|
||||
@@ -508,7 +496,7 @@ var List = {
|
||||
List.insertAtIndex(song_voted_on, false);
|
||||
},
|
||||
|
||||
song_change: function(time, remove){
|
||||
song_change: function(time, remove) {
|
||||
try{
|
||||
var length = full_playlist.length - 1;
|
||||
$("#wrapper").children()[0].remove();
|
||||
@@ -535,10 +523,10 @@ var List = {
|
||||
List.insertAtIndex(full_playlist[$("#wrapper").children().length], false, true);
|
||||
}
|
||||
|
||||
}catch(e){}
|
||||
} catch(e) {}
|
||||
},
|
||||
|
||||
vote: function(id, vote){
|
||||
vote: function(id, vote) {
|
||||
if(!offline || (vote == "del" && (hasadmin && (!w_p && adminpass != "")))){
|
||||
socket.emit('vote', {channel: chan, id: id, type: vote, adminpass: adminpass == "" ? "" : Crypt.crypt_pass(adminpass), pass: embed ? '' : Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()))});
|
||||
} else {
|
||||
@@ -551,7 +539,7 @@ var List = {
|
||||
return true;
|
||||
},
|
||||
|
||||
skip: function(){
|
||||
skip: function() {
|
||||
if(!offline){
|
||||
socket.emit('skip', {pass: adminpass == "" ? "" : Crypt.crypt_pass(adminpass), id:video_id, channel: chan.toLowerCase(), userpass: embed ? '' : Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()))});
|
||||
} else {
|
||||
@@ -560,7 +548,7 @@ var List = {
|
||||
return true;
|
||||
},
|
||||
|
||||
exportToSpotify: function(){
|
||||
exportToSpotify: function() {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "https://api.spotify.com/v1/me",
|
||||
@@ -593,7 +581,7 @@ var List = {
|
||||
})
|
||||
},
|
||||
|
||||
searchSpotify: function(curr_song, playlist_id, user_id){
|
||||
searchSpotify: function(curr_song, playlist_id, user_id) {
|
||||
var original_track = curr_song.title;
|
||||
var track = (curr_song.title.toLowerCase().replace("-", " "));
|
||||
if(track.startsWith("the")) {
|
||||
@@ -767,7 +755,7 @@ var List = {
|
||||
});
|
||||
},
|
||||
|
||||
addToSpotifyPlaylist: function(uris, playlist_id, user_id){
|
||||
addToSpotifyPlaylist: function(uris, playlist_id, user_id) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "https://api.spotify.com/v1/users/" + user_id + "/playlists/" + playlist_id + "/tracks",
|
||||
@@ -792,7 +780,7 @@ var List = {
|
||||
})
|
||||
},
|
||||
|
||||
exportToYoutube: function(){
|
||||
exportToYoutube: function() {
|
||||
var request_url = "https://www.googleapis.com/youtube/v3/playlists?part=snippet";
|
||||
$(".exported-list-container").removeClass("hide");
|
||||
$("#playlist_loader_export").removeClass("hide");
|
||||
@@ -821,7 +809,7 @@ var List = {
|
||||
});
|
||||
},
|
||||
|
||||
addToYoutubePlaylist: function(playlist_id, full_playlist, num, request_url){
|
||||
addToYoutubePlaylist: function(playlist_id, full_playlist, num, request_url) {
|
||||
var _data = JSON.stringify({
|
||||
'snippet': {
|
||||
'playlistId': playlist_id,
|
||||
@@ -860,37 +848,7 @@ var List = {
|
||||
});
|
||||
},
|
||||
|
||||
importOldList: function(chan){
|
||||
var ids="";
|
||||
var num=0;
|
||||
|
||||
playlist_url = "lists/"+chan+".json";
|
||||
|
||||
list = $.parseJSON($.ajax({
|
||||
type: "GET",
|
||||
url: playlist_url,
|
||||
async: false
|
||||
}).responseText);
|
||||
|
||||
$.each(list.songs, function(i,data)
|
||||
{
|
||||
ids+=data.id+",";
|
||||
|
||||
if(num>45){
|
||||
Search.addVideos(ids);
|
||||
|
||||
ids = "";
|
||||
num = 0;
|
||||
}
|
||||
num++;
|
||||
});
|
||||
|
||||
Search.addVideos(ids);
|
||||
document.getElementById("search").value = "";
|
||||
},
|
||||
|
||||
sortList: function()
|
||||
{
|
||||
sortList: function() {
|
||||
full_playlist.sort(Helper.predicate({
|
||||
name: 'votes',
|
||||
reverse: true
|
||||
@@ -903,7 +861,7 @@ var List = {
|
||||
}));
|
||||
},
|
||||
|
||||
show: function(){
|
||||
show: function() {
|
||||
if(!Helper.mobilecheck())
|
||||
{
|
||||
if(showToggle){
|
||||
@@ -921,8 +879,7 @@ var List = {
|
||||
}
|
||||
},
|
||||
|
||||
generateSong: function(_song_info, transition, lazy, list, user, display, initial)
|
||||
{
|
||||
generateSong: function(_song_info, transition, lazy, list, user, display, initial) {
|
||||
if(list_html === undefined) list_html = $("#list-song-html").html();
|
||||
var video_id = _song_info.id;
|
||||
var video_title = _song_info.title;
|
||||
@@ -987,39 +944,28 @@ var List = {
|
||||
|
||||
}
|
||||
|
||||
/*if(Helper.mobilecheck()) {
|
||||
song.find(".waves-effect").removeClass("waves-effect");
|
||||
song.find(".waves-light").removeClass("waves-light");
|
||||
song.find(".list-song").addClass("mobile-overflow");
|
||||
} else {*/
|
||||
song.find(".mobile-delete").remove();
|
||||
//}
|
||||
|
||||
song.find(".list-title").text(video_title);
|
||||
song.find(".list-title").attr("title", video_title);
|
||||
//song.find(".vote-container").attr("onclick", "vote('"+video_id+"','pos')");
|
||||
song.find(attr).attr("data-video-id", video_id);
|
||||
song.find(".list-image").attr(image_attr,video_thumb);
|
||||
song.find(".list-suggested-image").attr(image_attr,video_thumb);
|
||||
song.find("."+del_attr).attr("data-video-id", video_id);
|
||||
//song.find("#del").attr("onclick", "vote('"+video_id+"', 'del')");
|
||||
|
||||
return song.html();
|
||||
},
|
||||
|
||||
getIndexOfSong: function(id)
|
||||
{
|
||||
try{
|
||||
getIndexOfSong: function(id) {
|
||||
try {
|
||||
indexes = $.map(full_playlist, function(obj, index) {
|
||||
if(obj.id == id) {
|
||||
return index;
|
||||
}
|
||||
});
|
||||
return indexes[0];
|
||||
}catch(e){}
|
||||
} catch(e) {}
|
||||
},
|
||||
|
||||
scrollTop: function(){
|
||||
scrollTop: function() {
|
||||
$("#wrapper").scrollTop(0);
|
||||
},
|
||||
|
||||
|
||||
@@ -106,19 +106,19 @@ try{/*
|
||||
navigator.serviceWorker.register('/service-worker.js', {scope: '/'})
|
||||
.then(function (registration) {
|
||||
Helper.log(registration);
|
||||
})
|
||||
.catch(function (e) {
|
||||
console.error(e);
|
||||
});
|
||||
} else {
|
||||
Helper.log('Service Worker is not supported in this browser.');
|
||||
}*/
|
||||
})
|
||||
.catch(function (e) {
|
||||
console.error(e);
|
||||
});
|
||||
} else {
|
||||
Helper.log('Service Worker is not supported in this browser.');
|
||||
}*/
|
||||
|
||||
navigator.serviceWorker.getRegistration('/').then(function(registration) {
|
||||
navigator.serviceWorker.getRegistration('/').then(function(registration) {
|
||||
if(registration) {
|
||||
registration.unregister();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
} catch(e) {}
|
||||
|
||||
@@ -159,38 +159,16 @@ $().ready(function(){
|
||||
setTimeout(function(){
|
||||
Chat.namechange(conf_arr.name);
|
||||
}, 1000);
|
||||
}*/
|
||||
});
|
||||
}*/
|
||||
});
|
||||
|
||||
socket.on("self_ping", function() {
|
||||
socket.on("self_ping", function() {
|
||||
if(chan != undefined && chan.toLowerCase() != "") {
|
||||
socket.emit("self_ping", {channel: chan.toLowerCase()});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
setup_no_connection_listener();
|
||||
|
||||
/*try{
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "https://api.github.com/users/zoff-music/received_events",
|
||||
success: function(git_info){
|
||||
for(var i = 0; i < git_info.length; i++) {
|
||||
if(git_info[i].type == "PushEvent") {
|
||||
$("#latest-commit").html("Latest Commit: <br>" +
|
||||
git_info[0].created_at.substring(0,10) +
|
||||
": " + git_info[0].actor.display_login +
|
||||
"<br><a href='https://github.com/"+git_info[0].repo.name+"/commit/" + git_info[0].payload.commits[0].sha + "' target='_blank'>" +
|
||||
git_info[0].payload.commits[0].sha.substring(0,10) + "</a>: " +
|
||||
git_info[0].payload.commits[0].message+"<br");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch(error){
|
||||
Helper.log("Error with fetching GitHub commit info");
|
||||
}*/
|
||||
setup_no_connection_listener();
|
||||
});
|
||||
|
||||
|
||||
@@ -364,12 +342,6 @@ function init(){
|
||||
tooltip: "Cast Zoff to TV"
|
||||
});
|
||||
|
||||
/*$('.castButton-active').tooltip({
|
||||
delay: 5,
|
||||
position: "top",
|
||||
tooltip: "Stop casting"
|
||||
});*/
|
||||
|
||||
$("#results" ).hover( function() { $("div.result").removeClass("hoverResults"); i = 0; }, function(){ });
|
||||
$("#search").focus();
|
||||
$("#embed-button").css("display", "inline-block");
|
||||
@@ -525,8 +497,6 @@ initializeCastApi = function() {
|
||||
}
|
||||
});
|
||||
|
||||
//var cast_state = cast.framework.CastContext.getInstance();
|
||||
|
||||
context.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED, function(event){
|
||||
Helper.log("cast state");
|
||||
Helper.log(event.castState);
|
||||
@@ -555,7 +525,7 @@ initializeCastApi = function() {
|
||||
}
|
||||
};
|
||||
|
||||
function hide_native(way){
|
||||
function hide_native(way) {
|
||||
|
||||
if(way == 1){
|
||||
$('.castButton').tooltip('remove');
|
||||
@@ -627,7 +597,7 @@ function hide_native(way){
|
||||
}
|
||||
}
|
||||
|
||||
function chromecastListener(evt, data){
|
||||
function chromecastListener(evt, data) {
|
||||
var json_parsed = JSON.parse(data);
|
||||
switch(json_parsed.type){
|
||||
case -1:
|
||||
@@ -848,15 +818,9 @@ function change_offline(enabled, already_offline){
|
||||
} else {
|
||||
if(list_html){
|
||||
list_html = $("<div>" + list_html + "</div>");
|
||||
/*if(hasadmin && w_p){
|
||||
//list_html.find(".list-remove").addClass("hide");
|
||||
}*/
|
||||
list_html = list_html.html();
|
||||
}
|
||||
$("#viewers").removeClass("hide");
|
||||
/*if(hasadmin && w_p){
|
||||
//$(".list-remove").addClass("hide");
|
||||
}*/
|
||||
$("#offline-mode").addClass("waves-cyan");
|
||||
$("#offline-mode").removeClass("cyan");
|
||||
$("#offline-mode").tooltip({
|
||||
@@ -1073,16 +1037,6 @@ $(document).on("click", "#playpause-overlay", function(){
|
||||
}
|
||||
});
|
||||
|
||||
/*$(document).on("click", ".castButton-unactive", function(e){
|
||||
$(".castButton").trigger("click");
|
||||
});
|
||||
|
||||
$(document).on("click", ".castButton-active", function(e){
|
||||
e.preventDefault();
|
||||
var castSession = cast.framework.CastContext.getInstance().getCurrentSession();
|
||||
castSession.endSession(true);
|
||||
});*/
|
||||
|
||||
$(document).on('click', '#cookieok', function() {
|
||||
$(this).fadeOut(function(){
|
||||
$(this).remove();
|
||||
@@ -1457,8 +1411,7 @@ function searchTimeout(event) {
|
||||
|
||||
code = event.keyCode || event.which;
|
||||
|
||||
if (code != 40 && code != 38 && code != 13 && code != 39 && code != 37 &&
|
||||
code != 17 && code != 16 && code != 225 && code != 18 && code != 27) {
|
||||
if (code != 40 && code != 38 && code != 13 && code != 39 && code != 37 && code != 17 && code != 16 && code != 225 && code != 18 && code != 27) {
|
||||
clearTimeout(timeout_search);
|
||||
if(search_input.length < 3){$("#results").html("");}
|
||||
if(code == 13){
|
||||
@@ -1469,7 +1422,7 @@ function searchTimeout(event) {
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$(document).on('keyup', ".search_input", function(event) {
|
||||
searchTimeout(event);
|
||||
@@ -1479,7 +1432,6 @@ $(document).on("click", ".chat-tab", function(){
|
||||
$("#text-chat-input").focus();
|
||||
});
|
||||
|
||||
|
||||
$(document).on("click", "#skip", function(e){
|
||||
e.preventDefault();
|
||||
List.skip();
|
||||
@@ -1852,7 +1804,7 @@ function onepage_load(){
|
||||
w_p = true;
|
||||
if(private_channel) add = Crypt.getCookie("_uI") + "_";
|
||||
socket.emit("list", {version: parseInt(localStorage.getItem("VERSION")), channel: add + chan.toLowerCase(), pass: embed ? '' : Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()))});
|
||||
}else if(url_split[3] === ""){
|
||||
} else if(url_split[3] === "") {
|
||||
$.contextMenu( 'destroy', ".playlist-element" );
|
||||
user_change_password = false;
|
||||
clearTimeout(width_timeout);
|
||||
|
||||
@@ -7,8 +7,7 @@ var Player = {
|
||||
stopInterval: false,
|
||||
fireplace: "",
|
||||
|
||||
youtube_listener: function(obj)
|
||||
{
|
||||
youtube_listener: function(obj) {
|
||||
var state;
|
||||
if(embed && obj.np) {
|
||||
if(window.parentWindow && window.parentOrigin) {
|
||||
@@ -18,9 +17,9 @@ var Player = {
|
||||
}
|
||||
}
|
||||
}
|
||||
try{
|
||||
try {
|
||||
state = Player.player.getPlayerState();
|
||||
}catch(e){
|
||||
} catch(e) {
|
||||
state = null;
|
||||
}
|
||||
if((((!offline && (state != null || from_frontpage)) || (offline && (!(state != null) || from_frontpage))|| (!offline && (!(state != null) || from_frontpage)) || (offline && state == -1)) && !(offline && prev_chan_player == chan)) || (offline && video_id == undefined)){
|
||||
@@ -39,7 +38,6 @@ var Player = {
|
||||
Helper.log("---------------------------------");
|
||||
|
||||
if(!obj.np){
|
||||
|
||||
document.getElementById('song-title').innerHTML = "Empty channel. Add some songs!";
|
||||
document.title = "Zoff - the shared YouTube based radio";
|
||||
$("#channel-load").css("display", "none");
|
||||
@@ -72,7 +70,7 @@ var Player = {
|
||||
song_title = obj.np[0].title;
|
||||
duration = obj.np[0].duration;
|
||||
Player.setBGimage(video_id);
|
||||
}else if(!paused){
|
||||
} else if(!paused){
|
||||
//Helper.log("gotten new song");
|
||||
if(previous_video_id === undefined) {
|
||||
previous_video_id = obj.np[0].id;
|
||||
@@ -167,8 +165,7 @@ var Player = {
|
||||
}catch(e){}
|
||||
Helper.log("video_id variable: " + video_id);
|
||||
Helper.log("---------------------------------");
|
||||
switch(newState.data)
|
||||
{
|
||||
switch(newState.data) {
|
||||
case YT.PlayerState.UNSTARTED:
|
||||
break;
|
||||
case YT.PlayerState.ENDED:
|
||||
@@ -318,9 +315,7 @@ var Player = {
|
||||
}
|
||||
},
|
||||
|
||||
getTitle: function(titt, v)
|
||||
{
|
||||
|
||||
getTitle: function(titt, v) {
|
||||
var outPutWord = "<i class='material-icons'>visibility</i>"//v > 1 ? "viewers" : "viewer";
|
||||
var title = decodeURIComponent(titt);
|
||||
if(window.location.pathname != "/"){
|
||||
@@ -410,19 +405,9 @@ var Player = {
|
||||
var colorThief = new ColorThief();
|
||||
var color = colorThief.getColor(img);
|
||||
|
||||
if(window.location.pathname != "/"){
|
||||
if(window.location.pathname != "/") {
|
||||
document.getElementById("main-container").style.backgroundColor = Helper.rgbToHsl(color,true);
|
||||
$("meta[name=theme-color]").attr("content", Helper.rgbToHex(color[0], color[1], color[2]));
|
||||
/*chromecast_icon_color = Helper.rgbToHsl(color,true).replace("hsl(", "").replace("%)", "").replace("%", "").replace(" ", "").replace(" ", "");
|
||||
console.log(chromecast_icon_color);
|
||||
chromecast_icon_color = chromecast_icon_color.split(",");
|
||||
console.log(chromecast_icon_color);
|
||||
chromecast_icon_color = Helper.hslToRgb(parseInt(chromecast_icon_color[0]), parseFloat(chromecast_icon_color[1]) / 100, parseFloat(chromecast_icon_color[2]) / 100);
|
||||
console.log(chromecast_icon_color);
|
||||
chromecast_icon_color = Helper.rgbToHex(parseInt(chromecast_icon_color[0]), parseInt(chromecast_icon_color[1]), parseInt(chromecast_icon_color[2]));
|
||||
console.log(chromecast_icon_color);
|
||||
|
||||
$(".castButton").attr("style", "display:" + $(".castButton").css("display") + ";--disconnected-color" + chromecast_icon_color + ";");*/
|
||||
}
|
||||
};
|
||||
|
||||
@@ -456,8 +441,7 @@ var Player = {
|
||||
}
|
||||
},
|
||||
|
||||
setup_all_listeners: function()
|
||||
{
|
||||
setup_all_listeners: function() {
|
||||
get_list_listener();
|
||||
setup_youtube_listener();
|
||||
setup_admin_listener();
|
||||
|
||||
@@ -2,29 +2,25 @@ var Playercontrols = {
|
||||
|
||||
stopInterval: false,
|
||||
|
||||
initYoutubeControls: function()
|
||||
{
|
||||
if(Helper.mobilecheck() && !window.MSStream){
|
||||
initYoutubeControls: function() {
|
||||
if(Helper.mobilecheck() && !window.MSStream) {
|
||||
$("#controls").appendTo("#playbar");
|
||||
}
|
||||
Playercontrols.initControls();
|
||||
},
|
||||
|
||||
initControls: function()
|
||||
{
|
||||
document.getElementById("volume-button").addEventListener("click", Playercontrols.mute_video);
|
||||
document.getElementById("playpause").addEventListener("click", Playercontrols.play_pause);
|
||||
document.getElementById("volume-button-overlay").addEventListener("click", Playercontrols.mute_video);
|
||||
document.getElementById("playpause-overlay").addEventListener("click", Playercontrols.play_pause);
|
||||
document.getElementById("fullscreen").addEventListener("click", Playercontrols.fullscreen);
|
||||
|
||||
initControls: function() {
|
||||
$("#volume-button").on("click", Playercontrols.mute_video);
|
||||
$("#playpause").on("click", Playercontrols.play_pause);
|
||||
$("#volume-button-overlay").on("click", Playercontrols.mute_video);
|
||||
$("#playpause-overlay").on("click", Playercontrols.play_pause);
|
||||
$("#fullscreen").on("click", Playercontrols.fullscreen);
|
||||
},
|
||||
|
||||
initSlider: function()
|
||||
{
|
||||
try{
|
||||
initSlider: function() {
|
||||
try {
|
||||
vol = (Crypt.get_volume());
|
||||
}catch(e){}
|
||||
} catch(e){}
|
||||
$("#volume").slider({
|
||||
min: 0,
|
||||
max: 100,
|
||||
@@ -34,32 +30,29 @@ var Playercontrols = {
|
||||
slide: function(event, ui) {
|
||||
|
||||
Playercontrols.setVolume(ui.value);
|
||||
//localStorage.setItem("volume", ui.value);
|
||||
try{Crypt.set_volume(ui.value);}catch(e){}
|
||||
}
|
||||
});
|
||||
Playercontrols.choose_button(vol, false);
|
||||
//$("#volume").slider("value", player.getVolume());
|
||||
},
|
||||
|
||||
fullscreen: function()
|
||||
{
|
||||
var playerElement = document.getElementById("player");
|
||||
fullscreen: function() {
|
||||
var playerElement = $("#player");
|
||||
var requestFullScreen = playerElement.requestFullScreen || playerElement.mozRequestFullScreen || playerElement.webkitRequestFullScreen;
|
||||
if (requestFullScreen) {
|
||||
requestFullScreen.bind(playerElement)();
|
||||
}
|
||||
},
|
||||
|
||||
play_pause: function()
|
||||
{
|
||||
play_pause: function() {
|
||||
if(!chromecastAvailable){
|
||||
if(Player.player.getPlayerState() == YT.PlayerState.PLAYING)
|
||||
{
|
||||
Player.pauseVideo();
|
||||
if(Helper.mobilecheck() && !window.MSStream){
|
||||
//if(Helper.mobilecheck() && !/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream){
|
||||
document.getElementById("player").style.display = "none";
|
||||
//document.getElementById("player").style.display = "none";
|
||||
$("#player").css("display", "none");
|
||||
$(".video-container").toggleClass("click-through");
|
||||
$(".page-footer").toggleClass("padding-bottom-extra");
|
||||
}
|
||||
@@ -67,7 +60,8 @@ var Playercontrols = {
|
||||
Player.playVideo();
|
||||
//if(Helper.mobilecheck() && !/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream){
|
||||
if(Helper.mobilecheck() && !window.MSStream){
|
||||
document.getElementById("player").style.display = "block";
|
||||
//document.getElementById("player").style.display = "block";
|
||||
$("#player").css("display", "block");
|
||||
$(".video-container").toggleClass("click-through");
|
||||
$(".page-footer").toggleClass("padding-bottom-extra");
|
||||
}
|
||||
@@ -77,8 +71,7 @@ var Playercontrols = {
|
||||
}
|
||||
},
|
||||
|
||||
play_pause_show: function()
|
||||
{
|
||||
play_pause_show: function() {
|
||||
if(chromecastAvailable){
|
||||
if($("#play").hasClass("hide")){
|
||||
Player.pauseVideo();
|
||||
@@ -87,165 +80,146 @@ var Playercontrols = {
|
||||
}
|
||||
} else {
|
||||
|
||||
if(document.getElementById("pause").className.split(" ").length == 1){
|
||||
if(!$("#pause").hasClass("hide")) {
|
||||
$("#pause").toggleClass("hide");
|
||||
$("#pause-overlay").toggleClass("hide");
|
||||
}
|
||||
if(document.getElementById("play").className.split(" ").length == 2){
|
||||
if($("#play").hasClass("hide")) {
|
||||
$("#play").toggleClass("hide");
|
||||
$("#play-overlay").toggleClass("hide");
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
settings: function()
|
||||
{
|
||||
settings: function() {
|
||||
$("#qS").toggleClass("hide");
|
||||
},
|
||||
|
||||
changeQuality: function(wantedQ)
|
||||
{
|
||||
if(Player.player.getPlaybackQuality != wantedQ)
|
||||
{
|
||||
changeQuality: function(wantedQ) {
|
||||
if(Player.player.getPlaybackQuality != wantedQ) {
|
||||
Player.player.setPlaybackQuality(wantedQ);
|
||||
Player.player.getPlaybackQuality();
|
||||
}
|
||||
$("#qS").toggleClass("hide");
|
||||
},
|
||||
|
||||
mute_video: function()
|
||||
{
|
||||
if(!Player.player.isMuted())
|
||||
{
|
||||
mute_video: function() {
|
||||
if(!Player.player.isMuted()) {
|
||||
if(chromecastAvailable) castSession.sendMessage("urn:x-cast:zoff.me", {type: "mute"});
|
||||
Playercontrols.choose_button(0, true);
|
||||
Player.player.mute();
|
||||
}else
|
||||
{
|
||||
} else {
|
||||
if(chromecastAvailable)castSession.sendMessage("urn:x-cast:zoff.me", {type: "unMute"});
|
||||
Player.player.unMute();
|
||||
Playercontrols.choose_button(Player.player.getVolume(), false);
|
||||
}
|
||||
},
|
||||
|
||||
setVolume: function(vol)
|
||||
{
|
||||
setVolume: function(vol) {
|
||||
Player.setVolume(vol);
|
||||
Playercontrols.choose_button(vol, false);
|
||||
if(Player.player.isMuted())
|
||||
Player.player.unMute();
|
||||
},
|
||||
|
||||
choose_button: function(vol, mute)
|
||||
{
|
||||
choose_button: function(vol, mute) {
|
||||
if(!mute){
|
||||
if(vol >= 0 && vol <= 33){
|
||||
if(document.getElementById("v-full").className.split(" ").length == 1){
|
||||
if(vol >= 0 && vol <= 33) {
|
||||
if(!$("#v-full").hasClass("hide")) {
|
||||
$("#v-full").toggleClass("hide");
|
||||
$("#v-full-overlay").toggleClass("hide");
|
||||
}
|
||||
if(document.getElementById("v-medium").className.split(" ").length == 1){
|
||||
if(!$("#v-medium").hasClass("hide")) {
|
||||
$("#v-medium").toggleClass("hide");
|
||||
$("#v-medium-overlay").toggleClass("hide");
|
||||
}
|
||||
if(document.getElementById("v-low").className.split(" ").length == 2){
|
||||
if($("#v-low").hasClass("hide")) {
|
||||
$("#v-low").toggleClass("hide");
|
||||
$("#v-low-overlay").toggleClass("hide");
|
||||
}
|
||||
if(document.getElementById("v-mute").className.split(" ").length == 1){
|
||||
if(!$("#v-mute").hasClass("hide")) {
|
||||
$("#v-mute").toggleClass("hide");
|
||||
$("#v-mute-overlay").toggleClass("hide");
|
||||
}
|
||||
}else if(vol >= 34 && vol <= 66){
|
||||
if(document.getElementById("v-full").className.split(" ").length == 1){
|
||||
} else if(vol >= 34 && vol <= 66) {
|
||||
if(!$("#v-full").hasClass("hide")) {
|
||||
$("#v-full").toggleClass("hide");
|
||||
$("#v-full-overlay").toggleClass("hide");
|
||||
}
|
||||
if(document.getElementById("v-medium").className.split(" ").length == 2){
|
||||
if($("#v-medium").hasClass("hide")) {
|
||||
$("#v-medium").toggleClass("hide");
|
||||
$("#v-medium-overlay").toggleClass("hide");
|
||||
}
|
||||
if(document.getElementById("v-low").className.split(" ").length == 1){
|
||||
if(!$("#v-low").hasClass("hide")) {
|
||||
$("#v-low").toggleClass("hide");
|
||||
$("#v-low-overlay").toggleClass("hide");
|
||||
}
|
||||
if(document.getElementById("v-mute").className.split(" ").length == 1){
|
||||
if(!$("#v-mute").hasClass("hide")) {
|
||||
$("#v-mute").toggleClass("hide");
|
||||
$("#v-mute-overlay").toggleClass("hide");
|
||||
}
|
||||
}else if(vol >= 67 && vol <= 100){
|
||||
if(document.getElementById("v-full").className.split(" ").length == 2){
|
||||
} else if(vol >= 67 && vol <= 100) {
|
||||
if($("#v-full").hasClass("hide")) {
|
||||
$("#v-full").toggleClass("hide");
|
||||
$("#v-full-overlay").toggleClass("hide");
|
||||
}
|
||||
if(document.getElementById("v-medium").className.split(" ").length == 1){
|
||||
if(!$("#v-medium").hasClass("hide")) {
|
||||
$("#v-medium").toggleClass("hide");
|
||||
$("#v-medium-overlay").toggleClass("hide");
|
||||
}
|
||||
if(document.getElementById("v-low").className.split(" ").length == 1){
|
||||
if(!$("#v-low").hasClass("hide")) {
|
||||
$("#v-low").toggleClass("hide");
|
||||
$("#v-low-overlay").toggleClass("hide");
|
||||
}
|
||||
if(document.getElementById("v-mute").className.split(" ").length == 1){
|
||||
if(!$("#v-mute").hasClass("hide")) {
|
||||
$("#v-mute").toggleClass("hide");
|
||||
$("#v-mute-overlay").toggleClass("hide");
|
||||
}
|
||||
}
|
||||
}else
|
||||
{
|
||||
if(document.getElementById("v-full").className.split(" ").length == 1){
|
||||
} else {
|
||||
if(!$("#v-full").hasClass("hide")) {
|
||||
$("#v-full").toggleClass("hide");
|
||||
$("#v-full-overlay").toggleClass("hide");
|
||||
}
|
||||
if(document.getElementById("v-medium").className.split(" ").length == 1){
|
||||
if(!$("#v-medium").hasClass("hide")) {
|
||||
$("#v-medium").toggleClass("hide");
|
||||
$("#v-medium-overlay").toggleClass("hide");
|
||||
}
|
||||
if(document.getElementById("v-low").className.split(" ").length == 1){
|
||||
if(!$("#v-low").hasClass("hide")) {
|
||||
$("#v-low").toggleClass("hide");
|
||||
$("#v-low-overlay").toggleClass("hide");
|
||||
}
|
||||
if(document.getElementById("v-mute").className.split(" ").length == 2){
|
||||
if($("#v-mute").hasClass("hide")) {
|
||||
$("#v-mute").toggleClass("hide");
|
||||
$("#v-mute-overlay").toggleClass("hide");
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
playPause: function()
|
||||
{
|
||||
playPause: function() {
|
||||
state = Player.player.getPlayerState();
|
||||
button = document.getElementById("playpause");
|
||||
if(state == YT.PlayerState.PLAYING)
|
||||
{
|
||||
if(state == YT.PlayerState.PLAYING) {
|
||||
Player.pauseVideo();
|
||||
}else if(state == YT.PlayerState.PAUSED)
|
||||
{
|
||||
} else if(state == YT.PlayerState.PAUSED) {
|
||||
Player.playVideo();
|
||||
}
|
||||
},
|
||||
|
||||
volumeOptions: function()
|
||||
{
|
||||
if(!chromecastAvailable){
|
||||
if(Player.player.isMuted())
|
||||
{
|
||||
volumeOptions: function() {
|
||||
if(!chromecastAvailable) {
|
||||
if(Player.player.isMuted()) {
|
||||
Player.player.unMute();
|
||||
vol = Player.player.getVolume();
|
||||
$("#volume").slider("value", Player.player.getVolume());
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
Player.player.mute();
|
||||
$("#volume").slider("value", 0);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
hoverMute: function(foo)
|
||||
{
|
||||
hoverMute: function(foo) {
|
||||
vol = Player.player.getVolume();
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -29,59 +29,30 @@ $(document).ready(function (){
|
||||
id = id.toLowerCase();
|
||||
Remotecontroller.control();
|
||||
}
|
||||
|
||||
/*try{
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "https://api.github.com/users/zoff-music/received_events",
|
||||
success: function(git_info){
|
||||
for(var i = 0; i < git_info.length; i++) {
|
||||
if(git_info[i].type == "PushEvent") {
|
||||
$("#latest-commit").html("Latest Commit: <br>" +
|
||||
git_info[0].created_at.substring(0,10) +
|
||||
": " + git_info[0].actor.display_login +
|
||||
"<br><a href='https://github.com/"+git_info[0].repo.name+"/commit/" + git_info[0].payload.commits[0].sha + "' target='_blank'>" +
|
||||
git_info[0].payload.commits[0].sha.substring(0,10) + "</a>: " +
|
||||
git_info[0].payload.commits[0].message+"<br");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch(error){
|
||||
Helper.log("Error with fetching GitHub commit info");
|
||||
}*/
|
||||
});
|
||||
|
||||
$(document).on("click", "#playbutton", function()
|
||||
{
|
||||
$(document).on("click", "#playbutton", function() {
|
||||
socket.emit("id", {id: id, type: "play", value: "mock"});
|
||||
});
|
||||
|
||||
$(document).on("click", "#pausebutton", function()
|
||||
{
|
||||
$(document).on("click", "#pausebutton", function() {
|
||||
socket.emit("id", {id: id, type: "pause", value: "mock"});
|
||||
});
|
||||
|
||||
$(document).on("click", "#skipbutton", function()
|
||||
{
|
||||
$(document).on("click", "#skipbutton", function() {
|
||||
socket.emit("id", {id: id, type: "skip", value: "mock"});
|
||||
});
|
||||
|
||||
$(document).on("submit", "#remoteform", function(e)
|
||||
{
|
||||
$(document).on("submit", "#remoteform", function(e) {
|
||||
e.preventDefault();
|
||||
Remotecontroller.control();
|
||||
});
|
||||
|
||||
var Remotecontroller = {
|
||||
|
||||
control: function()
|
||||
{
|
||||
if(start)
|
||||
{
|
||||
if(!id)
|
||||
{
|
||||
control: function() {
|
||||
if(start) {
|
||||
if(!id) {
|
||||
id = document.getElementById("remoteform").chan.value;
|
||||
window.history.pushState("object or string", "Title", "/"+id);
|
||||
}
|
||||
@@ -106,8 +77,7 @@ var Remotecontroller = {
|
||||
socket.emit("id", {id: id, type: "volume", value: ui.value});
|
||||
}
|
||||
});
|
||||
}else
|
||||
{
|
||||
} else {
|
||||
socket.emit("id", {id: id, type: "channel", value: $("#search").val().toLowerCase()});
|
||||
$("#search").val("");
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ var Suggestions = {
|
||||
},
|
||||
|
||||
fetchYoutubeSuggests: function(id){
|
||||
|
||||
var get_url = "https://www.googleapis.com/youtube/v3/search?part=snippet&relatedToVideoId="+id+"&type=video&key="+api_key;
|
||||
var video_urls = "https://www.googleapis.com/youtube/v3/videos?part=contentDetails,snippet,id&key="+api_key+"&id=";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user