This commit is contained in:
Kasper Rynning-Tønnesen
2016-01-25 11:36:36 +01:00
parent 0968aeccc7
commit 26dea79c7a
5 changed files with 77 additions and 63 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+2 -2
View File
File diff suppressed because one or more lines are too long
+23 -19
View File
@@ -39,28 +39,30 @@ var list;
var seekTo; var seekTo;
var song_title; var song_title;
var previous_video_id; var previous_video_id;
var socket;
var connection_options = { var connection_options = {
'sync disconnect on unload':true, 'sync disconnect on unload':true,
'secure': true, 'secure': true,
'force new connection': true 'force new connection': true
}; };
if(window.location.hostname == "zoff.no") add = "https://zoff.no"; $().ready(init);
else add = "localhost";
var 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){
function init(){
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; var single = true;
if(params.id == undefined) if(params.id == undefined)
single = false; single = false;
setTimeout(function(){Suggestions.catchUserSuggests(params, single)}, 1000); setTimeout(function(){Suggestions.catchUserSuggests(params, single)}, 1000);
}); });
$(document).ready(function()
{
setTimeout(function(){ setTimeout(function(){
//window.vote = List.vote; //window.vote = List.vote;
//window.submit = Search.submit; //window.submit = Search.submit;
@@ -181,7 +183,9 @@ $(document).ready(function()
} }
}, 1); }, 1);
}, 1000); }, 1000);
}); }
window.init = init;
$(document).keyup(function(e) { $(document).keyup(function(e) {
if(event.keyCode == 27){ if(event.keyCode == 27){
@@ -387,7 +391,7 @@ function onepage_load(){
document.getElementById("fullscreen").removeEventListener("click", Playercontrols.fullscreen); document.getElementById("fullscreen").removeEventListener("click", Playercontrols.fullscreen);
setTimeout(function(){ setTimeout(function(){
delete Admin /*delete Admin
delete Chat delete Chat
delete Crypt delete Crypt
delete Hostcontroller delete Hostcontroller
@@ -438,11 +442,7 @@ function onepage_load(){
delete previous_video_id; delete previous_video_id;
delete connection_options; delete connection_options;
delete socket; delete socket;
delete window.onYouTubeIframeAPIReady; delete window.onYouTubeIframeAPIReady;*/
}, 1000);
document.title = "Zöff";
$(".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 +452,11 @@ 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").html($($(e)[8]).html()); $("#scripts").append($($(e)[8]).html());
}, 1000);
document.title = "Zöff";
} }
}); });
+3 -2
View File
@@ -214,14 +214,15 @@ var Nochan = {
if(!popstate) window.history.pushState("to the channel!", "Title", "/" + chan); if(!popstate) window.history.pushState("to the channel!", "Title", "/" + chan);
$.holdReady(true);
$(".mega").remove(); $(".mega").remove();
$(".mobile-search").remove(); $(".mobile-search").remove();
$("main").attr("class", "container center-align main"); $("main").attr("class", "container center-align main");
$("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());
$("#scripts").html($($(e)[4]).html()); window.init();
//$("#scripts").html($($(e)[4]).html());
} }
}); });
} }
+9
View File
@@ -11,7 +11,9 @@ var Youtube = {
socket.on("np", function(obj) socket.on("np", function(obj)
{ {
Youtube.loaded = false; Youtube.loaded = false;
try{
if(video_id != undefined && Youtube.ytplayer !== undefined) Youtube.before_load = Youtube.ytplayer.getVideoUrl(); if(video_id != undefined && Youtube.ytplayer !== undefined) Youtube.before_load = Youtube.ytplayer.getVideoUrl();
}catch(e){}
if(obj[0].length == 0){ if(obj[0].length == 0){
document.getElementById('song-title').innerHTML = "Empty channel. Add some songs!"; document.getElementById('song-title').innerHTML = "Empty channel. Add some songs!";
@@ -44,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{
if(Youtube.ytplayer.getVideoUrl().split('v=')[1] != video_id) if(Youtube.ytplayer.getVideoUrl().split('v=')[1] != video_id)
{ {
Youtube.ytplayer.loadVideoById(video_id); Youtube.ytplayer.loadVideoById(video_id);
@@ -52,6 +55,7 @@ var Youtube = {
if(paused) if(paused)
Youtube.ytplayer.pauseVideo(); Youtube.ytplayer.pauseVideo();
} }
if(!paused){ if(!paused){
Youtube.ytplayer.playVideo(); Youtube.ytplayer.playVideo();
Youtube.durationSetter(); Youtube.durationSetter();
@@ -60,6 +64,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){}
} }
else else
Youtube.getTitle(song_title, viewers); Youtube.getTitle(song_title, viewers);
@@ -245,6 +250,7 @@ var Youtube = {
//console.log(Youtube.stopInterval); //console.log(Youtube.stopInterval);
duration = Youtube.ytplayer.getDuration(); duration = Youtube.ytplayer.getDuration();
if(duration != undefined){ if(duration != undefined){
try{
dMinutes = Math.floor(duration / 60); dMinutes = Math.floor(duration / 60);
dSeconds = duration - dMinutes * 60; dSeconds = duration - dMinutes * 60;
currDurr = Youtube.ytplayer.getCurrentTime(); currDurr = Youtube.ytplayer.getCurrentTime();
@@ -259,6 +265,9 @@ var Youtube = {
else if(duration == 0) else if(duration == 0)
per = 0; per = 0;
$("#bar").width(per+"%"); $("#bar").width(per+"%");
}catch(e){
Youtube.stopInterval = true;
}
} }
if(!Youtube.stopInterval) setTimeout(Youtube.durationSetter, 1000); if(!Youtube.stopInterval) setTimeout(Youtube.durationSetter, 1000);
}, },