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
+16 -12
View File
@@ -39,15 +39,20 @@ 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
};
$().ready(init);
function init(){
if(window.location.hostname == "zoff.no") add = "https://zoff.no";
else add = "localhost";
var socket = io.connect(''+add+':8880', connection_options);
socket = io.connect(''+add+':8880', connection_options);
socket.on("get_list", function(){
setTimeout(function(){socket.emit('list', chan.toLowerCase())},1000);
});
@@ -58,9 +63,6 @@ socket.on("suggested", function(params){
single = false;
setTimeout(function(){Suggestions.catchUserSuggests(params, single)}, 1000);
});
$(document).ready(function()
{
setTimeout(function(){
//window.vote = List.vote;
//window.submit = Search.submit;
@@ -181,7 +183,9 @@ $(document).ready(function()
}
}, 1);
}, 1000);
});
}
window.init = init;
$(document).keyup(function(e) {
if(event.keyCode == 27){
@@ -387,7 +391,7 @@ function onepage_load(){
document.getElementById("fullscreen").removeEventListener("click", Playercontrols.fullscreen);
setTimeout(function(){
delete Admin
/*delete Admin
delete Chat
delete Crypt
delete Hostcontroller
@@ -438,11 +442,7 @@ function onepage_load(){
delete previous_video_id;
delete connection_options;
delete socket;
delete window.onYouTubeIframeAPIReady;
}, 1000);
document.title = "Zöff";
delete window.onYouTubeIframeAPIReady;*/
$(".drag-target").remove();
$(".sidenav-overlay").remove();
$("main").attr("class", "center-align container");
@@ -452,7 +452,11 @@ function onepage_load(){
$($(e)[2]).insertAfter("header");
$($(e)[4]).insertAfter(".mega");
$("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);
$.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());
window.init();
//$("#scripts").html($($(e)[4]).html());
}
});
}
+9
View File
@@ -11,7 +11,9 @@ var Youtube = {
socket.on("np", function(obj)
{
Youtube.loaded = false;
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,6 +46,7 @@ var Youtube = {
//if(player_ready && !window.mobilecheck())
if(player_ready && !/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream)
{
try{
if(Youtube.ytplayer.getVideoUrl().split('v=')[1] != video_id)
{
Youtube.ytplayer.loadVideoById(video_id);
@@ -52,6 +55,7 @@ var Youtube = {
if(paused)
Youtube.ytplayer.pauseVideo();
}
if(!paused){
Youtube.ytplayer.playVideo();
Youtube.durationSetter();
@@ -60,6 +64,7 @@ var Youtube = {
Youtube.ytplayer.seekTo(seekTo);
Youtube.after_load = video_id;
setTimeout(function(){Youtube.loaded = true;},500);
}catch(e){}
}
else
Youtube.getTitle(song_title, viewers);
@@ -245,6 +250,7 @@ var Youtube = {
//console.log(Youtube.stopInterval);
duration = Youtube.ytplayer.getDuration();
if(duration != undefined){
try{
dMinutes = Math.floor(duration / 60);
dSeconds = duration - dMinutes * 60;
currDurr = Youtube.ytplayer.getCurrentTime();
@@ -259,6 +265,9 @@ var Youtube = {
else if(duration == 0)
per = 0;
$("#bar").width(per+"%");
}catch(e){
Youtube.stopInterval = true;
}
}
if(!Youtube.stopInterval) setTimeout(Youtube.durationSetter, 1000);
},