This version is a big overhaul and change in logic plus cleansup code styling.
This commit is contained in:
parent
57ae036aea
commit
eb64dfcab6
|
@ -8,5 +8,8 @@ Better Youtube + works to improve the Youtube experience by providing quick acce
|
||||||
* It allows volume control through the mouse-wheel when hovering over the player.
|
* It allows volume control through the mouse-wheel when hovering over the player.
|
||||||
* It changes the background color to light grey for easier viewing of the pages.
|
* It changes the background color to light grey for easier viewing of the pages.
|
||||||
|
|
||||||
# Version: 1.1.2
|
# Download
|
||||||
This version improves thumbnail generation and separates its steps from the Youtube DOM.
|
https://addons.mozilla.org/en-US/firefox/addon/better-youtube-plus/
|
||||||
|
|
||||||
|
# Version: 1.2.0
|
||||||
|
This version is a big overhaul and change in logic plus cleansup code styling.
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"name": "Better Youtube +",
|
"name": "Better Youtube +",
|
||||||
"version": "1.1.2",
|
"version": "1.2.0",
|
||||||
"description": "Enhancements for Youtube to have a better experience.",
|
"description": "Enhancements for Youtube to have a better experience.",
|
||||||
|
|
||||||
"applications": {
|
"applications": {
|
||||||
|
@ -11,7 +11,6 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
"permissions": [
|
"permissions": [
|
||||||
"activeTab",
|
|
||||||
"*://*.youtube.com/*",
|
"*://*.youtube.com/*",
|
||||||
"tabs"
|
"tabs"
|
||||||
],
|
],
|
||||||
|
@ -21,18 +20,5 @@
|
||||||
"96": "icons/betterYoutube_96.png"
|
"96": "icons/betterYoutube_96.png"
|
||||||
},
|
},
|
||||||
|
|
||||||
"options_ui": { "page": "pages/options.html" },
|
"background": { "scripts": ["scripts/background.js"] }
|
||||||
|
|
||||||
"content_scripts": [ {
|
|
||||||
"matches": ["*://*.youtube.com/watch?v=*"],
|
|
||||||
"js": ["scripts/jquery-3.2.1.min.js", "scripts/betterYoutube.js"],
|
|
||||||
"css": ["styles/betterYoutube.css"],
|
|
||||||
"run_at": "document_end",
|
|
||||||
"all_frames": true
|
|
||||||
}],
|
|
||||||
|
|
||||||
"web_accessible_resources": [
|
|
||||||
"icons/*.png"
|
|
||||||
]
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<link rel="stylesheet" href="styles/betterYoutube.css"/>
|
|
||||||
|
|
||||||
<style media="screen">
|
|
||||||
p, li { font-size: 160%; }
|
|
||||||
</style>
|
|
||||||
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Better Youtube + works to improve the Youtube experience by providing quick access to features we'd all like to have from the get-go.
|
|
||||||
<ul>
|
|
||||||
<li>It allows quick thumbnail access of the video.</li>
|
|
||||||
<li>It allows setting the loop mode easily.</li>
|
|
||||||
<li>It allows the video to be toggled to fixed or floating with drag functionality.</li>
|
|
||||||
<li>It allows volume control through the mouse-wheel when hovering over the player.</li>
|
|
||||||
<li>It changes the background color to light grey for easier viewing of the pages.</li>
|
|
||||||
</ul>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
function handleUpdated(tabId, changeInfo, tabInfo) {
|
||||||
|
if (changeInfo.url) {
|
||||||
|
var http = "http://www.youtube.com/watch?v=";
|
||||||
|
var https = "https://www.youtube.com/watch?v=";
|
||||||
|
var url = changeInfo.url;
|
||||||
|
|
||||||
|
if (url.includes(http) || url.includes(https)) {
|
||||||
|
browser.tabs.insertCSS(tabId, {
|
||||||
|
file: "/styles/betterYoutube.css"
|
||||||
|
});
|
||||||
|
|
||||||
|
browser.tabs.executeScript(tabId, {
|
||||||
|
file: "/scripts/betterYoutube.js"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
browser.tabs.onUpdated.addListener(handleUpdated);
|
|
@ -7,6 +7,7 @@ var mastHead, mainContentArea, playerWindow; // Youtube Player conta
|
||||||
var video, containerOfPlyrWndow, 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
|
||||||
|
var count = 0;
|
||||||
|
|
||||||
function preSetupProc() {
|
function preSetupProc() {
|
||||||
poppedContainer = document.createElement("DIV");
|
poppedContainer = document.createElement("DIV");
|
||||||
|
@ -34,9 +35,9 @@ function preSetupProc() {
|
||||||
ytEnhancerMenu.appendChild(ytLoopBttn);
|
ytEnhancerMenu.appendChild(ytLoopBttn);
|
||||||
ytEnhancerMenu.appendChild(ytFloatBttn);
|
ytEnhancerMenu.appendChild(ytFloatBttn);
|
||||||
|
|
||||||
ytThumbnailBttn.src = browser.extension.getURL("icons/thumbnailOff.png");
|
ytThumbnailBttn.src = browser.extension.getURL("/icons/thumbnailOff.png");
|
||||||
ytLoopBttn.src = browser.extension.getURL("icons/loopFalse.png");
|
ytLoopBttn.src = browser.extension.getURL("/icons/loopFalse.png");
|
||||||
ytFloatBttn.src = browser.extension.getURL("icons/floatPlayer.png");
|
ytFloatBttn.src = browser.extension.getURL("/icons/floatPlayer.png");
|
||||||
|
|
||||||
// Insert
|
// Insert
|
||||||
document.body.appendChild(poppedContainer);
|
document.body.appendChild(poppedContainer);
|
||||||
|
@ -68,6 +69,7 @@ function preSetupProc() {
|
||||||
ytThumbnailBttn.className = "imageStyle";
|
ytThumbnailBttn.className = "imageStyle";
|
||||||
ytLoopBttn.className = "imageStyle";
|
ytLoopBttn.className = "imageStyle";
|
||||||
ytFloatBttn.className = "imageStyle";
|
ytFloatBttn.className = "imageStyle";
|
||||||
|
ytEnhancerMenu.id = "enhancerMenuIDRef";
|
||||||
poppedContainer.id = "draggable";
|
poppedContainer.id = "draggable";
|
||||||
poppedContainer.style.display = "none";
|
poppedContainer.style.display = "none";
|
||||||
mastHead.style = "background: #868686;";
|
mastHead.style = "background: #868686;";
|
||||||
|
@ -82,13 +84,13 @@ function showThumbImageVew(e) {
|
||||||
videoSlug = vdoPlyrAtts;
|
videoSlug = vdoPlyrAtts;
|
||||||
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");
|
||||||
} else {
|
} else {
|
||||||
ytAMaxDefaultImg.href = part + videoSlug + "/maxresdefault.jpg";
|
ytAMaxDefaultImg.href = part + videoSlug + "/maxresdefault.jpg";
|
||||||
ytAHqDefaultImg.href = part + videoSlug + "/hqdefault.jpg";
|
ytAHqDefaultImg.href = part + videoSlug + "/hqdefault.jpg";
|
||||||
ytMaxDefaultImg.src = part + videoSlug + "/maxresdefault.jpg";
|
ytMaxDefaultImg.src = part + videoSlug + "/maxresdefault.jpg";
|
||||||
ytHqDefaultImg.src = part + videoSlug + "/hqdefault.jpg";
|
ytHqDefaultImg.src = part + videoSlug + "/hqdefault.jpg";
|
||||||
ytThumbnailBttn.src = browser.extension.getURL("icons/thumbnailOn.png");
|
ytThumbnailBttn.src = browser.extension.getURL("/icons/thumbnailOn.png");
|
||||||
ytThumbImgMenu.style.display = "block";
|
ytThumbImgMenu.style.display = "block";
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -97,10 +99,10 @@ function showThumbImageVew(e) {
|
||||||
function setLoop(e) {
|
function setLoop(e) {
|
||||||
if (video.loop == false) {
|
if (video.loop == false) {
|
||||||
video.loop = true;
|
video.loop = true;
|
||||||
ytLoopBttn.src = browser.extension.getURL("icons/loopTrue.png");
|
ytLoopBttn.src = browser.extension.getURL("/icons/loopTrue.png");
|
||||||
} else {
|
} else {
|
||||||
video.loop = false;
|
video.loop = false;
|
||||||
ytLoopBttn.src = browser.extension.getURL("icons/loopFalse.png");
|
ytLoopBttn.src = browser.extension.getURL("/icons/loopFalse.png");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -170,10 +172,24 @@ function dragVideo(elmnt) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start init
|
function checkPg() {
|
||||||
|
if (!document.getElementById("enhancerMenuIDRef")) {
|
||||||
var existCondition = setInterval(function() {
|
var existCondition = setInterval(function() {
|
||||||
if ($('#masthead-container').length) {
|
if (document.getElementById("masthead-container")) {
|
||||||
clearInterval(existCondition);
|
clearInterval(existCondition);
|
||||||
preSetupProc();
|
preSetupProc();
|
||||||
|
count = 0;
|
||||||
|
} else {
|
||||||
|
if (count == 12) { // ~ 6 sec through half sec loops
|
||||||
|
clearInterval(existCondition);
|
||||||
|
count = 0;
|
||||||
|
} else {
|
||||||
|
count++;
|
||||||
}
|
}
|
||||||
}, 100); // check every 100ms
|
}
|
||||||
|
}, 500); // check every 500ms
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start init
|
||||||
|
checkPg();
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue