major moving around of files

This commit is contained in:
buzz-lightsnack-2007 2024-03-25 12:39:38 +08:00
parent 4686f89010
commit 8f0f7fb923
15 changed files with 303 additions and 240 deletions

View file

@ -6,17 +6,20 @@ import texts from "./read.JS";
class windowman {
/* Initialize the window frame. */
static prepare() {
try {
let UI = {'library': chrome.runtime.getURL('gui/styles/interface.external.css'), 'script': chrome.runtime.getURL('gui/scripts/external/interface.external.js')};
try {
let UI = {'library': [chrome.runtime.getURL('gui/styles/interface.external.css'), chrome.runtime.getURL('gui/styles/ui.css')], 'script': chrome.runtime.getURL('gui/scripts/external/interface.external.js')};
$(`head`).append(`<link rel="stylesheet" type="text/css" href="${UI.library}">`);
$(`head`).append(`<script type="module" src="${UI.script}"></script>`);
} catch(error) {
console.error(texts.localized(`error_fileNotFound`, [error]));
}
(UI.library).forEach((source) => {
$(`head`).append(`<link rel="stylesheet" type="text/css" href="${source}">`);
})
// Prevent scaling, similar to a real window.
$(`head`).append(`<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />`);
$(`head`).append(`<script type="module" src="${UI.script}"></script>`);
} catch(error) {
console.error(texts.localized(`error_fileNotFound`, [error]));
}
// Prevent scaling, similar to a real window.
$(`head`).append(`<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />`);
}
@ -28,6 +31,22 @@ class windowman {
height: (height) ? height: 600,
});
}
static fill() {
function text() {
let text_elements = document.querySelectorAll("[data-text]");
text_elements.forEach((text_element) => {
let text_inserted = texts.localized(text_element.getAttribute(`data-text`), (text_element.hasAttribute(`data-text-parameter`)) ? eval(text_element.getAttribute(`data-text-parameter`)) : null );
if (!text_inserted) {text_inserted = texts.localized(`term_`.concat(text_element.getAttribute(`data-text`)));}
text_element.innerText = text_inserted;
})
}
text();
}
}
export {windowman};