mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
@@ -16,10 +16,10 @@
|
||||
<div class="navbar-fixed">
|
||||
<nav id="nav">
|
||||
<div class="nav-wrapper">
|
||||
<a href="/" class="brand-logo hide-on-med-and-down noselect">
|
||||
<a href="/" class="brand-logo brand-logo-navigate hide-on-med-and-down noselect">
|
||||
<img id="zicon" src="static/images/squareicon_small.png" alt="zöff" title="Zöff" />
|
||||
</a>
|
||||
<div class="brand-logo truncate zbrand">
|
||||
<div class="brand-logo brand-logo-navigate truncate zbrand">
|
||||
<a href="/" class="hide-on-large-only">Zöff</a>
|
||||
<span class="hide-on-large-only">/</span>
|
||||
<span id="chan" class="chan clickable" title="Show big URL"><?php echo(ucfirst($list));?></span>
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
<div class="navbar-fixed">
|
||||
<nav id="nav">
|
||||
<div class="nav-wrapper">
|
||||
<a href="/" class="brand-logo hide-on-med-and-down noselect">
|
||||
<a href="/" class="brand-logo brand-logo-navigate hide-on-med-and-down noselect">
|
||||
<img id="zicon" src="static/images/squareicon_small.png" alt="zöff" title="Zöff" />
|
||||
</a>
|
||||
<div class="brand-logo truncate zbrand">
|
||||
<a href="/" class="hide-on-large-only">Zöff</a>
|
||||
<a href="/" class="hide-on-large-only brand-logo-navigate">Zöff</a>
|
||||
<span class="hide-on-large-only">/</span>
|
||||
<span id="chan" class="chan clickable" title="Show big URL"><?php echo(ucfirst($list));?></span>
|
||||
</div>
|
||||
|
||||
2
static/dist/frontpage.min.js
vendored
2
static/dist/frontpage.min.js
vendored
File diff suppressed because one or more lines are too long
4
static/dist/main.min.js
vendored
4
static/dist/main.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -91,6 +91,7 @@ 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()) != ""){
|
||||
|
||||
@@ -9,6 +9,7 @@ var List = {
|
||||
|
||||
channel_function: function(msg)
|
||||
{
|
||||
|
||||
switch(msg[0])
|
||||
{
|
||||
case "list":
|
||||
@@ -42,6 +43,7 @@ var List = {
|
||||
|
||||
populate_list: function(msg)
|
||||
{
|
||||
|
||||
full_playlist = msg;
|
||||
|
||||
List.sortList();
|
||||
|
||||
@@ -39,29 +39,36 @@ var list;
|
||||
var seekTo;
|
||||
var song_title;
|
||||
var previous_video_id;
|
||||
var socket;
|
||||
var connection_options = {
|
||||
'sync disconnect on unload':true,
|
||||
'secure': true,
|
||||
'force new connection': true
|
||||
};
|
||||
|
||||
if(window.location.hostname == "zoff.no") add = "https://zoff.no";
|
||||
else add = "localhost";
|
||||
var socket = io.connect(''+add+':8880', connection_options);
|
||||
socket.on("get_list", function(){
|
||||
setTimeout(function(){socket.emit('list', chan.toLowerCase())},1000);
|
||||
});
|
||||
$().ready(function(){init();});
|
||||
|
||||
socket.on("suggested", function(params){
|
||||
var single = true;
|
||||
if(params.id == undefined)
|
||||
single = false;
|
||||
setTimeout(function(){Suggestions.catchUserSuggests(params, single)}, 1000);
|
||||
});
|
||||
|
||||
$(document).ready(function()
|
||||
{
|
||||
function init(){
|
||||
|
||||
chan = $("#chan").html();
|
||||
if(window.location.hostname == "zoff.no") add = "https://zoff.no";
|
||||
else add = "localhost";
|
||||
socket = io.connect(''+add+':8880', connection_options);
|
||||
|
||||
socket.on("get_list", function(){
|
||||
setTimeout(function(){socket.emit('list', chan.toLowerCase())},1000);
|
||||
});
|
||||
|
||||
socket.on("suggested", function(params){
|
||||
var single = true;
|
||||
if(params.id == undefined)
|
||||
single = false;
|
||||
setTimeout(function(){Suggestions.catchUserSuggests(params, single)}, 1000);
|
||||
});
|
||||
|
||||
setTimeout(function(){
|
||||
Youtube.stopInterval= false;
|
||||
//window.vote = List.vote;
|
||||
//window.submit = Search.submit;
|
||||
//window.submitAndClose = Search.submitAndClose;
|
||||
@@ -181,7 +188,11 @@ $(document).ready(function()
|
||||
}
|
||||
}, 1);
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
window.init = init;
|
||||
|
||||
$(document).keyup(function(e) {
|
||||
if(event.keyCode == 27){
|
||||
@@ -262,7 +273,7 @@ $("#skip").on("click", function(){
|
||||
List.skip();
|
||||
});
|
||||
|
||||
$("#chan").on("click", function(){
|
||||
$(document).on("click", "#chan", function(){
|
||||
List.show();
|
||||
});
|
||||
|
||||
@@ -355,7 +366,7 @@ $(document).on('click', '#toast-container', function(){
|
||||
});
|
||||
});
|
||||
|
||||
$(".brand-logo").click(function(e){
|
||||
$(document).on("click", ".brand-logo-navigate", function(e){
|
||||
e.preventDefault();
|
||||
|
||||
window.history.pushState("to the frontpage!", "Title", "/");
|
||||
@@ -369,16 +380,22 @@ window.onpopstate = function(e){
|
||||
function onepage_load(){
|
||||
|
||||
var url_split = window.location.href.split("/");
|
||||
|
||||
if(url_split[3] == "" || url_split[3].substring(0,1) == "#"){
|
||||
$("#channel-load").css("display", "block");
|
||||
window.scrollTo(0, 0);
|
||||
|
||||
|
||||
Youtube.stopInterval = true;
|
||||
Admin.display_logged_out();
|
||||
Admin.beginning = true;
|
||||
chan = "";
|
||||
|
||||
socket.removeAllListeners();
|
||||
|
||||
$.ajax({
|
||||
url: "php/nochan_content.php",
|
||||
success: function(e){
|
||||
Youtube.ytplayer.destroy();
|
||||
|
||||
socket.disconnect();
|
||||
|
||||
@@ -387,7 +404,7 @@ function onepage_load(){
|
||||
document.getElementById("fullscreen").removeEventListener("click", Playercontrols.fullscreen);
|
||||
|
||||
setTimeout(function(){
|
||||
delete Admin
|
||||
/*delete Admin
|
||||
delete Chat
|
||||
delete Crypt
|
||||
delete Hostcontroller
|
||||
@@ -438,21 +455,26 @@ function onepage_load(){
|
||||
delete previous_video_id;
|
||||
delete connection_options;
|
||||
delete socket;
|
||||
delete window.onYouTubeIframeAPIReady;
|
||||
delete window.onYouTubeIframeAPIReady;*/
|
||||
Youtube.ytplayer.destroy();
|
||||
|
||||
$(".drag-target").remove();
|
||||
$(".sidenav-overlay").remove();
|
||||
$("main").attr("class", "center-align container");
|
||||
$("body").attr("id", "");
|
||||
$("body").attr("style", "");
|
||||
$("header").html($($(e)[0]).html());
|
||||
$($(e)[2]).insertAfter("header");
|
||||
$($(e)[4]).insertAfter(".mega");
|
||||
$("main").html($($(e)[6]).html());
|
||||
|
||||
if($("#alreadychannel").length == 0) $("head").append("<div id='alreadychannel'></div")
|
||||
if($("#alreadyfp").length == 1) window.initfp();
|
||||
else $("#scripts").append($($(e)[8]).html());
|
||||
}, 1000);
|
||||
|
||||
document.title = "Zöff";
|
||||
|
||||
$(".drag-target").remove();
|
||||
$(".sidenav-overlay").remove();
|
||||
$("main").attr("class", "center-align container");
|
||||
$("body").attr("id", "");
|
||||
$("body").attr("style", "");
|
||||
$("header").html($($(e)[0]).html());
|
||||
$($(e)[2]).insertAfter("header");
|
||||
$($(e)[4]).insertAfter(".mega");
|
||||
$("main").html($($(e)[6]).html());
|
||||
$("#scripts").html($($(e)[8]).html());
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//script for frontpage
|
||||
|
||||
var list_html;
|
||||
var channel_list;
|
||||
var git_info;
|
||||
|
||||
/*
|
||||
@@ -40,7 +40,7 @@ var Nochan = {
|
||||
if(pinned !== undefined){
|
||||
lists.unshift(pinned);
|
||||
}
|
||||
pre_card = $(list_html);
|
||||
pre_card = $(channel_list);
|
||||
|
||||
if(!window.mobilecheck())
|
||||
Nochan.add_backdrop(lists, 0);
|
||||
@@ -56,7 +56,7 @@ var Nochan = {
|
||||
var img = "background-image:url('https://img.youtube.com/vi/"+id+"/hqdefault.jpg');";
|
||||
var song_count = lists[x][4];
|
||||
|
||||
//$("#channels").append(list_html);
|
||||
//$("#channels").append(channel_list);
|
||||
|
||||
var card = pre_card;
|
||||
if(lists[x][5] == 1)
|
||||
@@ -204,6 +204,8 @@ var Nochan = {
|
||||
$("#channel-load").css("display", "block");
|
||||
window.scrollTo(0, 0);
|
||||
|
||||
socket.removeAllListeners();
|
||||
|
||||
$.ajax({
|
||||
url: chan + "/php/channel.php",
|
||||
success: function(e){
|
||||
@@ -212,16 +214,21 @@ var Nochan = {
|
||||
|
||||
socket.disconnect();
|
||||
|
||||
if(!popstate) window.history.pushState("to the channel!", "Title", "/" + chan);
|
||||
if(!popstate) window.history.pushState("to the channel!", "Title", "/" + chan + "/");
|
||||
|
||||
|
||||
$.holdReady(true);
|
||||
$(".mega").remove();
|
||||
$(".mobile-search").remove();
|
||||
$("main").attr("class", "container center-align main");
|
||||
$("body").attr("id", "channelpage");
|
||||
$("header").html($($(e)[0]).html());
|
||||
$("main").html($($(e)[2]).html());
|
||||
$("#scripts").html($($(e)[4]).html());
|
||||
if($("#alreadychannel").length == 1){
|
||||
window.init();
|
||||
}else{
|
||||
$("#scripts").append($($(e)[4]).html());
|
||||
}
|
||||
if($("#alreadyfp").length == 0) $("head").append("<div id='alreadyfp'></div>");
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -242,14 +249,16 @@ String.prototype.capitalizeFirstLetter = function() {
|
||||
return this.charAt(0).toUpperCase() + this.slice(1);
|
||||
}
|
||||
|
||||
$(document).ready(function (){
|
||||
$().ready(initfp);
|
||||
|
||||
function initfp(){
|
||||
|
||||
//Materialize.toast("<a href='/remote' style='color:white;'>Try out our new feature, remote!</a>", 8000)
|
||||
if(window.location.hash == "#donation")
|
||||
$('#donation').openModal()
|
||||
|
||||
list_html = $("#channel-list-container").html();
|
||||
window.list_html = list_html;
|
||||
channel_list = $("#channel-list-container").html();
|
||||
//window.channel_list = channel_list;
|
||||
$("#channels").empty();
|
||||
|
||||
var connection_options = {
|
||||
@@ -309,33 +318,37 @@ $(document).ready(function (){
|
||||
+ git_info[0].sha.substring(0,10) + "</a>: "
|
||||
+ git_info[0].commit.message+"<br");
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
window.initfp = initfp;
|
||||
|
||||
$(document).on('click', '#cookieok', function() {
|
||||
$(this).fadeOut(function(){
|
||||
$(this).remove();
|
||||
localStorage["ok_cookie"] = true;
|
||||
});
|
||||
});
|
||||
$(this).fadeOut(function(){
|
||||
$(this).remove();
|
||||
localStorage["ok_cookie"] = true;
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '#toast-container', function(){
|
||||
$(this).fadeOut(function(){
|
||||
$(this).remove();
|
||||
});
|
||||
});
|
||||
$(document).on('click', '#toast-container', function(){
|
||||
$(this).fadeOut(function(){
|
||||
$(this).remove();
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', ".chan-link", function(e){
|
||||
e.preventDefault();
|
||||
$(document).on('click', ".chan-link", function(e){
|
||||
e.preventDefault();
|
||||
|
||||
Nochan.to_channel($(this).attr("href"), false);
|
||||
});
|
||||
Nochan.to_channel($(this).attr("href"), false);
|
||||
});
|
||||
|
||||
$(".listen-button").click(function(e){
|
||||
//console.log($(".room-namer").attr("placeholder"));
|
||||
if($(".room-namer").val() == ""){
|
||||
e.preventDefault();
|
||||
//window.location = "?chan="+
|
||||
$(".listen-button").click(function(e){
|
||||
//console.log($(".room-namer").attr("placeholder"));
|
||||
if($(".room-namer").val() == ""){
|
||||
e.preventDefault();
|
||||
//window.location = "?chan="+
|
||||
|
||||
Nochan.to_channel($(".room-namer").attr("placeholder"));
|
||||
}
|
||||
});
|
||||
|
||||
Nochan.to_channel($(".room-namer").attr("placeholder"));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -49,7 +49,7 @@ var Playercontrols = {
|
||||
|
||||
play_pause: function()
|
||||
{
|
||||
console.log("play pause");
|
||||
|
||||
if(Youtube.ytplayer.getPlayerState() == 1)
|
||||
{
|
||||
Youtube.ytplayer.pauseVideo();
|
||||
|
||||
@@ -11,7 +11,9 @@ var Youtube = {
|
||||
socket.on("np", function(obj)
|
||||
{
|
||||
Youtube.loaded = false;
|
||||
if(video_id != undefined && Youtube.ytplayer !== undefined) Youtube.before_load = Youtube.ytplayer.getVideoUrl();
|
||||
try{
|
||||
if(video_id != undefined && Youtube.ytplayer !== undefined) Youtube.before_load = Youtube.ytplayer.getVideoUrl();
|
||||
}catch(e){}
|
||||
if(obj[0].length == 0){
|
||||
|
||||
document.getElementById('song-title').innerHTML = "Empty channel. Add some songs!";
|
||||
@@ -44,22 +46,26 @@ var Youtube = {
|
||||
//if(player_ready && !window.mobilecheck())
|
||||
if(player_ready && !/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream)
|
||||
{
|
||||
if(Youtube.ytplayer.getVideoUrl().split('v=')[1] != video_id)
|
||||
{
|
||||
Youtube.ytplayer.loadVideoById(video_id);
|
||||
Youtube.notifyUser(video_id, song_title);
|
||||
Youtube.ytplayer.seekTo(seekTo);
|
||||
if(paused)
|
||||
Youtube.ytplayer.pauseVideo();
|
||||
}
|
||||
if(!paused){
|
||||
Youtube.ytplayer.playVideo();
|
||||
Youtube.durationSetter();
|
||||
}
|
||||
if(Youtube.ytplayer.getDuration() > seekTo || Youtube.ytplayer.getDuration() == 0)
|
||||
Youtube.ytplayer.seekTo(seekTo);
|
||||
Youtube.after_load = video_id;
|
||||
setTimeout(function(){Youtube.loaded = true;},500);
|
||||
|
||||
try{
|
||||
if(Youtube.ytplayer.getVideoUrl().split('v=')[1] != video_id)
|
||||
{
|
||||
Youtube.ytplayer.loadVideoById(video_id);
|
||||
Youtube.notifyUser(video_id, song_title);
|
||||
Youtube.ytplayer.seekTo(seekTo);
|
||||
if(paused)
|
||||
Youtube.ytplayer.pauseVideo();
|
||||
}
|
||||
|
||||
if(!paused){
|
||||
Youtube.ytplayer.playVideo();
|
||||
Youtube.durationSetter();
|
||||
}
|
||||
if(Youtube.ytplayer.getDuration() > seekTo || Youtube.ytplayer.getDuration() == 0)
|
||||
Youtube.ytplayer.seekTo(seekTo);
|
||||
Youtube.after_load = video_id;
|
||||
setTimeout(function(){Youtube.loaded = true;},500);
|
||||
}catch(e){Youtube.durationSetter();}
|
||||
}
|
||||
else
|
||||
Youtube.getTitle(song_title, viewers);
|
||||
@@ -157,6 +163,7 @@ var Youtube = {
|
||||
},
|
||||
|
||||
onPlayerReady: function(event) {
|
||||
try{
|
||||
beginning = true;
|
||||
player_ready = true;
|
||||
if(!/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream)
|
||||
@@ -164,6 +171,7 @@ var Youtube = {
|
||||
$("#player").css("opacity", "1");
|
||||
$("#controls").css("opacity", "1");
|
||||
$(".playlist").css("opacity", "1");
|
||||
window.ytplayer = Youtube.ytplayer;
|
||||
Youtube.ytplayer.loadVideoById(video_id);
|
||||
Youtube.ytplayer.playVideo();
|
||||
Youtube.durationSetter();
|
||||
@@ -173,6 +181,7 @@ var Youtube = {
|
||||
Playercontrols.initYoutubeControls(Youtube.ytplayer);
|
||||
Playercontrols.initSlider();
|
||||
Youtube.ytplayer.setVolume(Crypt.get_volume());
|
||||
}catch(e){window.location.reload();};
|
||||
},
|
||||
|
||||
readyLooks: function()
|
||||
@@ -243,22 +252,28 @@ var Youtube = {
|
||||
durationSetter: function()
|
||||
{
|
||||
//console.log(Youtube.stopInterval);
|
||||
duration = Youtube.ytplayer.getDuration();
|
||||
try{
|
||||
duration = Youtube.ytplayer.getDuration();
|
||||
}catch(e){duration = 0};
|
||||
if(duration != undefined){
|
||||
dMinutes = Math.floor(duration / 60);
|
||||
dSeconds = duration - dMinutes * 60;
|
||||
currDurr = Youtube.ytplayer.getCurrentTime();
|
||||
if(currDurr > duration)
|
||||
currDurr = duration;
|
||||
minutes = Math.floor(currDurr / 60);
|
||||
seconds = currDurr - minutes * 60;
|
||||
document.getElementById("duration").innerHTML = Helper.pad(minutes)+":"+Helper.pad(seconds)+" <span id='dash'>/</span> "+Helper.pad(dMinutes)+":"+Helper.pad(dSeconds);
|
||||
per = (100 / duration) * currDurr;
|
||||
if(per >= 100)
|
||||
per = 100;
|
||||
else if(duration == 0)
|
||||
per = 0;
|
||||
$("#bar").width(per+"%");
|
||||
try{
|
||||
dMinutes = Math.floor(duration / 60);
|
||||
dSeconds = duration - dMinutes * 60;
|
||||
currDurr = Youtube.ytplayer.getCurrentTime();
|
||||
if(currDurr > duration)
|
||||
currDurr = duration;
|
||||
minutes = Math.floor(currDurr / 60);
|
||||
seconds = currDurr - minutes * 60;
|
||||
document.getElementById("duration").innerHTML = Helper.pad(minutes)+":"+Helper.pad(seconds)+" <span id='dash'>/</span> "+Helper.pad(dMinutes)+":"+Helper.pad(dSeconds);
|
||||
per = (100 / duration) * currDurr;
|
||||
if(per >= 100)
|
||||
per = 100;
|
||||
else if(duration == 0)
|
||||
per = 0;
|
||||
$("#bar").width(per+"%");
|
||||
}catch(e){
|
||||
|
||||
}
|
||||
}
|
||||
if(!Youtube.stopInterval) setTimeout(Youtube.durationSetter, 1000);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user