clean upd code and comments
This commit is contained in:
parent
e18ce05d99
commit
bb5b01e027
32
spawn.js
32
spawn.js
@ -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,10 +12,10 @@ 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];
|
||||||
if (element != null)
|
if (element != null)
|
||||||
{
|
{
|
||||||
element.click();
|
element.click();
|
||||||
@ -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);
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user