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 changes the background color to light grey for easier viewing of the pages.
|
||||
|
||||
# Version: 1.1.2
|
||||
This version improves thumbnail generation and separates its steps from the Youtube DOM.
|
||||
# Download
|
||||
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,
|
||||
"name": "Better Youtube +",
|
||||
"version": "1.1.2",
|
||||
"version": "1.2.0",
|
||||
"description": "Enhancements for Youtube to have a better experience.",
|
||||
|
||||
"applications": {
|
||||
|
@ -11,7 +11,6 @@
|
|||
},
|
||||
|
||||
"permissions": [
|
||||
"activeTab",
|
||||
"*://*.youtube.com/*",
|
||||
"tabs"
|
||||
],
|
||||
|
@ -21,18 +20,5 @@
|
|||
"96": "icons/betterYoutube_96.png"
|
||||
},
|
||||
|
||||
"options_ui": { "page": "pages/options.html" },
|
||||
|
||||
"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"
|
||||
]
|
||||
|
||||
"background": { "scripts": ["scripts/background.js"] }
|
||||
}
|
||||
|
|
|
@ -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 vdoPlyrAtts; // Player attributes
|
||||
var part, videoSlug, temp; // Image part
|
||||
var count = 0;
|
||||
|
||||
function preSetupProc() {
|
||||
poppedContainer = document.createElement("DIV");
|
||||
|
@ -34,9 +35,9 @@ function preSetupProc() {
|
|||
ytEnhancerMenu.appendChild(ytLoopBttn);
|
||||
ytEnhancerMenu.appendChild(ytFloatBttn);
|
||||
|
||||
ytThumbnailBttn.src = browser.extension.getURL("icons/thumbnailOff.png");
|
||||
ytLoopBttn.src = browser.extension.getURL("icons/loopFalse.png");
|
||||
ytFloatBttn.src = browser.extension.getURL("icons/floatPlayer.png");
|
||||
ytThumbnailBttn.src = browser.extension.getURL("/icons/thumbnailOff.png");
|
||||
ytLoopBttn.src = browser.extension.getURL("/icons/loopFalse.png");
|
||||
ytFloatBttn.src = browser.extension.getURL("/icons/floatPlayer.png");
|
||||
|
||||
// Insert
|
||||
document.body.appendChild(poppedContainer);
|
||||
|
@ -68,6 +69,7 @@ function preSetupProc() {
|
|||
ytThumbnailBttn.className = "imageStyle";
|
||||
ytLoopBttn.className = "imageStyle";
|
||||
ytFloatBttn.className = "imageStyle";
|
||||
ytEnhancerMenu.id = "enhancerMenuIDRef";
|
||||
poppedContainer.id = "draggable";
|
||||
poppedContainer.style.display = "none";
|
||||
mastHead.style = "background: #868686;";
|
||||
|
@ -82,13 +84,13 @@ function showThumbImageVew(e) {
|
|||
videoSlug = vdoPlyrAtts;
|
||||
if (ytThumbImgMenu.style.display == "block") {
|
||||
ytThumbImgMenu.style.display = "none";
|
||||
ytThumbnailBttn.src = browser.extension.getURL("icons/thumbnailOff.png");
|
||||
ytThumbnailBttn.src = browser.extension.getURL("/icons/thumbnailOff.png");
|
||||
} else {
|
||||
ytAMaxDefaultImg.href = part + videoSlug + "/maxresdefault.jpg";
|
||||
ytAHqDefaultImg.href = part + videoSlug + "/hqdefault.jpg";
|
||||
ytMaxDefaultImg.src = part + videoSlug + "/maxresdefault.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";
|
||||
}
|
||||
return;
|
||||
|
@ -97,10 +99,10 @@ function showThumbImageVew(e) {
|
|||
function setLoop(e) {
|
||||
if (video.loop == false) {
|
||||
video.loop = true;
|
||||
ytLoopBttn.src = browser.extension.getURL("icons/loopTrue.png");
|
||||
ytLoopBttn.src = browser.extension.getURL("/icons/loopTrue.png");
|
||||
} else {
|
||||
video.loop = false;
|
||||
ytLoopBttn.src = browser.extension.getURL("icons/loopFalse.png");
|
||||
ytLoopBttn.src = browser.extension.getURL("/icons/loopFalse.png");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -164,16 +166,30 @@ function dragVideo(elmnt) {
|
|||
function pauseEvent(e) {
|
||||
if(e.stopPropagation) e.stopPropagation();
|
||||
if(e.preventDefault) e.preventDefault();
|
||||
e.cancelBubble=true;
|
||||
e.returnValue=false;
|
||||
e.cancelBubble = true;
|
||||
e.returnValue = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Start init
|
||||
var existCondition = setInterval(function() {
|
||||
if ($('#masthead-container').length) {
|
||||
function checkPg() {
|
||||
if (!document.getElementById("enhancerMenuIDRef")) {
|
||||
var existCondition = setInterval(function() {
|
||||
if (document.getElementById("masthead-container")) {
|
||||
clearInterval(existCondition);
|
||||
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