chore: remove content script and update manifest for service worker

This commit is contained in:
2025-06-23 14:25:21 +03:00
parent 28e6b933c7
commit e34c6637f1
3 changed files with 17 additions and 11 deletions

10
background.js Normal file
View File

@@ -0,0 +1,10 @@
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
if (changeInfo.status === "complete" && /^https?:/.test(tab.url)) {
chrome.scripting.executeScript({
target: { tabId },
files: ["main.js"]
}).catch(err => {
console.warn("Injection failed:", err);
});
}
});

View File

View File

@@ -5,23 +5,19 @@
"description": "Highlight text on web pages", "description": "Highlight text on web pages",
"default_locale": "en", "default_locale": "en",
"permissions": [ "permissions": [
"scripting",
"storage" "storage"
], ],
"host_permissions": [
"<all_urls>"
],
"action": { "action": {
"default_popup": "popup/popup.html", "default_popup": "popup/popup.html",
"default_icon": "icons/icon128.png" "default_icon": "icons/icon128.png"
}, },
"content_scripts": [ "background": {
{ "service_worker": "background.js"
"matches": [ },
"<all_urls>"
],
"js": [
"content.js"
],
"run_at": "document_idle"
}
],
"icons": { "icons": {
"48": "icons/icon48.png", "48": "icons/icon48.png",
"128": "icons/icon128.png" "128": "icons/icon128.png"