This commit is contained in:
ccppi 2024-03-18 11:39:52 +01:00
parent 68514f7f68
commit 96be5a4418

View File

@ -8,7 +8,9 @@ readUrl();
function Setup(data) function Setup(data)
{ {
let i=0; let i=0;
browser.browserAction.onClicked.addListener(create); browser.browserAction.onClicked.addListener(function(event){
create(data);
});
} }
var create = (function(data){ var create = (function(data){
@ -17,11 +19,16 @@ var create = (function(data){
browser.runtime.onMessage.addListener((message)=>{ browser.runtime.onMessage.addListener((message)=>{
if(message === "Button_clicked") if(message === "Button_clicked")
{ {
nextUrl(data,tab,i);
console.log("pass tab data to run, in promise"); console.log("pass tab data to run, in promise");
console.log(tab); console.log(tab);
} }
else if(message === "Content_Loaded")
{
console.log("Received Content_Loaded");
nextUrl(data,tab,i);
}
}); });
}); });
}); });
@ -38,6 +45,7 @@ async function nextUrl(data,tab,i)
code1 = `window.location.replace("${data.subscriptions[i].url}");` code1 = `window.location.replace("${data.subscriptions[i].url}");`
console.log(code1); console.log(code1);
await browser.tabs.update(tab.tabid,{url : data.subscriptions[i].url}); await browser.tabs.update(tab.tabid,{url : data.subscriptions[i].url});
await waitforTab(tab,data.subscriptions[i].url);
console.log(tab); console.log(tab);
console.log("iterating"); console.log("iterating");
console.log(i); console.log(i);