Merge branch 'development' into development-storage

This commit is contained in:
buzz-lightsnack-2007 2024-04-18 23:04:30 +08:00
commit 79c1cc54f3
4 changed files with 20 additions and 8 deletions

14
scripts/GUI/inject.js Normal file
View file

@ -0,0 +1,14 @@
export default class injection {
constructor (parent, element, id, classes, options) {
let ELEMENTS = {};
ELEMENTS[`parents`] = ((typeof parent) != `object`) ? docuent.querySelectorAll(parent) : [...parent];
// must only run if there are elements to inject
if ((ELEMENTS[`parents`]).length > 0) {
}
};
}

View file

@ -4,9 +4,6 @@ Window and window content management */
import texts from "../strings/read.js";
import net from "../net.js";
// MAKE SURE TO TURN THIS OFF DURING BUILD.
let DEBUG = true;
export default class windowman {
static new(URL, height, width) {
this.window = chrome.windows.create({url: (URL.includes(`://`)) ? URL : chrome.runtime.getURL(URL), type: "popup", width: width ? parseInt(width) : 600, height: height ? parseInt(height) : 600});
@ -35,16 +32,17 @@ export default class windowman {
metadata_element.setAttribute(`href`, source);
document.querySelector(`head`).appendChild(metadata_element);
} else {
throw new ReferenceError(new texts(`error_msg_fileNotFound`, [UI.CSS[index]]));
throw new ReferenceError((new texts(`error_msg_fileNotFound`, [source])).localized);
}
} catch(err) {
const secretariat = (await import(chrome.runtime.getURL(`/scripts/secretariat.js`)));
const logging = (await import(chrome.runtime.getURL(`/scripts/logging.js`))).default;
// Raise an alert.
logging.error(err.name, err.message, err.stack, true, [source]);
// Stop loading the page when an error has occured; it's not going to work!
if (!DEBUG) {
if ((await secretariat.read(`debug`, -1) != null) ? await secretariat.read(`debug`, -1) : true) {
window.close();
};
};

View file

View file

@ -2,9 +2,9 @@
Process the information on the website and display it on screen.
*/
// const inject = ((await import(chrome.runtime.getURL("scripts/external/inject.js"))).default);
const scraper = (await import(chrome.runtime.getURL("scripts/external/scraper.js"))).default;
const product = (await import(chrome.runtime.getURL("scripts/product.js"))).default;
import scraper from "/scripts/external/scraper.js";
import product from "/scripts/product.js";
import injection from "/scripts/GUI/inject.js"
export default class processor {
#filter;