23 lines
617 B
JavaScript
23 lines
617 B
JavaScript
chrome.action.onClicked.addListener(async (tab) => {
|
|
try {
|
|
// Inject the modules and then execute the main function
|
|
await chrome.scripting.executeScript({
|
|
target: { tabId: tab.id },
|
|
files: ["fields.js"],
|
|
world: "MAIN"
|
|
});
|
|
await chrome.scripting.executeScript({
|
|
target: { tabId: tab.id },
|
|
files: ["dom.js"],
|
|
world: "MAIN"
|
|
});
|
|
await chrome.scripting.executeScript({
|
|
target: { tabId: tab.id },
|
|
files: ["main.js"],
|
|
world: "MAIN"
|
|
});
|
|
} catch (error) {
|
|
console.error("Error injecting scripts:", error);
|
|
}
|
|
});
|