Fixed error with videoplayer not showing up when changing too fast

This commit is contained in:
Kasper Rynning-Tønnesen
2016-05-10 14:41:10 +02:00
parent b26a8ea716
commit 2d18aa3858
3 changed files with 10 additions and 4 deletions

File diff suppressed because one or more lines are too long

View File

@@ -595,6 +595,8 @@ function onepage_load(){
$("#main_components").remove();
$("#player").addClass("player_bottom");
$("#main-row").addClass("frontpage_modified_heights");
$("#player").css("opacity", "1");
$("#video-container").removeClass("no-opacity");
} else {
console.log("destroying video");
Player.ytplayer.destroy();

View File

@@ -250,8 +250,9 @@ var Nochan = {
$("main").attr("class", "container center-align main");
$("body").attr("id", "channelpage");
$("header").html($($(e)[61]).html());
if($("#alreadychannel").length == 0 || window.mobilecheck()) $("main").html($($(e)[65]).html());
else {
if($("#alreadychannel").length == 0 || window.mobilecheck() || Player.ytplayer == undefined){
$("main").html($($(e)[65]).html());
} else {
var main = $($($($($(e)[65]).html())[0]).html());
$("#main-row").append($(main[2]).clone().wrap("<div>").parent().html());
$("#video-container").append($($($(main[0]).html())[4]).clone().wrap("<div>").parent().html());
@@ -407,9 +408,12 @@ $(document).on("click", "#closePlayer", function(e){
e.preventDefault();
socket.emit("change_channel");
Player.ytplayer.destroy();
socket.removeEventListener("np");
$("#alreadychannel").remove();
Player.ytplayer = "";
document.title = "Zöff";
$("#closePlayer").remove();
console.log("removed shit");
});
$(document).on('click', '#toast-container', function(){