]> git.zndr.dk Git - zndr-11ty.git/commitdiff
Add site manifest
authorJannik ZANDER <jzander@grundfos.com>
Mon, 8 Sep 2025 20:09:28 +0000 (22:09 +0200)
committerJannik ZANDER <jzander@grundfos.com>
Mon, 8 Sep 2025 20:09:28 +0000 (22:09 +0200)
site/assets/styles.css
site/index.njk
site/public/apple-touch-icon.png
site/public/icon-192.png
site/public/icon-512.png
site/public/site.webmanifest

index a0d39d368646fab11e89899722dab0c0c52e4f30..a44108eda5f9f99dbbcf64e11f3c7b0439230bcc 100644 (file)
@@ -1,5 +1,3 @@
-/* === zndr.dk — (dark-first) === */
-
 /* ---------- Dark mode (defaults) ---------- */
 :root{
   --bg:#1a1b1e;          /* page background */
@@ -92,18 +90,18 @@ header{display:flex;align-items:center;justify-content:space-between;gap:16px;ma
   border:none;
 }
 
-/* Static dim for LAN-only / offline (stripe overlay FIXED) */
-.card.is-lan,.card.is-offline{opacity:.85;position:relative}
-.card.is-lan::after,.card.is-offline::after{
-  content:'';                      /* REQUIRED */
-  position:absolute; inset:0;      /* REQUIRED */
-  pointer-events:none;
-  border-radius:10px;
-  background:repeating-linear-gradient(
+/* Neutral stripe overlay for LAN-only / offline cards */
+.card.is-lan::after,
+.card.is-offline::after {
+  content: '';
+  position: absolute;
+  inset: 0;
+  pointer-events: none;
+  border-radius: 10px;
+  background: repeating-linear-gradient(
     45deg,
-    transparent 0 6px,
-    rgba(16,163,127,.08) 6px 9px,
-    rgba(239,68,68,.08) 9px 12px
+    transparent 0 12px,
+    rgba(255, 255, 255, 0.08) 12px 24px
   );
 }
 
@@ -156,12 +154,14 @@ footer{
   .card{background:var(--panel);border:1px solid var(--ring);box-shadow:none}
   .card:hover{box-shadow:0 4px 10px rgba(0,0,0,.10)}
 
-  /* If you prefer a neutral chip in light mode, uncomment:
-  .chip{background:#eef2f7;color:#0f172a;border:1px solid #dfe3ea}
-  */
-
-  .card.is-lan::after,.card.is-offline::after{
-    background:repeating-linear-gradient(45deg,transparent 0 6px, rgba(0,0,0,.03) 6px 12px);
+  /* Light mode adjustment: stronger contrast */
+  .card.is-lan::after,
+  .card.is-offline::after {
+    background: repeating-linear-gradient(
+      45deg,
+      transparent 0 12px,
+      rgba(0, 0, 0, 0.08) 12px 24px
+    );
   }
 }
 
index efa58e4d39a53a86939fc2d4fdac085e9c236042..9a281d461ddfbf6ed10d6ff324a51ccc8cd90f1e 100644 (file)
@@ -17,3 +17,58 @@ title: zndr.dk — Services
   {% endfor %}
 </main>
 
+<script>
+(function () {
+  const TIMEOUT_MS = 3500;
+
+  // Find all cards that have a URL to test
+  const cards = Array.from(document.querySelectorAll('.card[data-url]'));
+
+  function markOnline(card) {
+    // If it was previously flagged offline (e.g. navigation back), clear it
+    card.classList.remove('is-offline');
+    card.removeAttribute('title');
+  }
+
+  function markOffline(card, reason) {
+    card.classList.add('is-offline');
+    card.title = reason || 'This service did not respond from your current network.';
+  }
+
+  cards.forEach(card => {
+    const base = card.getAttribute('data-url') || '';
+    const custom = card.getAttribute('data-probe'); // optional custom path like "/api/health"
+    let probeUrl;
+
+    try {
+      const u = new URL(base);
+
+      // Don’t try to fetch http:// from an https:// page (mixed-content would block)
+      if (location.protocol === 'https:' && u.protocol !== 'https:') {
+        markOffline(card, 'Blocked mixed-content (HTTP) from HTTPS page.');
+        return;
+      }
+
+      // Build probe URL: custom path (same origin) or /favicon.ico
+      probeUrl = (custom ? (u.origin + custom) : (u.origin + '/favicon.ico')) + '?t=' + Date.now();
+
+      const img = new Image();
+      const timer = setTimeout(() => {
+        img.src = ''; // cancel
+        markOffline(card, 'Timed out.');
+      }, TIMEOUT_MS);
+
+      img.onload = () => { clearTimeout(timer); markOnline(card); };
+      img.onerror = () => { clearTimeout(timer); markOffline(card, 'Probe failed.'); };
+
+      img.referrerPolicy = 'no-referrer';
+      img.decoding = 'async';
+      img.src = probeUrl;
+
+    } catch (e) {
+      markOffline(card, 'Invalid URL.');
+    }
+  });
+})();
+</script>
+
index 3fd5a7e59ebcda85371d4bc450f6d09958793d54..d58a2f33f88239433a8c8b70e0a828fd3b4d8e42 100644 (file)
Binary files a/site/public/apple-touch-icon.png and b/site/public/apple-touch-icon.png differ
index 1197271357938640da44ec30b926300091f57ce5..db803c21f36c5b08f23b7f7153c22c1ce4c23771 100644 (file)
Binary files a/site/public/icon-192.png and b/site/public/icon-192.png differ
index 78aae0f4497379a928e7987235696b2ac73b482e..d34f913faf7db651f61a1a332c2bdca91fb59556 100644 (file)
Binary files a/site/public/icon-512.png and b/site/public/icon-512.png differ
index bd1cf5a151eab1772221adad8a0746564324de09..e32cfa67bc97576d60adaf09c209ce0cc28ad5cf 100644 (file)
@@ -2,16 +2,8 @@
   "name": "zndr.dk",
   "short_name": "zndr",
   "icons": [
-    {
-      "src": "/icon-192.png",
-      "sizes": "192x192",
-      "type": "image/png"
-    },
-    {
-      "src": "/icon-512.png",
-      "sizes": "512x512",
-      "type": "image/png"
-    }
+    { "src": "/icon-192.png", "sizes": "192x192", "type": "image/png", "purpose": "maskable any" },
+    { "src": "/icon-512.png", "sizes": "512x512", "type": "image/png", "purpose": "maskable any" }
   ],
   "start_url": "/",
   "display": "standalone",