rename watchman to watch, and rename content to be part of background

This commit is contained in:
buzz-lightsnack-2007 2024-04-28 13:11:05 +08:00
parent 543a3d4e13
commit 43322a8208
4 changed files with 17 additions and 21 deletions

View file

@ -8,12 +8,8 @@
"permissions": ["tabs", "storage", "unlimitedStorage", "contextMenus"], "permissions": ["tabs", "storage", "unlimitedStorage", "contextMenus"],
"action": { "action": {
"default_icon": "media/icons/logo_no_tiny.png",
"default_popup": "pages/popup.htm" "default_popup": "pages/popup.htm"
}, },
"side_panel": {
"default_path": "pages/popup.htm"
},
"background": { "background": {
"service_worker": "scripts/background/shopAI.js", "type": "module" "service_worker": "scripts/background/shopAI.js", "type": "module"
@ -22,7 +18,7 @@
"content_scripts": [ "content_scripts": [
{ {
"matches": ["http://*/*", "https://*/*"], "matches": ["http://*/*", "https://*/*"],
"js": ["scripts/external/content.js"] "js": ["scripts/external/background.js"]
} }
], ],
"web_accessible_resources": [ "web_accessible_resources": [

14
scripts/external/background.js vendored Normal file
View file

@ -0,0 +1,14 @@
/*
content.js
The content script
*/
// Import the necessary modules.
(async () => {
// Import the watchman module.
let watch = (await import(chrome.runtime.getURL("scripts/external/watch.js"))).default;
// Begin the job.
watch.main();
})()

View file

@ -1,14 +0,0 @@
/*
content.js
The content script
*/
// Import the necessary modules.
(async () => {
// Import the watchman module.
let watchman = (await import(chrome.runtime.getURL("scripts/external/watch.js"))).default;
// Begin the job.
watchman.job();
})()

View file

@ -8,7 +8,7 @@ import logging from "/scripts/logging.js";
import texts from "/scripts/mapping/read.js"; import texts from "/scripts/mapping/read.js";
import {read} from "/scripts/secretariat.js"; import {read} from "/scripts/secretariat.js";
export default class watchman { export default class watch {
/* Open relevant graphical user interfaces. /* Open relevant graphical user interfaces.
*/ */
static callGUI() { static callGUI() {
@ -33,7 +33,7 @@ export default class watchman {
}); });
} }
static job() { static main() {
/* The main action. */ /* The main action. */
(check.platform()).then((RULES) => { (check.platform()).then((RULES) => {
if (RULES && Object.keys(RULES).length > 0) { if (RULES && Object.keys(RULES).length > 0) {