Quellcode durchsuchen

Initial webapp manifest

Trevor Elliott vor 3 Jahren
Ursprung
Commit
8c7415fe16
3 geänderte Dateien mit 31 neuen und 0 gelöschten Zeilen
  1. 11 0
      js/index.js
  2. 19 0
      static/manifest.json
  3. 1 0
      templates/main.mustache

+ 11 - 0
js/index.js

@@ -66,4 +66,15 @@ document.addEventListener("DOMContentLoaded", () => {
       return false;
     }
   });
+
 });
+
+if ('serviceWorker' in navigator) {
+  navigator.serviceWorker
+    .register('/static/serviceWorker.js')
+    .then(function(registration) {
+      console.log("ServiceWorker registration successful with scope: ", registration.scope);
+    }).catch(function(err) {
+      console.log("ServiceWorker registration failed: ", err);
+    });
+}

+ 19 - 0
static/manifest.json

@@ -0,0 +1,19 @@
+{
+  "short_name": "Lament Configuration",
+  "name": "Lament Configuration",
+  "start_url": "/",
+  "scope": "/",
+  "display": "minimal-ui",
+  "icons": [
+    {
+      "src": "/static/lc_192.png",
+      "type": "image/png",
+      "sizes": "192x192"
+    },
+    {
+      "src": "/static/lc_512.png",
+      "type": "image/png",
+      "sizes": "512x512"
+    }
+  ]
+}

+ 1 - 0
templates/main.mustache

@@ -6,6 +6,7 @@
     <title>Lament Configuration</title>
     <link rel="stylesheet" type="text/css" href="/static/main.css" />
     <link rel="stylesheet" type="text/css" href="/static/tagify.css" />
+    <link rel="manifest" href="/static/manifest.json" />
     <script type="text/javascript" src="/static/lc.js"></script>
   </head>
   <body>