Fixed floating player issue.

This commit is contained in:
Maxim Stewart 2018-09-22 00:57:46 -05:00
parent 8957e87fc2
commit a95fd1a9ec
2 changed files with 17 additions and 4 deletions

View File

@ -1,7 +1,7 @@
{ {
"manifest_version": 2, "manifest_version": 2,
"name": "Better Youtube +", "name": "Better Youtube +",
"version": "1.2.8", "version": "1.2.9",
"description": "Enhancements for Youtube to have a better experience.", "description": "Enhancements for Youtube to have a better experience.",
"applications": { "applications": {

View File

@ -149,17 +149,30 @@ function betterYoutubePlus() {
} }
function toggleFloat() { function toggleFloat() {
playerWindow = document.getElementById("player-container").children[1]; // Actual player var playerWindow = document.getElementById("movie_player"); // Actual player
if(poppedContainer.style.display == "none"){ if(poppedContainer.style.display == "none"){
setVideoStyle("auto", "auto", "50%");
poppedContainer.appendChild(playerWindow); poppedContainer.appendChild(playerWindow);
poppedContainer.style.display = "block"; poppedContainer.style.display = "block";
} else { } else {
setVideoStyle(containerOfPlyrWndow.offsetWidth + "px",
containerOfPlyrWndow.offsetHeight + "px", "");
containerOfPlyrWndow.append(playerWindow); containerOfPlyrWndow.append(playerWindow);
poppedContainer.style.display = "none"; poppedContainer.style.display = "none";
} }
} }
function setVideoStyle(w, h, pr) {
var elm = document.getElementsByClassName("ytp-right-controls")[0];
video.style.width = w;
video.style.height = h;
elm.style.paddingRight = pr;
console.log("W: " + w + "\nH: " + h + "\npr: " + pr);
console.log(video.style);
}
function manageVolume(e) { function manageVolume(e) {
var delta; var delta;
e.preventDefault(); // Keep page from scrolling while in video area e.preventDefault(); // Keep page from scrolling while in video area