From c1e64bf0ccdaeb1b676f1a53967b0d0448e1ca44 Mon Sep 17 00:00:00 2001 From: alyx <alyx@aleteoryx.me> Date: Thu, 2 Jun 2022 00:26:49 +0000 Subject: basic PWA things, fixed the searcher again --- index.html | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'index.html') diff --git a/index.html b/index.html index 9b24973..26592e1 100644 --- a/index.html +++ b/index.html @@ -2,9 +2,22 @@ <html> <head> <title>Placeholder</title> + <link rel="manifest" href="/pwathings/manifest.json" /> + <link rel="manifest" href="/pwathings/manifest.json" /> + <script> + var reg; + window.addEventListener("load", async function() { + reg = await navigator.serviceWorker.getRegistrations(); + if (reg.length) document.getElementById("enabler").innerText = "Click to refresh the Service Worker!"; + }); + const reloader = () => Promise.all(reg.map(r => r.unregister())).then(() => navigator.serviceWorker.register('/worker.js', {scope: '/'})); + </script> </head> <body> - <a href="/searcher">Chip Searcher</a> - <a href="/grapher">Chip Grapher</a> + <ul> + <li><a href="/searcher">Chip Searcher</a></li> + <li><a href="/grapher">Chip Grapher</a></li> + <li><button id="enabler" onclick="reloader();">Click to enable offline use!</button></li> + </ul> </body> </html> \ No newline at end of file -- cgit v1.2.3-70-g09d2