Update betterYoutube.js
This commit is contained in:
parent
9107c5b80d
commit
cc4e1977ce
|
@ -4,7 +4,7 @@ var ytThumbnailBttn, ytMaxDefaultImg, ytHqDefaultImg, // Buttons & Images
|
||||||
ytLoopBttn, ytFloatBttn, ytAMaxDefaultImg, ytAHqDefaultImg;
|
ytLoopBttn, ytFloatBttn, ytAMaxDefaultImg, ytAHqDefaultImg;
|
||||||
|
|
||||||
var mastHead, mainContentArea, playerWindow; // Youtube Player container
|
var mastHead, mainContentArea, playerWindow; // Youtube Player container
|
||||||
var video, mainPlayerWindow, poppedContainer; // Video accessor
|
var video, containerOfPlyrWndow, poppedContainer; // Video accessor
|
||||||
var vdoPlyrAtts; // Player attributes
|
var vdoPlyrAtts; // Player attributes
|
||||||
var part, videoSlug, temp; // Image part
|
var part, videoSlug, temp; // Image part
|
||||||
|
|
||||||
|
@ -21,10 +21,13 @@ function preSetupProc() {
|
||||||
ytAHqDefaultImg = document.createElement("A");
|
ytAHqDefaultImg = document.createElement("A");
|
||||||
|
|
||||||
// Get nodes for page work
|
// Get nodes for page work
|
||||||
mastHead = document.getElementById("yt-masthead-container"); // Search bar area
|
mastHead = document.getElementById("masthead-container")
|
||||||
mainContentArea = document.getElementById("page-container"); // BT control insert area and bg color setup
|
.getElementsByClassName("style-scope ytd-masthead")[3]; // Search bar area
|
||||||
mainPlayerWindow = document.getElementById("player-mole-container"); // Set up for insert to floating container
|
mainContentArea = document.getElementsByTagName("ytd-watch")[0]; // BT control insert area and bg color setup
|
||||||
vdoPlyrAtts = document.getElementById("page").attributes; // Used for setting up thumbnails
|
|
||||||
|
containerOfPlyrWndow = document.getElementById("top").children[0]; // Container of actual player - Used for floating window
|
||||||
|
vdoPlyrAtts = document.getElementsByTagName("ytd-watch")[0]
|
||||||
|
.getAttribute("video-id"); // Used for setting up thumbnails
|
||||||
video = document.getElementsByTagName("video")[0]; // Video Controler
|
video = document.getElementsByTagName("video")[0]; // Video Controler
|
||||||
part = "https://img.youtube.com/vi/";
|
part = "https://img.youtube.com/vi/";
|
||||||
|
|
||||||
|
@ -75,9 +78,7 @@ function preSetupProc() {
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
function showThumbImageVew(e) {
|
function showThumbImageVew(e) {
|
||||||
temp = vdoPlyrAtts[1].value;
|
videoSlug = vdoPlyrAtts;
|
||||||
temp = temp.replace(" watch video-", "");
|
|
||||||
videoSlug = temp.replace(" clearfix", "");
|
|
||||||
|
|
||||||
if (ytThumbImgMenu.style.display == "block") {
|
if (ytThumbImgMenu.style.display == "block") {
|
||||||
ytThumbImgMenu.style.display = "none";
|
ytThumbImgMenu.style.display = "none";
|
||||||
|
@ -105,13 +106,13 @@ function setLoop(e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleFloat() {
|
function toggleFloat() {
|
||||||
playerWindow = document.getElementById("player-api");
|
playerWindow = document.getElementById("player-container"); // Actual player
|
||||||
|
|
||||||
if(poppedContainer.style.display == "none"){
|
if(poppedContainer.style.display == "none"){
|
||||||
poppedContainer.appendChild(playerWindow);
|
poppedContainer.appendChild(playerWindow);
|
||||||
poppedContainer.style.display = "block";
|
poppedContainer.style.display = "block";
|
||||||
} else {
|
} else {
|
||||||
mainPlayerWindow.insertBefore(playerWindow, mainPlayerWindow.firstChild);
|
containerOfPlyrWndow.insertBefore(playerWindow, containerOfPlyrWndow.firstChild);
|
||||||
poppedContainer.style.display = "none";
|
poppedContainer.style.display = "none";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -168,4 +169,11 @@ function dragVideo(elmnt) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Start init
|
||||||
|
var existCondition = setInterval(function() {
|
||||||
|
if ($('#masthead-container').length) {
|
||||||
|
clearInterval(existCondition);
|
||||||
preSetupProc();
|
preSetupProc();
|
||||||
|
}
|
||||||
|
}, 100); // check every 100ms
|
||||||
|
|
Loading…
Reference in New Issue