22 lines
548 B
JavaScript
22 lines
548 B
JavaScript
"use strict";
|
|
|
|
async function toggleLildra(tab) {
|
|
if (!tab?.id) return;
|
|
|
|
try {
|
|
await chrome.scripting.executeScript({
|
|
target: { tabId: tab.id },
|
|
files: ["lildra.js"]
|
|
});
|
|
} catch (error) {
|
|
console.warn("Lildra could not run on this page:", error);
|
|
}
|
|
}
|
|
|
|
chrome.action.onClicked.addListener(toggleLildra);
|
|
chrome.commands.onCommand.addListener(async (command) => {
|
|
if (command !== "toggle-lildra") return;
|
|
const [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
|
|
await toggleLildra(tab);
|
|
});
|