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,
"name": "Better Youtube +",
"version": "1.2.8",
"version": "1.2.9",
"description": "Enhancements for Youtube to have a better experience.",
"applications": {

View File

@ -12,7 +12,7 @@ function betterYoutubePlus() {
var count = 0;
function preSetupProc() {
video = document.getElementsByTagName("video")[0]; // Video Controler
video = document.getElementsByTagName("video")[0]; // Video Controler
slugInputTag = document.createElement("INPUT");
slugInputTag.id = "slugCopyZone";
slugInputTag.type = "text";
@ -44,7 +44,7 @@ function betterYoutubePlus() {
ytASdDefaultImg = document.createElement("A");
// Get nodes for page work
containerOfPlyrWndow = document.getElementById("player-container"); // Container of actual player - Used for floating window
containerOfPlyrWndow = document.getElementById("player-container"); // Container of actual player - Used for floating window
part = "https://img.youtube.com/vi/";
// Append to nodes as required
@ -149,17 +149,30 @@ function betterYoutubePlus() {
}
function toggleFloat() {
playerWindow = document.getElementById("player-container").children[1]; // Actual player
var playerWindow = document.getElementById("movie_player"); // Actual player
if(poppedContainer.style.display == "none"){
setVideoStyle("auto", "auto", "50%");
poppedContainer.appendChild(playerWindow);
poppedContainer.style.display = "block";
} else {
setVideoStyle(containerOfPlyrWndow.offsetWidth + "px",
containerOfPlyrWndow.offsetHeight + "px", "");
containerOfPlyrWndow.append(playerWindow);
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) {
var delta;
e.preventDefault(); // Keep page from scrolling while in video area