This commit is contained in:
Jonathan Wyss 2024-03-17 01:11:26 +01:00
parent 2485aab123
commit fee1b77f1c
2 changed files with 20 additions and 10 deletions

View File

@ -17,6 +17,16 @@
"background":{
"scripts": ["background.js"]
},
"host_permissions":["*://youtube.com/*"]
"host_permissions":["*://youtube.com/*"],
"content_scripts": [
{
"matches": [
"*://youtube.com/*"
],
"js": [
"spawn.js"
]
}
]
}

View File

@ -2,15 +2,9 @@
//1.grant host permission
//
//
browser.runtime.onMessage.addListener(function (message,listener)
browser.runtime.onMessage.addListener(() =>
{
handle(message);
});
//if(number>0)
function handle(message)
{
console.log("inside handler");
console.log("inside handler");
if(message.state != "Init")//on init only load page
{
document.getElementsByClassName("yt-spec-button-shape-next yt-spec-button-shape-next--filled yt-spec-button-shape-next--mono yt-spec-button-shape-next--size-m")[0].click();
@ -19,5 +13,11 @@ function handle(message)
let url = message.url;
console.log(url);
window.location.replace(url);
// window.location = url;
});
//if(number>0)
function handle(message)
{
// window.location = url;
}