From 1ce38450c9d6973852147bc46846d452b8195064 Mon Sep 17 00:00:00 2001
From: stweedo <108593831+stweedo@users.noreply.github.com>
Date: Tue, 9 May 2023 04:47:32 -0500
Subject: [PATCH 1/2] update interface.html
Removed `document.write` usage
Added better font handling
Added confirmation message
---
apps/shadowclk/interface.html | 100 ++++++++++++++++++++++++++++------
1 file changed, 83 insertions(+), 17 deletions(-)
diff --git a/apps/shadowclk/interface.html b/apps/shadowclk/interface.html
index 7c4692aed..036e7d624 100644
--- a/apps/shadowclk/interface.html
+++ b/apps/shadowclk/interface.html
@@ -78,31 +78,34 @@
#upload {
margin-top: 20px;
}
+
+ #message {
+ text-align: center;
+ }
-
+
3-Bit Color Picker
-
-
-
+
-
+
From 51a5defac9f4520e6c21d40b7380a36204966661 Mon Sep 17 00:00:00 2001
From: stweedo <108593831+stweedo@users.noreply.github.com>
Date: Tue, 9 May 2023 05:23:55 -0500
Subject: [PATCH 2/2] Add files via upload
Meant to use this one instead
---
apps/shadowclk/interface.html | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/apps/shadowclk/interface.html b/apps/shadowclk/interface.html
index 036e7d624..b914e0163 100644
--- a/apps/shadowclk/interface.html
+++ b/apps/shadowclk/interface.html
@@ -281,7 +281,21 @@
// Update UI with loaded settings
let previewBox = document.getElementById("preview-box");
previewBox.style.backgroundColor = isDarkBg ? "black" : "white";
- drawText(selectedColor);
+
+ (function () {
+ // Load fonts before drawing for the first time
+ function loadFont(font) {
+ return document.fonts.load(font);
+ }
+
+ Promise.all([
+ loadFont('81px Londrina Solid'),
+ loadFont('81px Londrina Shadow'),
+ loadFont('19px DotGothic16')
+ ]).then(() => {
+ drawText(selectedColor);
+ });
+ })();
// Start updating the time every second after loading the settings
updateTime();
@@ -326,7 +340,11 @@
}, 5000);
});
- (function() {
+ // Call loadSettings when the page loads
+ loadSettings();
+
+ // Fallback to defaults if we can't load settings
+ (function () {
// Load fonts before drawing for the first time
function loadFont(font) {
return document.fonts.load(font);
@@ -340,9 +358,6 @@
drawText(selectedColor);
});
})();
-
- // Call loadSettings when the page loads
- loadSettings();