mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
onepage working
This commit is contained in:
@@ -16,10 +16,10 @@
|
|||||||
<div class="navbar-fixed">
|
<div class="navbar-fixed">
|
||||||
<nav id="nav">
|
<nav id="nav">
|
||||||
<div class="nav-wrapper">
|
<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" />
|
<img id="zicon" src="static/images/squareicon_small.png" alt="zöff" title="Zöff" />
|
||||||
</a>
|
</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>
|
<a href="/" class="hide-on-large-only">Zöff</a>
|
||||||
<span class="hide-on-large-only">/</span>
|
<span class="hide-on-large-only">/</span>
|
||||||
<span id="chan" class="chan clickable" title="Show big URL"><?php echo(ucfirst($list));?></span>
|
<span id="chan" class="chan clickable" title="Show big URL"><?php echo(ucfirst($list));?></span>
|
||||||
|
|||||||
@@ -8,11 +8,11 @@
|
|||||||
<div class="navbar-fixed">
|
<div class="navbar-fixed">
|
||||||
<nav id="nav">
|
<nav id="nav">
|
||||||
<div class="nav-wrapper">
|
<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" />
|
<img id="zicon" src="static/images/squareicon_small.png" alt="zöff" title="Zöff" />
|
||||||
</a>
|
</a>
|
||||||
<div class="brand-logo truncate zbrand">
|
<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 class="hide-on-large-only">/</span>
|
||||||
<span id="chan" class="chan clickable" title="Show big URL"><?php echo(ucfirst($list));?></span>
|
<span id="chan" class="chan clickable" title="Show big URL"><?php echo(ucfirst($list));?></span>
|
||||||
</div>
|
</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)
|
socket.on("conf", function(msg)
|
||||||
{
|
{
|
||||||
|
|
||||||
Crypt.init();
|
Crypt.init();
|
||||||
Admin.set_conf(msg[0]);
|
Admin.set_conf(msg[0]);
|
||||||
if(Crypt.get_pass(chan.toLowerCase()) !== undefined && Admin.beginning && Crypt.get_pass(chan.toLowerCase()) != ""){
|
if(Crypt.get_pass(chan.toLowerCase()) !== undefined && Admin.beginning && Crypt.get_pass(chan.toLowerCase()) != ""){
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ var List = {
|
|||||||
|
|
||||||
channel_function: function(msg)
|
channel_function: function(msg)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch(msg[0])
|
switch(msg[0])
|
||||||
{
|
{
|
||||||
case "list":
|
case "list":
|
||||||
@@ -42,6 +43,7 @@ var List = {
|
|||||||
|
|
||||||
populate_list: function(msg)
|
populate_list: function(msg)
|
||||||
{
|
{
|
||||||
|
|
||||||
full_playlist = msg;
|
full_playlist = msg;
|
||||||
|
|
||||||
List.sortList();
|
List.sortList();
|
||||||
|
|||||||
@@ -46,13 +46,16 @@ var connection_options = {
|
|||||||
'force new connection': true
|
'force new connection': true
|
||||||
};
|
};
|
||||||
|
|
||||||
$().ready(init);
|
$().ready(function(){init();});
|
||||||
|
|
||||||
|
|
||||||
function init(){
|
function init(){
|
||||||
|
|
||||||
|
chan = $("#chan").html();
|
||||||
if(window.location.hostname == "zoff.no") add = "https://zoff.no";
|
if(window.location.hostname == "zoff.no") add = "https://zoff.no";
|
||||||
else add = "localhost";
|
else add = "localhost";
|
||||||
socket = io.connect(''+add+':8880', connection_options);
|
socket = io.connect(''+add+':8880', connection_options);
|
||||||
|
|
||||||
socket.on("get_list", function(){
|
socket.on("get_list", function(){
|
||||||
setTimeout(function(){socket.emit('list', chan.toLowerCase())},1000);
|
setTimeout(function(){socket.emit('list', chan.toLowerCase())},1000);
|
||||||
});
|
});
|
||||||
@@ -63,7 +66,9 @@ function init(){
|
|||||||
single = false;
|
single = false;
|
||||||
setTimeout(function(){Suggestions.catchUserSuggests(params, single)}, 1000);
|
setTimeout(function(){Suggestions.catchUserSuggests(params, single)}, 1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
|
Youtube.stopInterval= false;
|
||||||
//window.vote = List.vote;
|
//window.vote = List.vote;
|
||||||
//window.submit = Search.submit;
|
//window.submit = Search.submit;
|
||||||
//window.submitAndClose = Search.submitAndClose;
|
//window.submitAndClose = Search.submitAndClose;
|
||||||
@@ -183,6 +188,8 @@ function init(){
|
|||||||
}
|
}
|
||||||
}, 1);
|
}, 1);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window.init = init;
|
window.init = init;
|
||||||
@@ -266,7 +273,7 @@ $("#skip").on("click", function(){
|
|||||||
List.skip();
|
List.skip();
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#chan").on("click", function(){
|
$(document).on("click", "#chan", function(){
|
||||||
List.show();
|
List.show();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -359,7 +366,7 @@ $(document).on('click', '#toast-container', function(){
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".brand-logo").click(function(e){
|
$(document).on("click", ".brand-logo-navigate", function(e){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
window.history.pushState("to the frontpage!", "Title", "/");
|
window.history.pushState("to the frontpage!", "Title", "/");
|
||||||
@@ -373,16 +380,22 @@ window.onpopstate = function(e){
|
|||||||
function onepage_load(){
|
function onepage_load(){
|
||||||
|
|
||||||
var url_split = window.location.href.split("/");
|
var url_split = window.location.href.split("/");
|
||||||
|
|
||||||
if(url_split[3] == "" || url_split[3].substring(0,1) == "#"){
|
if(url_split[3] == "" || url_split[3].substring(0,1) == "#"){
|
||||||
$("#channel-load").css("display", "block");
|
$("#channel-load").css("display", "block");
|
||||||
window.scrollTo(0, 0);
|
window.scrollTo(0, 0);
|
||||||
|
|
||||||
|
|
||||||
Youtube.stopInterval = true;
|
Youtube.stopInterval = true;
|
||||||
|
Admin.display_logged_out();
|
||||||
|
Admin.beginning = true;
|
||||||
|
chan = "";
|
||||||
|
|
||||||
|
socket.removeAllListeners();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "php/nochan_content.php",
|
url: "php/nochan_content.php",
|
||||||
success: function(e){
|
success: function(e){
|
||||||
Youtube.ytplayer.destroy();
|
|
||||||
|
|
||||||
socket.disconnect();
|
socket.disconnect();
|
||||||
|
|
||||||
@@ -443,6 +456,8 @@ function onepage_load(){
|
|||||||
delete connection_options;
|
delete connection_options;
|
||||||
delete socket;
|
delete socket;
|
||||||
delete window.onYouTubeIframeAPIReady;*/
|
delete window.onYouTubeIframeAPIReady;*/
|
||||||
|
Youtube.ytplayer.destroy();
|
||||||
|
|
||||||
$(".drag-target").remove();
|
$(".drag-target").remove();
|
||||||
$(".sidenav-overlay").remove();
|
$(".sidenav-overlay").remove();
|
||||||
$("main").attr("class", "center-align container");
|
$("main").attr("class", "center-align container");
|
||||||
@@ -452,7 +467,10 @@ function onepage_load(){
|
|||||||
$($(e)[2]).insertAfter("header");
|
$($(e)[2]).insertAfter("header");
|
||||||
$($(e)[4]).insertAfter(".mega");
|
$($(e)[4]).insertAfter(".mega");
|
||||||
$("main").html($($(e)[6]).html());
|
$("main").html($($(e)[6]).html());
|
||||||
$("#scripts").append($($(e)[8]).html());
|
|
||||||
|
if($("#alreadychannel").length == 0) $("head").append("<div id='alreadychannel'></div")
|
||||||
|
if($("#alreadyfp").length == 1) window.initfp();
|
||||||
|
else $("#scripts").append($($(e)[8]).html());
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
document.title = "Zöff";
|
document.title = "Zöff";
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
//script for frontpage
|
//script for frontpage
|
||||||
|
|
||||||
var list_html;
|
var channel_list;
|
||||||
var git_info;
|
var git_info;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -40,7 +40,7 @@ var Nochan = {
|
|||||||
if(pinned !== undefined){
|
if(pinned !== undefined){
|
||||||
lists.unshift(pinned);
|
lists.unshift(pinned);
|
||||||
}
|
}
|
||||||
pre_card = $(list_html);
|
pre_card = $(channel_list);
|
||||||
|
|
||||||
if(!window.mobilecheck())
|
if(!window.mobilecheck())
|
||||||
Nochan.add_backdrop(lists, 0);
|
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 img = "background-image:url('https://img.youtube.com/vi/"+id+"/hqdefault.jpg');";
|
||||||
var song_count = lists[x][4];
|
var song_count = lists[x][4];
|
||||||
|
|
||||||
//$("#channels").append(list_html);
|
//$("#channels").append(channel_list);
|
||||||
|
|
||||||
var card = pre_card;
|
var card = pre_card;
|
||||||
if(lists[x][5] == 1)
|
if(lists[x][5] == 1)
|
||||||
@@ -204,6 +204,8 @@ var Nochan = {
|
|||||||
$("#channel-load").css("display", "block");
|
$("#channel-load").css("display", "block");
|
||||||
window.scrollTo(0, 0);
|
window.scrollTo(0, 0);
|
||||||
|
|
||||||
|
socket.removeAllListeners();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: chan + "/php/channel.php",
|
url: chan + "/php/channel.php",
|
||||||
success: function(e){
|
success: function(e){
|
||||||
@@ -212,7 +214,7 @@ var Nochan = {
|
|||||||
|
|
||||||
socket.disconnect();
|
socket.disconnect();
|
||||||
|
|
||||||
if(!popstate) window.history.pushState("to the channel!", "Title", "/" + chan);
|
if(!popstate) window.history.pushState("to the channel!", "Title", "/" + chan + "/");
|
||||||
|
|
||||||
|
|
||||||
$(".mega").remove();
|
$(".mega").remove();
|
||||||
@@ -221,8 +223,12 @@ var Nochan = {
|
|||||||
$("body").attr("id", "channelpage");
|
$("body").attr("id", "channelpage");
|
||||||
$("header").html($($(e)[0]).html());
|
$("header").html($($(e)[0]).html());
|
||||||
$("main").html($($(e)[2]).html());
|
$("main").html($($(e)[2]).html());
|
||||||
|
if($("#alreadychannel").length == 1){
|
||||||
window.init();
|
window.init();
|
||||||
//$("#scripts").html($($(e)[4]).html());
|
}else{
|
||||||
|
$("#scripts").append($($(e)[4]).html());
|
||||||
|
}
|
||||||
|
if($("#alreadyfp").length == 0) $("head").append("<div id='alreadyfp'></div>");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -243,14 +249,16 @@ String.prototype.capitalizeFirstLetter = function() {
|
|||||||
return this.charAt(0).toUpperCase() + this.slice(1);
|
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)
|
//Materialize.toast("<a href='/remote' style='color:white;'>Try out our new feature, remote!</a>", 8000)
|
||||||
if(window.location.hash == "#donation")
|
if(window.location.hash == "#donation")
|
||||||
$('#donation').openModal()
|
$('#donation').openModal()
|
||||||
|
|
||||||
list_html = $("#channel-list-container").html();
|
channel_list = $("#channel-list-container").html();
|
||||||
window.list_html = list_html;
|
//window.channel_list = channel_list;
|
||||||
$("#channels").empty();
|
$("#channels").empty();
|
||||||
|
|
||||||
var connection_options = {
|
var connection_options = {
|
||||||
@@ -310,28 +318,31 @@ $(document).ready(function (){
|
|||||||
+ git_info[0].sha.substring(0,10) + "</a>: "
|
+ git_info[0].sha.substring(0,10) + "</a>: "
|
||||||
+ git_info[0].commit.message+"<br");
|
+ git_info[0].commit.message+"<br");
|
||||||
|
|
||||||
});
|
|
||||||
|
}
|
||||||
|
|
||||||
|
window.initfp = initfp;
|
||||||
|
|
||||||
$(document).on('click', '#cookieok', function() {
|
$(document).on('click', '#cookieok', function() {
|
||||||
$(this).fadeOut(function(){
|
$(this).fadeOut(function(){
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
localStorage["ok_cookie"] = true;
|
localStorage["ok_cookie"] = true;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '#toast-container', function(){
|
$(document).on('click', '#toast-container', function(){
|
||||||
$(this).fadeOut(function(){
|
$(this).fadeOut(function(){
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', ".chan-link", function(e){
|
$(document).on('click', ".chan-link", function(e){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
Nochan.to_channel($(this).attr("href"), false);
|
Nochan.to_channel($(this).attr("href"), false);
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".listen-button").click(function(e){
|
$(".listen-button").click(function(e){
|
||||||
//console.log($(".room-namer").attr("placeholder"));
|
//console.log($(".room-namer").attr("placeholder"));
|
||||||
if($(".room-namer").val() == ""){
|
if($(".room-namer").val() == ""){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -339,4 +350,5 @@ $(".listen-button").click(function(e){
|
|||||||
|
|
||||||
Nochan.to_channel($(".room-namer").attr("placeholder"));
|
Nochan.to_channel($(".room-namer").attr("placeholder"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ var Playercontrols = {
|
|||||||
|
|
||||||
play_pause: function()
|
play_pause: function()
|
||||||
{
|
{
|
||||||
console.log("play pause");
|
|
||||||
if(Youtube.ytplayer.getPlayerState() == 1)
|
if(Youtube.ytplayer.getPlayerState() == 1)
|
||||||
{
|
{
|
||||||
Youtube.ytplayer.pauseVideo();
|
Youtube.ytplayer.pauseVideo();
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ var Youtube = {
|
|||||||
//if(player_ready && !window.mobilecheck())
|
//if(player_ready && !window.mobilecheck())
|
||||||
if(player_ready && !/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream)
|
if(player_ready && !/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream)
|
||||||
{
|
{
|
||||||
|
|
||||||
try{
|
try{
|
||||||
if(Youtube.ytplayer.getVideoUrl().split('v=')[1] != video_id)
|
if(Youtube.ytplayer.getVideoUrl().split('v=')[1] != video_id)
|
||||||
{
|
{
|
||||||
@@ -64,7 +65,7 @@ var Youtube = {
|
|||||||
Youtube.ytplayer.seekTo(seekTo);
|
Youtube.ytplayer.seekTo(seekTo);
|
||||||
Youtube.after_load = video_id;
|
Youtube.after_load = video_id;
|
||||||
setTimeout(function(){Youtube.loaded = true;},500);
|
setTimeout(function(){Youtube.loaded = true;},500);
|
||||||
}catch(e){}
|
}catch(e){Youtube.durationSetter();}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Youtube.getTitle(song_title, viewers);
|
Youtube.getTitle(song_title, viewers);
|
||||||
@@ -162,6 +163,7 @@ var Youtube = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
onPlayerReady: function(event) {
|
onPlayerReady: function(event) {
|
||||||
|
try{
|
||||||
beginning = true;
|
beginning = true;
|
||||||
player_ready = true;
|
player_ready = true;
|
||||||
if(!/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream)
|
if(!/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream)
|
||||||
@@ -169,6 +171,7 @@ var Youtube = {
|
|||||||
$("#player").css("opacity", "1");
|
$("#player").css("opacity", "1");
|
||||||
$("#controls").css("opacity", "1");
|
$("#controls").css("opacity", "1");
|
||||||
$(".playlist").css("opacity", "1");
|
$(".playlist").css("opacity", "1");
|
||||||
|
window.ytplayer = Youtube.ytplayer;
|
||||||
Youtube.ytplayer.loadVideoById(video_id);
|
Youtube.ytplayer.loadVideoById(video_id);
|
||||||
Youtube.ytplayer.playVideo();
|
Youtube.ytplayer.playVideo();
|
||||||
Youtube.durationSetter();
|
Youtube.durationSetter();
|
||||||
@@ -178,6 +181,7 @@ var Youtube = {
|
|||||||
Playercontrols.initYoutubeControls(Youtube.ytplayer);
|
Playercontrols.initYoutubeControls(Youtube.ytplayer);
|
||||||
Playercontrols.initSlider();
|
Playercontrols.initSlider();
|
||||||
Youtube.ytplayer.setVolume(Crypt.get_volume());
|
Youtube.ytplayer.setVolume(Crypt.get_volume());
|
||||||
|
}catch(e){window.location.reload();};
|
||||||
},
|
},
|
||||||
|
|
||||||
readyLooks: function()
|
readyLooks: function()
|
||||||
@@ -248,7 +252,9 @@ var Youtube = {
|
|||||||
durationSetter: function()
|
durationSetter: function()
|
||||||
{
|
{
|
||||||
//console.log(Youtube.stopInterval);
|
//console.log(Youtube.stopInterval);
|
||||||
|
try{
|
||||||
duration = Youtube.ytplayer.getDuration();
|
duration = Youtube.ytplayer.getDuration();
|
||||||
|
}catch(e){duration = 0};
|
||||||
if(duration != undefined){
|
if(duration != undefined){
|
||||||
try{
|
try{
|
||||||
dMinutes = Math.floor(duration / 60);
|
dMinutes = Math.floor(duration / 60);
|
||||||
@@ -266,7 +272,7 @@ var Youtube = {
|
|||||||
per = 0;
|
per = 0;
|
||||||
$("#bar").width(per+"%");
|
$("#bar").width(per+"%");
|
||||||
}catch(e){
|
}catch(e){
|
||||||
Youtube.stopInterval = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!Youtube.stopInterval) setTimeout(Youtube.durationSetter, 1000);
|
if(!Youtube.stopInterval) setTimeout(Youtube.durationSetter, 1000);
|
||||||
|
|||||||
Reference in New Issue
Block a user