Fixed scaling issue on mobile when playing, and fixed embed crashes

This commit is contained in:
Kasper Rynning-Tønnesen
2018-07-25 07:20:24 +02:00
parent 2219e14f86
commit 1e6e507362
2 changed files with 301 additions and 305 deletions

View File

@@ -148,6 +148,8 @@ window.addEventListener("load", function() {
} }
}); });
function resizePlaylistPlaying(){};
function startWaitTimerPlay() { function startWaitTimerPlay() {
setTimeout(function() { setTimeout(function() {
if(videoSource == "youtube") { if(videoSource == "youtube") {

View File

@@ -47,7 +47,7 @@ function resizeFunction() {
} }
var temp_fit; var temp_fit;
if(!Helper.mobilecheck() && !embed && !client){ if(!embed && !client){
temp_fit = Math.round(Helper.computedStyle("#wrapper", "height") / 71); temp_fit = Math.round(Helper.computedStyle("#wrapper", "height") / 71);
List.element_height = (Helper.computedStyle("#wrapper", "height") / temp_fit)-5.3; List.element_height = (Helper.computedStyle("#wrapper", "height") / temp_fit)-5.3;
} else if(embed) { } else if(embed) {
@@ -835,29 +835,29 @@ function change_offline(enabled, already_offline){
List.sortList(); List.sortList();
List.populate_list(full_playlist); List.populate_list(full_playlist);
} }
} else { } else {
/*if(list_html == undefined){ /*if(list_html == undefined){
var tempOuter = document.createElement("div"); var tempOuter = document.createElement("div");
list_html.innerHTML = list_html; list_html.innerHTML = list_html;
//list_html.find(".list-remove").removeClass("hide"); //list_html.find(".list-remove").removeClass("hide");
list_html = list_html.innerHTML; list_html = list_html.innerHTML;
}*/ }*/
if(!Admin.logged_in) Helper.addClass(".delete-context-menu", "context-menu-disabled"); if(!Admin.logged_in) Helper.addClass(".delete-context-menu", "context-menu-disabled");
Helper.removeClass(".margin-playbar", "margin-playbar"); Helper.removeClass(".margin-playbar", "margin-playbar");
Helper.addClass("#playpause", "margin-playbar"); Helper.addClass("#playpause", "margin-playbar");
Helper.removeClass("#viewers", "hide"); Helper.removeClass("#viewers", "hide");
Helper.addClass(".prev playbar", "hide"); Helper.addClass(".prev playbar", "hide");
Helper.addClass("#offline-mode", "waves-cyan"); Helper.addClass("#offline-mode", "waves-cyan");
Helper.removeClass("#offline-mode", "cyan"); Helper.removeClass("#offline-mode", "cyan");
if(!Helper.mobilecheck()) { if(!Helper.mobilecheck()) {
Helper.tooltip("#offline-mode", { Helper.tooltip("#offline-mode", {
delay: 5, delay: 5,
position: "bottom", position: "bottom",
html: "Enable local mode" html: "Enable local mode"
}); });
} }
if(window.location.pathname != "/"){ if(window.location.pathname != "/"){
document.getElementById("controls").removeEventListener("mouseenter", mouseEnter, false); document.getElementById("controls").removeEventListener("mouseenter", mouseEnter, false);
document.getElementById("controls").removeEventListener("mouseleave", mouseLeave, false); document.getElementById("controls").removeEventListener("mouseleave", mouseLeave, false);
document.getElementById("controls").removeEventListener("mousedown", mouseDown, false); document.getElementById("controls").removeEventListener("mousedown", mouseDown, false);
@@ -871,12 +871,12 @@ function change_offline(enabled, already_offline){
//if(private_channel) add = Crypt.getCookie("_uI") + "_"; //if(private_channel) add = Crypt.getCookie("_uI") + "_";
socket.emit("list", {version: parseInt(localStorage.getItem("VERSION")), channel: add + chan.toLowerCase()}); socket.emit("list", {version: parseInt(localStorage.getItem("VERSION")), channel: add + chan.toLowerCase()});
Helper.removeClass("#controls", "ewresize"); Helper.removeClass("#controls", "ewresize");
} }
} }
} }
function resizePlaylistPlaying(playing) { function resizePlaylistPlaying(playing) {
if(document.querySelector("#wrapper") == null) return; if(document.querySelector("#wrapper") == null || embed || client) return;
if(window.innerWidth < 601) { if(window.innerWidth < 601) {
var subtract = 0; var subtract = 0;
if(playing) { if(playing) {
@@ -896,15 +896,9 @@ function resizePlaylistPlaying(playing) {
var canFit = List.can_fit; var canFit = List.can_fit;
Helper.css("#wrapper", "height", window.innerHeight - 246 - subtract + "px"); Helper.css("#wrapper", "height", window.innerHeight - 246 - subtract + "px");
if(!Helper.mobilecheck() && !embed && !client){ if(!embed && !client){
temp_fit = Math.round(Helper.computedStyle("#wrapper", "height") / 71); temp_fit = Math.round(Helper.computedStyle("#wrapper", "height") / 71);
List.element_height = (Helper.computedStyle("#wrapper", "height") / temp_fit)-5.3; List.element_height = (Helper.computedStyle("#wrapper", "height") / temp_fit)-5.3;
} else if(embed) {
temp_fit = Math.round(Helper.computedStyle("#wrapper", "height") / 91) + 1;
List.element_height = (Helper.computedStyle("#wrapper", "height") / temp_fit)-4;
} else if(!client){
temp_fit = Math.round((Helper.computedStyle(".tabs", "height") - Helper.computedStyle("header", "height") - 64 - 40) / 71)+1;
List.element_height = ((window.innerHeight - Helper.computedStyle(".tabs", "height") - Helper.computedStyle("header", "height") - 64 - 40) / temp_fit)-5;
} else { } else {
temp_fit = Math.round(Helper.computedStyle("#wrapper", "height") / 71)+1; temp_fit = Math.round(Helper.computedStyle("#wrapper", "height") / 71)+1;
List.element_height = (Helper.computedStyle("#wrapper", "height") / temp_fit)-5.3; List.element_height = (Helper.computedStyle("#wrapper", "height") / temp_fit)-5.3;
@@ -1181,22 +1175,22 @@ function before_toast(){
var toastElement = $('.toast').first()[0]; var toastElement = $('.toast').first()[0];
var toastInstance = toastElement.M_Toast; var toastInstance = toastElement.M_Toast;
toastInstance.remove(); toastInstance.remove();
}*/ }*/
/*var toasts = document.querySelector(".toast"); /*var toasts = document.querySelector(".toast");
//for(var i = 0; i < toasts.length; i++) { //for(var i = 0; i < toasts.length; i++) {
// var instance = M.Toast.getInstance(toasts[i]); // var instance = M.Toast.getInstance(toasts[i]);
if(toasts == null) return; if(toasts == null) return;
var instance = M.Toast.getInstance(toasts); var instance = M.Toast.getInstance(toasts);
try { try {
console.log(instance); console.log(instance);
if(instance.timeRemaining > 0) { if(instance.timeRemaining > 0) {
instance.dismiss(); instance.dismiss();
} }
} catch(e) { } catch(e) {
} }
//}*/ //}*/
M.Toast.dismissAll(); M.Toast.dismissAll();
//Materialize.Toast.removeAll(); //Materialize.Toast.removeAll();
} }
function scrollChat() { function scrollChat() {
@@ -1223,15 +1217,15 @@ function searchTimeout(event) {
if(search_input.length == 0) { if(search_input.length == 0) {
document.querySelector("body").setAttribute("style", "overflow-y: auto"); document.querySelector("body").setAttribute("style", "overflow-y: auto");
} }
}*/ }*/
if(code == 13){ if(code == 13){
Search.search(search_input); Search.search(search_input);
Search.soundcloudSearch(search_input); Search.soundcloudSearch(search_input);
}else{ }else{
timeout_search = setTimeout(function(){ timeout_search = setTimeout(function(){
Search.search(search_input); Search.search(search_input);
Search.soundcloudSearch(search_input); Search.soundcloudSearch(search_input);
}, 1000); }, 1000);
} }
} }
} }