Remove unused variables.
This commit is contained in:
ccppi 2024-05-08 13:43:29 +00:00
parent 3d3a276dd5
commit d1ed7befbc

View File

@ -2,27 +2,15 @@ let backgroundPage = browser.extension.getBackgroundPage();
var data; var data;
let i=0; let i=0;
/*
data = readUrl() browser.browserAction.onClicked.addListener(function(event1){
.then(function(data){
browser.browserAction.onClicked.addListener(function(event1){
browser.tabs.create({"url": "home.html"},function(tab){
browser.runtime.onMessage.addListener(function(request,sender,sendResponse){
handleMessages(request,sender,sendResponse,tab,data);
});
});
});
});
*/
browser.browserAction.onClicked.addListener(function(event1){
browser.tabs.create({"url": "home.html"},function(tab){ browser.tabs.create({"url": "home.html"},function(tab){
browser.runtime.onMessage.addListener(function(request,sender,sendResponse){ browser.runtime.onMessage.addListener(function(request,sender,sendResponse){
handleMessages(request,sender,sendResponse,tab); handleMessages(request,sender,sendResponse,tab);
}); });
}); });
}); });
function handleMessages(message,sender,sendResponse,tab){ function handleMessages(message,sender,sendResponse,tab){
if(message === "Button_clicked") if(message === "Button_clicked")
{ {
browser.tabs.executeScript(tab.id,{ browser.tabs.executeScript(tab.id,{
@ -34,7 +22,6 @@ function handleMessages(message,sender,sendResponse,tab){
else if(message === "Content_Loaded") else if(message === "Content_Loaded")
{ {
console.log("Background: Received Content_Loaded"); console.log("Background: Received Content_Loaded");
// nextUrl(data,tab,i);
if(i===0) if(i===0)
{ {
browser.tabs.sendMessage(tab.id,"Init"); browser.tabs.sendMessage(tab.id,"Init");
@ -73,7 +60,7 @@ function handleMessages(message,sender,sendResponse,tab){
} }
} }
} }
//----depreacted -vv
function readUrl() function readUrl()
{ {
let data; let data;
@ -88,7 +75,7 @@ function readUrl()
return res.json(); return res.json();
}) })
.then((data) => { .then((data) => {
for(let i=0;i<i;i++) //i in data.subscriptions) for(let i=0;i<i;i++) //wtf why does this work?
{ {
let open=null; let open=null;
console.log(data.subscriptions[i].url); console.log(data.subscriptions[i].url);