20 lines
576 B
JavaScript
20 lines
576 B
JavaScript
|
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);
|