From 43322a8208b178ace7218556c679a12c72a5ebab Mon Sep 17 00:00:00 2001 From: buzz-lightsnack-2007 <73412182+buzz-lightsnack-2007@users.noreply.github.com> Date: Sun, 28 Apr 2024 13:11:05 +0800 Subject: [PATCH] rename watchman to watch, and rename content to be part of background --- manifest.json | 6 +----- scripts/external/background.js | 14 ++++++++++++++ scripts/external/content.js | 14 -------------- scripts/external/watch.js | 4 ++-- 4 files changed, 17 insertions(+), 21 deletions(-) create mode 100644 scripts/external/background.js delete mode 100644 scripts/external/content.js diff --git a/manifest.json b/manifest.json index a245c06..337bb4a 100644 --- a/manifest.json +++ b/manifest.json @@ -8,12 +8,8 @@ "permissions": ["tabs", "storage", "unlimitedStorage", "contextMenus"], "action": { - "default_icon": "media/icons/logo_no_tiny.png", "default_popup": "pages/popup.htm" }, - "side_panel": { - "default_path": "pages/popup.htm" - }, "background": { "service_worker": "scripts/background/shopAI.js", "type": "module" @@ -22,7 +18,7 @@ "content_scripts": [ { "matches": ["http://*/*", "https://*/*"], - "js": ["scripts/external/content.js"] + "js": ["scripts/external/background.js"] } ], "web_accessible_resources": [ diff --git a/scripts/external/background.js b/scripts/external/background.js new file mode 100644 index 0000000..4bd494e --- /dev/null +++ b/scripts/external/background.js @@ -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(); +})() \ No newline at end of file diff --git a/scripts/external/content.js b/scripts/external/content.js deleted file mode 100644 index 7eae7d1..0000000 --- a/scripts/external/content.js +++ /dev/null @@ -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(); -})() \ No newline at end of file diff --git a/scripts/external/watch.js b/scripts/external/watch.js index f542f9d..1b2ad87 100644 --- a/scripts/external/watch.js +++ b/scripts/external/watch.js @@ -8,7 +8,7 @@ import logging from "/scripts/logging.js"; import texts from "/scripts/mapping/read.js"; import {read} from "/scripts/secretariat.js"; -export default class watchman { +export default class watch { /* Open relevant graphical user interfaces. */ static callGUI() { @@ -33,7 +33,7 @@ export default class watchman { }); } - static job() { + static main() { /* The main action. */ (check.platform()).then((RULES) => { if (RULES && Object.keys(RULES).length > 0) {