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