diff --git a/scripts/external/content.js b/scripts/external/content.js new file mode 100644 index 0000000..d246bfb --- /dev/null +++ b/scripts/external/content.js @@ -0,0 +1,14 @@ +/* +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")); + + // Begin the job. + watchman.job(); +}) \ No newline at end of file diff --git a/scripts/external/watch.js b/scripts/external/watch.js index 2f1c1df..7fee19e 100644 --- a/scripts/external/watch.js +++ b/scripts/external/watch.js @@ -2,68 +2,61 @@ Be sensitive to changes and update the state. */ -let main = (async () => { - // Import modules. - let filters = new ((await import(chrome.runtime.getURL("scripts/filters.js"))).default); - const processor = (await import(chrome.runtime.getURL("scripts/external/processor.js"))).default; - const logging = (await import(chrome.runtime.getURL("scripts/logging.js"))).default; - const texts = (await import(chrome.runtime.getURL("scripts/strings/read.js"))).default; +import filters from "/scripts/filters.js"; +import processor from "/scripts/external/processor.js"; +import logging from "/scripts/logging.js"; +import texts from "/scripts/mapping/read.js"; - class watchman { - /* Check the current URL. - @param {string} URL the page URL; default value is the current webpage - @return {dictionary} the filter to follow - */ - static async observe(URL = window.location.href) { - // Create the variable to determine the corresponding key. - let activity = await filters.select(URL); +export default class watchman { + /* Check the current URL. - return activity; - } - - /* Act on the page. - - @param {dictionary} filters the filter to work with - @return {boolean} the state + @param {string} URL the page URL; default value is the current webpage + @return {dictionary} the filter to follow */ - static act(matches) { - // Let user know that the website is supported, if ever they have opened the console. - new logging((new texts(`message_external_supported`)).localized); - // Show loading screen while the load is incomplete. - - - // Begin only when the page is fully loaded. - window.addEventListener(`DOMContentLoaded`, (event) => { - // Begin processing. - let PROC = new processor(matches); - - // Remove the loading screen. - - }); - } + static async observe(URL = window.location.href) { + // Create the variable to determine the corresponding key. + let activity = await (new filters).select(URL); - /* Set the program to standby utnil next load. - */ - static standby() { - // Set the icon to indicate that it's not active. - } - - static async job() { - /* The main action. */ - - (watchman.observe()).then((RULES) => { - if (RULES && Object.keys(RULES).length !== 0) { - watchman.act(RULES); - } else { - watchman.standby(); - } - }); - } + return activity; } - watchman.job(); -}); + /* Act on the page. + @param {dictionary} filters the filter to work with + @return {boolean} the state + */ + static act(matches) { + // Let user know that the website is supported, if ever they have opened the console. + new logging((new texts(`message_external_supported`)).localized); + // Show loading screen while the load is incomplete. + + + // Begin only when the page is fully loaded. + window.addEventListener(`DOMContentLoaded`, (event) => { + // Begin processing. + let PROC = new processor(matches); + + // Remove the loading screen. + + }); + } -main(); + /* Set the program to standby utnil next load. + */ + static standby() { + // Set the icon to indicate that it's not active. + } + + static async job() { + /* The main action. */ + + (watchman.observe()).then((RULES) => { + if (RULES && Object.keys(RULES).length !== 0) { + watchman.act(RULES); + } else { + watchman.standby(); + } + }); + } +} \ No newline at end of file