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>
<head>
<title for="extension_name"></title>
<script src="../styles/external/materialize/js/materialize.js"></script>
<script src="../scripts/pages/popup.js" type="module"></script>
<link href="/styles/popup.css" rel="stylesheet" type="text/css" />
</head>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,7 +1,6 @@
<html>
<head>
<script src="../../styles/external/materialize/js/materialize.js"></script>
<script src="../../scripts/pages/settings.js" type="module"></script>
<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 {URLs} from "/scripts/utils/URLs.js";
import wait from "/scripts/utils/wait.js";
import logging from "/scripts/logging.js";
import UI from "/scripts/GUI/builder/windowman.extras.js";
export default class windowman {
@ -20,8 +21,8 @@ export default class windowman {
function headers (OPTIONS) {
let LOAD_STATE = true;
let UI = {
"CSS": ["/styles/external/fonts/materialdesignicons.min.css", "/styles/external/materialize/css/materialize.css", "/styles/ui.css"],
"scripts": ["/styles/external/materialize/js/materialize.js"]
"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": ["/scripts/external/materialize.min.js"]
};
// Add additional sources.
@ -61,6 +62,15 @@ export default class windowman {
ELEMENT.setAttribute(key, METADATA[key]);
});
document.querySelector(`head`).appendChild(ELEMENT);
if (source.includes(`materialize`) && source.includes(`js`)) {
ELEMENT.onload = () => {
M.AutoInit();
};
ELEMENT.onerror = (err) => {
logging.error(err);
};
};
})
: false;

View file

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