clean upd code and comments

This commit is contained in:
ccppi 2024-03-19 08:19:57 +01:00
parent e18ce05d99
commit bb5b01e027

View File

@ -1,22 +1,6 @@
//1.grant host permission
//
//
//document.addEventListener("DOMContentLoaded",function(){
browser.runtime.sendMessage("Content_Loaded"); browser.runtime.sendMessage("Content_Loaded");
browser.runtime.onMessage.addListener(worker); browser.runtime.onMessage.addListener(worker);
//});
// return Promise.resolve(true);
/*.then(function(){
window.location.replace(url);
});*/
function test(msg) function test(msg)
{ {
console.log(`Spawn: received message:${msg}`); console.log(`Spawn: received message:${msg}`);
@ -28,7 +12,7 @@ function worker(message)
console.log("inside handler"); console.log("inside handler");
console.log(message); console.log(message);
setTimeout(() => { setTimeout(() => {
if(message != "Init")//on init only load page if(message != "Init")//on init only load page
{ {
let element = 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]; let element = 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];
@ -41,14 +25,8 @@ setTimeout(() => {
{ {
console.log("element not found, already in Abo"); console.log("element not found, already in Abo");
} }
console.log(message); console.log(message);
} }
browser.runtime.sendMessage("finished"); browser.runtime.sendMessage("finished");
},5000); },5000);
let url = message;
console.log(url);
} }