fixed some stuff with thumbnail loading

This commit is contained in:
Maxim Stewart 2018-06-03 22:53:28 -05:00
parent 2d4710070b
commit 47349f2246
3 changed files with 220 additions and 218 deletions

View File

@ -12,5 +12,5 @@ Better Youtube + works to improve the Youtube experience by providing quick acce
# Download # Download
https://addons.mozilla.org/en-US/firefox/addon/better-youtube-plus/ https://addons.mozilla.org/en-US/firefox/addon/better-youtube-plus/
# Version: 1.2.5 # Version: 1.2.6
Added quick access to the Youtube video slug. Added quick access to the Youtube video slug.

View File

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

View File

@ -1,3 +1,5 @@
function betterYoutubePlus() {
// Declare variables // Declare variables
var slugInputTag, ytThumbImgMenu, ytEnhancerMenu; // Menu systems var slugInputTag, ytThumbImgMenu, ytEnhancerMenu; // Menu systems
var ytThumbnailBttn, ytMaxDefaultImg, ytHqDefaultImg, // Buttons & Images var ytThumbnailBttn, ytMaxDefaultImg, ytHqDefaultImg, // Buttons & Images
@ -10,7 +12,6 @@ var part, videoSlug, temp; // Image part
var count = 0; var count = 0;
function preSetupProc() { function preSetupProc() {
console.log("Weee");
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";
@ -23,10 +24,7 @@ function preSetupProc() {
} }
vdoPlyrAtts = video.baseURI; // Used for setting up thumbnails vdoPlyrAtts = video.baseURI; // Used for setting up thumbnails
vdoPlyrAtts = vdoPlyrAtts.slice(32, 32+11); slugInputTag.value = vdoPlyrAtts.slice(32, 32+11);
slugInputTag.value = vdoPlyrAtts;
} }
function setupProc() { function setupProc() {
@ -50,7 +48,7 @@ function setupProc() {
.getElementsByClassName("style-scope ytd-masthead")[3]; // Search bar area .getElementsByClassName("style-scope ytd-masthead")[3]; // Search bar area
mainContentArea = document.getElementsByTagName("ytd-watch")[0]; // BT control insert area and bg color setup 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 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
@ -113,7 +111,8 @@ function setupProc() {
// Functions // Functions
function showThumbImageVew(e) { function showThumbImageVew(e) {
videoSlug = vdoPlyrAtts; videoSlug = video.baseURI.slice(32, 32+11); // Used for setting up thumbnails
if (ytThumbImgMenu.style.display == "block") { if (ytThumbImgMenu.style.display == "block") {
ytThumbImgMenu.style.display = "none"; ytThumbImgMenu.style.display = "none";
ytThumbnailBttn.src = browser.extension.getURL("/icons/thumbnailOff.png"); ytThumbnailBttn.src = browser.extension.getURL("/icons/thumbnailOff.png");
@ -156,13 +155,13 @@ function setLoop(e) {
} }
function toggleFloat() { function toggleFloat() {
playerWindow = document.getElementById("player-container"); // Actual player playerWindow = document.getElementById("player-container").children[1]; // 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 {
containerOfPlyrWndow.insertBefore(playerWindow, containerOfPlyrWndow.firstChild); containerOfPlyrWndow.append(playerWindow);
poppedContainer.style.display = "none"; poppedContainer.style.display = "none";
} }
} }
@ -244,3 +243,6 @@ function checkPg() {
// Start init // Start init
checkPg(); checkPg();
}
betterYoutubePlus();