Fixed floating player issue.
This commit is contained in:
parent
8957e87fc2
commit
a95fd1a9ec
|
@ -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": {
|
||||||
|
|
|
@ -12,7 +12,7 @@ function betterYoutubePlus() {
|
||||||
var count = 0;
|
var count = 0;
|
||||||
|
|
||||||
function preSetupProc() {
|
function preSetupProc() {
|
||||||
video = document.getElementsByTagName("video")[0]; // Video Controler
|
video = document.getElementsByTagName("video")[0]; // Video Controler
|
||||||
slugInputTag = document.createElement("INPUT");
|
slugInputTag = document.createElement("INPUT");
|
||||||
slugInputTag.id = "slugCopyZone";
|
slugInputTag.id = "slugCopyZone";
|
||||||
slugInputTag.type = "text";
|
slugInputTag.type = "text";
|
||||||
|
@ -44,7 +44,7 @@ function betterYoutubePlus() {
|
||||||
ytASdDefaultImg = document.createElement("A");
|
ytASdDefaultImg = document.createElement("A");
|
||||||
|
|
||||||
// Get nodes for page work
|
// 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/";
|
part = "https://img.youtube.com/vi/";
|
||||||
|
|
||||||
// Append to nodes as required
|
// Append to nodes as required
|
||||||
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue