Browse Source

Initial webapp manifest

Trevor Elliott 3 years ago
parent
commit
a640228c9e
3 changed files with 31 additions and 0 deletions
  1. 11 0
      js/index.js
  2. 19 0
      static/manifest.json
  3. 1 0
      templates/main.mustache

+ 11 - 0
js/index.js

@@ -67,4 +67,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>