This version is a big overhaul and change in logic plus cleansup code styling.
This commit is contained in:
19
src/scripts/background.js
Normal file
19
src/scripts/background.js
Normal file
@@ -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);
|
Reference in New Issue
Block a user