onepage working

This commit is contained in:
Kasper Rynning-Tønnesen
2016-01-25 14:12:11 +01:00
parent 26dea79c7a
commit 522ccb2af0
10 changed files with 88 additions and 49 deletions

View File

@@ -46,13 +46,16 @@ var connection_options = {
'force new connection': true
};
$().ready(init);
$().ready(function(){init();});
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);
});
@@ -63,7 +66,9 @@ function init(){
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;
@@ -183,6 +188,8 @@ function init(){
}
}, 1);
}, 1000);
}
window.init = init;
@@ -266,7 +273,7 @@ $("#skip").on("click", function(){
List.skip();
});
$("#chan").on("click", function(){
$(document).on("click", "#chan", function(){
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();
window.history.pushState("to the frontpage!", "Title", "/");
@@ -373,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();
@@ -443,6 +456,8 @@ function onepage_load(){
delete connection_options;
delete socket;
delete window.onYouTubeIframeAPIReady;*/
Youtube.ytplayer.destroy();
$(".drag-target").remove();
$(".sidenav-overlay").remove();
$("main").attr("class", "center-align container");
@@ -452,7 +467,10 @@ function onepage_load(){
$($(e)[2]).insertAfter("header");
$($(e)[4]).insertAfter(".mega");
$("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);
document.title = "Zöff";