From a9e60aad2e7aea760b1a1c0ad17d3b471690f749 Mon Sep 17 00:00:00 2001
From: buzz-lightsnack-2007
<73412182+buzz-lightsnack-2007@users.noreply.github.com>
Date: Wed, 22 May 2024 23:24:24 +0800
Subject: [PATCH] run materialize directly after import
---
src/pages/popup.htm | 1 -
src/pages/popup/error.htm | 1 -
src/pages/popup/hello.htm | 1 -
src/pages/popup/load.htm | 1 -
src/pages/popup/results.htm | 1 -
src/pages/settings.htm | 3 +--
src/pages/settings/filters.htm | 1 -
src/scripts/GUI/builder/windowman.js | 14 ++++++++++++--
src/scripts/pages/page.js | 8 ++------
9 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/src/pages/popup.htm b/src/pages/popup.htm
index 174ad91..a330d0a 100644
--- a/src/pages/popup.htm
+++ b/src/pages/popup.htm
@@ -1,7 +1,6 @@
-
diff --git a/src/pages/popup/error.htm b/src/pages/popup/error.htm
index d071c35..89053ff 100644
--- a/src/pages/popup/error.htm
+++ b/src/pages/popup/error.htm
@@ -1,6 +1,5 @@
-
diff --git a/src/pages/popup/hello.htm b/src/pages/popup/hello.htm
index 9c64806..c9b6fc6 100644
--- a/src/pages/popup/hello.htm
+++ b/src/pages/popup/hello.htm
@@ -2,7 +2,6 @@
-
diff --git a/src/pages/popup/load.htm b/src/pages/popup/load.htm
index 70dd85f..78cc85c 100644
--- a/src/pages/popup/load.htm
+++ b/src/pages/popup/load.htm
@@ -1,6 +1,5 @@
-
diff --git a/src/pages/popup/results.htm b/src/pages/popup/results.htm
index 74827e0..cb25340 100644
--- a/src/pages/popup/results.htm
+++ b/src/pages/popup/results.htm
@@ -1,6 +1,5 @@
-
diff --git a/src/pages/settings.htm b/src/pages/settings.htm
index 806a492..0eb2611 100644
--- a/src/pages/settings.htm
+++ b/src/pages/settings.htm
@@ -1,8 +1,7 @@
-
-
+
diff --git a/src/pages/settings/filters.htm b/src/pages/settings/filters.htm
index e12f574..80cebfc 100644
--- a/src/pages/settings/filters.htm
+++ b/src/pages/settings/filters.htm
@@ -1,7 +1,6 @@
-
diff --git a/src/scripts/GUI/builder/windowman.js b/src/scripts/GUI/builder/windowman.js
index 5dc1d07..30b8e51 100644
--- a/src/scripts/GUI/builder/windowman.js
+++ b/src/scripts/GUI/builder/windowman.js
@@ -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;
diff --git a/src/scripts/pages/page.js b/src/scripts/pages/page.js
index baf8441..82a1c4d 100644
--- a/src/scripts/pages/page.js
+++ b/src/scripts/pages/page.js
@@ -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();
- });
- }
+ };
+ };
};
\ No newline at end of file