run materialize directly after import

This commit is contained in:
buzz-lightsnack-2007 2024-05-22 23:24:24 +08:00
parent 27757a5a36
commit a9e60aad2e
9 changed files with 15 additions and 16 deletions

View file

@ -1,7 +1,6 @@
<html> <html>
<head> <head>
<title for="extension_name"></title> <title for="extension_name"></title>
<script src="../styles/external/materialize/js/materialize.js"></script>
<script src="../scripts/pages/popup.js" type="module"></script> <script src="../scripts/pages/popup.js" type="module"></script>
<link href="/styles/popup.css" rel="stylesheet" type="text/css" /> <link href="/styles/popup.css" rel="stylesheet" type="text/css" />
</head> </head>

View file

@ -1,6 +1,5 @@
<html> <html>
<head> <head>
<script src="/styles/external/materialize/js/materialize.js"></script>
<script src="/scripts/pages/error.js" type="module"></script> <script src="/scripts/pages/error.js" type="module"></script>
</head> </head>
<body id="error"> <body id="error">

View file

@ -2,7 +2,6 @@
<head> <head>
<title for="hello"></title> <title for="hello"></title>
<script src="/scripts/pages/hello.js" type="module"></script> <script src="/scripts/pages/hello.js" type="module"></script>
<script src="/styles/external/materialize/js/materialize.js"></script>
</head> </head>
<body> <body>
<main class="container"> <main class="container">

View file

@ -1,6 +1,5 @@
<html> <html>
<head> <head>
<script src="../../styles/external/materialize/js/materialize.js"></script>
<script src="../../scripts/pages/popup.js" type="module"></script> <script src="../../scripts/pages/popup.js" type="module"></script>
</head> </head>
<body class="loading"> <body class="loading">

View file

@ -1,6 +1,5 @@
<html> <html>
<head> <head>
<script src="../../styles/external/materialize/js/materialize.js"></script>
<script src="../../scripts/pages/results.js" type="module"></script> <script src="../../scripts/pages/results.js" type="module"></script>
<link href="../../styles/popup.css" rel="stylesheet" type="text/css" /> <link href="../../styles/popup.css" rel="stylesheet" type="text/css" />
</head> </head>

View file

@ -1,8 +1,7 @@
<html> <html>
<head> <head>
<script src="../scripts/pages/settings.js" type="module"></script> <script src="../scripts/pages/settings.js" type="module"></script>
<script src="../styles/external/materialize/js/materialize.js"></script>
<title for="term_preferences"></title> <title for="term_preferences"></title>
</head> </head>

View file

@ -1,7 +1,6 @@
<html> <html>
<head> <head>
<script src="../../styles/external/materialize/js/materialize.js"></script>
<script src="../../scripts/pages/settings.js" type="module"></script> <script src="../../scripts/pages/settings.js" type="module"></script>
<link href="/styles/preferences.css" rel="stylesheet" /> <link href="/styles/preferences.css" rel="stylesheet" />

View file

@ -6,6 +6,7 @@ import Tabs from "/scripts/GUI/tabs.js";
import {global, background} from "/scripts/secretariat.js"; import {global, background} from "/scripts/secretariat.js";
import {URLs} from "/scripts/utils/URLs.js"; import {URLs} from "/scripts/utils/URLs.js";
import wait from "/scripts/utils/wait.js"; import wait from "/scripts/utils/wait.js";
import logging from "/scripts/logging.js";
import UI from "/scripts/GUI/builder/windowman.extras.js"; import UI from "/scripts/GUI/builder/windowman.extras.js";
export default class windowman { export default class windowman {
@ -20,8 +21,8 @@ export default class windowman {
function headers (OPTIONS) { function headers (OPTIONS) {
let LOAD_STATE = true; let LOAD_STATE = true;
let UI = { let UI = {
"CSS": ["/styles/external/fonts/materialdesignicons.min.css", "/styles/external/materialize/css/materialize.css", "/styles/ui.css"], "CSS": ["https://cdn.jsdelivr.net/npm/@mdi/font@7.4.47/css/materialdesignicons.min.css", "https://cdn.jsdelivr.net/npm/@materializecss/materialize@2.0.3-alpha/dist/css/materialize.min.css", "/styles/ui.css"],
"scripts": ["/styles/external/materialize/js/materialize.js"] "scripts": ["/scripts/external/materialize.min.js"]
}; };
// Add additional sources. // Add additional sources.
@ -61,6 +62,15 @@ export default class windowman {
ELEMENT.setAttribute(key, METADATA[key]); ELEMENT.setAttribute(key, METADATA[key]);
}); });
document.querySelector(`head`).appendChild(ELEMENT); document.querySelector(`head`).appendChild(ELEMENT);
if (source.includes(`materialize`) && source.includes(`js`)) {
ELEMENT.onload = () => {
M.AutoInit();
};
ELEMENT.onerror = (err) => {
logging.error(err);
};
};
}) })
: false; : false;

View file

@ -14,10 +14,6 @@ export default class Page {
this.window.manager.sync(); this.window.manager.sync();
Object.assign(this.window, this.window[`manager`]); Object.assign(this.window, this.window[`manager`]);
} };
};
document.addEventListener("DOMContentLoaded", function () {
M.AutoInit();
});
}
}; };