Fixed scaling issues with chat and soundcloud players on resizing

This commit is contained in:
Kasper Rynning-Tønnesen
2018-06-28 16:51:31 +02:00
parent 1881703fd8
commit 28f7b36730
4 changed files with 22 additions and 4 deletions

View File

@@ -249,7 +249,7 @@ margin: auto;
} }
#chat-container, #suggestions{ #chat-container, #suggestions{
height:calc(100vh - 48px - 64px) !important; height:calc(100vh - 48px - 64px);
} }
.channel-info-all-chat { .channel-info-all-chat {
@@ -2914,7 +2914,7 @@ nav ul li:hover, nav ul li.active {
#chat-container { #chat-container {
height: calc(100vh - 48px - 64px - 120px) !important; height: calc(100vh - 48px - 64px - 120px);
margin-bottom: 18px; margin-bottom: 18px;
} }

View File

@@ -784,10 +784,17 @@ function resizePlaylistPlaying(playing) {
if(window.innerWidth < 601) { if(window.innerWidth < 601) {
var subtract = 0; var subtract = 0;
if(playing) { if(playing) {
Helper.css("#chat-bar", "height", window.innerHeight - 246 - subtract + "px"); var height = window.innerHeight - 246 - 170 - subtract;
Helper.css("#chat-bar", "height", height + "px");
Helper.css("#channelchat", "height", height - 130 + "px");
Helper.css("#all_chat", "height", height - 130 + "px");
Helper.css("#chat-container", "height", height + "px");
subtract = 200; subtract = 200;
} else { } else {
document.querySelector("#chat-bar").style.height = ""; document.querySelector("#chat-bar").style.height = "";
document.querySelector("#channelchat").style.height = "";
document.querySelector("#all_chat").style.height = "";
document.querySelector("#chat-container").style.height = "";
} }
Helper.css("#wrapper", "height", window.innerHeight - 246 - subtract + "px"); Helper.css("#wrapper", "height", window.innerHeight - 246 - subtract + "px");
var temp_fit = Math.round(Helper.computedStyle("#wrapper", "height") / 71)+1; var temp_fit = Math.round(Helper.computedStyle("#wrapper", "height") / 71)+1;

View File

@@ -1280,8 +1280,12 @@ window.addEventListener("resize", function(){
if(chan && !Helper.mobilecheck()){ if(chan && !Helper.mobilecheck()){
if(window.innerWidth > 600 && document.querySelector("#wrapper").style.height != "") { if(window.innerWidth > 600 && document.querySelector("#wrapper").style.height != "") {
document.querySelector("#wrapper").style.height = ""; document.querySelector("#wrapper").style.height = "";
document.querySelector("#chat-bar").style.height = "";
document.querySelector("#channelchat").style.height = "";
document.querySelector("#all_chat").style.height = "";
document.querySelector("#chat-container").style.height = "";
} else if(window.innerWidth < 601) { } else if(window.innerWidth < 601) {
resizePlaylistPlaying(Player.player.getPlayerState() == YT.PlayerState.PLAYING); resizePlaylistPlaying(Player.player.getPlayerState() == YT.PlayerState.PLAYING || Player.soundcloud_player.isPlaying());
return; return;
} }
var temp_fit = Math.round(Helper.computedStyle("#wrapper", "height") / 71)+1; var temp_fit = Math.round(Helper.computedStyle("#wrapper", "height") / 71)+1;

View File

@@ -626,6 +626,9 @@ var Player = {
end_programmatically = false; end_programmatically = false;
} else { } else {
was_stopped = true; was_stopped = true;
if(!embed && !client && window.location.pathname != "/") {
resizePlaylistPlaying(false);
}
if(!chromecastAvailable){ if(!chromecastAvailable){
if(Helper.mobilecheck()) { if(Helper.mobilecheck()) {
Helper.css("#playpause", "visibility", "visible"); Helper.css("#playpause", "visibility", "visible");
@@ -665,6 +668,10 @@ var Player = {
//} //}
} }
if(!embed && !client && window.location.pathname != "/") {
resizePlaylistPlaying(true);
}
Helper.css("#playpause", "visibility", "visible"); Helper.css("#playpause", "visibility", "visible");
Helper.css("#playpause", "pointer-events", "all"); Helper.css("#playpause", "pointer-events", "all");
playing = true; playing = true;