And the fate of /gui is sealed

Make sure that the proper files that are not in `/gui` are loaded.
This commit is contained in:
buzz-lightsnack-2007 2024-04-15 15:49:22 +08:00
parent 527d7b6835
commit 0059314655
10 changed files with 9 additions and 82 deletions

View file

@ -1,5 +0,0 @@
# External GUI Libraries
are not included in this repository for the sake of providing authors' credit. Moreover, it's recommended to get the latest versions for as long as they do not break.
## Dependencies
- [ ] [JQuery](https://jquery.com/)

View file

@ -1,3 +0,0 @@
/* icons.js
Manage icons.
*/

View file

@ -1,27 +0,0 @@
/*
logging.JS
Send messages for logging.
*/
export default class logging {
/*
Raise an error message.
@param {number} ERROR_CODE the error code
@param {number} ERROR_MESSAGE the custom error message
*/
static error(ERROR_CODE, ERROR_MESSAGE, critical = true) {
(async () => {
// Import the templating.
const texts = (
await import(chrome.runtime.getURL("gui/scripts/read.js"))
)[`texts`];
// Display the error message.
console.error(texts.read(`error_msg`, [ERROR_CODE, ERROR_MESSAGE]));
if (critical) {
alert(texts.read(`error_msg_GUI`, [String(ERROR_CODE)]));
}
})();
}
}

View file

@ -1,38 +0,0 @@
/* read_universal
Read a file stored in the universal strings. */
let messages = {};
let message = "";
export default class texts {
/* This reads the message from its source. This is a fallback for the content scripts, who doesn't appear to read classes.
@param {string} message the message name
@param {boolean} autofill fill in the message with the template name when not found
@param {list} params the parameters
@return {string} the message
*/
static localized(message_name, autofill = false, params = []) {
if (params && (params ? params.length > 0 : false)) {
message = chrome.i18n.getMessage(message_name, params);
} else {
message = chrome.i18n.getMessage(message_name);
}
// When the message is not found, return the temporary text.
if (!message && autofill) {
message = message_name;
}
return message;
}
}
export function read(message_name, autofill, params) {
let message;
message = texts.localized(message_name, autofill, params);
return message;
}

View file

@ -5,7 +5,7 @@ import texts from "../strings/read.js";
import net from "../net.js";
// MAKE SURE TO TURN THIS OFF DURING BUILD.
let DEBUG = false;
let DEBUG = true;
export default class windowman {
static new(URL, height, width) {

View file

@ -6,8 +6,8 @@ import {read, write, forget, search} from "./secretariat.js";
import net from "./net.js";
import texts from "/scripts/strings/read.js";
import {Queue} from "./common.js";
import logging from "/gui/scripts/logging.js"
// const logging = (await import(chrome.runtime.getURL("gui/scripts/logging.js"))).default;
import logging from "/scripts/logging.js"
// const logging = (await import(chrome.runtime.getURL("/scripts/logging.js"))).default;
export default class filters {
constructor() {

View file

@ -64,7 +64,7 @@ export default class logging {
*/
static async error(ERROR_CODE, ERROR_MESSAGE, ERROR_STACK, critical = true) {
// Import the templating.
const texts = (await import(chrome.runtime.getURL("gui/scripts/read.js"))).default;
const texts = (await import(chrome.runtime.getURL("/scripts/strings/read.js"))).default;
// Display the error message.
console.error(texts.localized(`error_msg`, false, [ERROR_CODE, ERROR_MESSAGE, ERROR_STACK]));

View file

@ -13,9 +13,9 @@ Download a file from the network or locally.
*/
export default class net {
static async download(URL, TYPE, VERIFY_ONLY = false, STRICT = false) {
const texts = (await import(chrome.runtime.getURL(`gui/scripts/read.js`)))
const texts = (await import(chrome.runtime.getURL(`/scripts/strings/read.js`)))
.default;
const logging = (await import(chrome.runtime.getURL(`gui/scripts/logging.js`))).default;
const logging = (await import(chrome.runtime.getURL(`/scripts/logging.js`))).default;
let CONNECT, DATA;

View file

@ -39,7 +39,7 @@ function events(window) {
.addEventListener(`click`, async () => {
// Import the filters module.
const texts = (
await import(chrome.runtime.getURL(`gui/scripts/read.js`))
await import(chrome.runtime.getURL(`/scripts/strings/read.js`))
).default;
let filters = new (
await import(chrome.runtime.getURL(`scripts/filters.js`))
@ -59,7 +59,7 @@ function events(window) {
.addEventListener(`click`, async () => {
// Import the filters module.
const texts = (
await import(chrome.runtime.getURL(`gui/scripts/read.js`))
await import(chrome.runtime.getURL(`/scripts/strings/read.js`))
).default;
let filters = new (
await import(chrome.runtime.getURL(`scripts/filters.js`))
@ -79,7 +79,7 @@ function events(window) {
.addEventListener(`click`, async () => {
// Import the filters module.
let texts = (
await import(chrome.runtime.getURL(`gui/scripts/read.js`))
await import(chrome.runtime.getURL(`/scripts/strings/read.js`))
).default;
let filters = new (
await import(chrome.runtime.getURL(`scripts/filters.js`))