diff --git a/config.toml b/config.toml
index 4df3611..c061e8f 100644
--- a/config.toml
+++ b/config.toml
@@ -1,6 +1,6 @@
base_url = "/"
title = "M-Labs"
-description = ""
+description = "M-Labs is a company and community who develops, manufactures and sells advanced open hardware devices and solutions. e.g Milkymist system-on-chip (SoC)"
compile_sass = true
highlight_code = true
diff --git a/static/android-icon-512x512.png b/static/android-icon-512x512.png
new file mode 100644
index 0000000..ab265eb
Binary files /dev/null and b/static/android-icon-512x512.png differ
diff --git a/static/js/as.js b/static/js/as.js
new file mode 100644
index 0000000..ead3917
--- /dev/null
+++ b/static/js/as.js
@@ -0,0 +1,40 @@
+(function () {
+
+ var swRegistration;
+ var newWorker;
+ var isRefreshing = false;
+ var pathname = window.location.pathname;
+ var deferredPrompt;
+
+ window.addEventListener('beforeinstallprompt', (e) => {
+ console.log('[AS] Before install prompt');
+ // Prevent Chrome 67 and earlier from automatically showing the prompt
+ e.preventDefault();
+ // Stash the event so it can be triggered later.
+ deferredPrompt = e;
+ });
+
+ if ('serviceWorker' in navigator) {
+ console.info('Service Worker is supported');
+
+ window.addEventListener('load', function () {
+ navigator.serviceWorker.register('/sw.js', {
+ updateViaCache: 'all',
+ }).then(function (registration) {
+ swRegistration = registration;
+ console.log('[SW] registration successful with scope: ', swRegistration.scope);
+ console.log('[SW] is waiting: ', swRegistration.waiting);
+
+ navigator.serviceWorker.addEventListener('controllerchange', function () {
+ if (isRefreshing) {
+ return;
+ }
+ window.location.reload();
+ isRefreshing = true;
+ });
+ }, function (err) {
+ console.log('[SW] registration failed: ', err);
+ });
+ });
+ }
+})();
diff --git a/static/manifest.json b/static/manifest.json
index 013d4a6..b8b9a35 100755
--- a/static/manifest.json
+++ b/static/manifest.json
@@ -1,41 +1,51 @@
{
- "name": "App",
- "icons": [
- {
- "src": "\/android-icon-36x36.png",
- "sizes": "36x36",
- "type": "image\/png",
- "density": "0.75"
- },
- {
- "src": "\/android-icon-48x48.png",
- "sizes": "48x48",
- "type": "image\/png",
- "density": "1.0"
- },
- {
- "src": "\/android-icon-72x72.png",
- "sizes": "72x72",
- "type": "image\/png",
- "density": "1.5"
- },
- {
- "src": "\/android-icon-96x96.png",
- "sizes": "96x96",
- "type": "image\/png",
- "density": "2.0"
- },
- {
- "src": "\/android-icon-144x144.png",
- "sizes": "144x144",
- "type": "image\/png",
- "density": "3.0"
- },
- {
- "src": "\/android-icon-192x192.png",
- "sizes": "192x192",
- "type": "image\/png",
- "density": "4.0"
- }
- ]
+ "name": "M-Labs",
+ "short_name": "M-Labs",
+ "start_url": "/",
+ "background_color": "#fff",
+ "display": "standalone",
+ "theme_color": "#715ec7",
+ "icons": [
+ {
+ "src": "\/android-icon-36x36.png",
+ "sizes": "36x36",
+ "type": "image\/png",
+ "density": "0.75"
+ },
+ {
+ "src": "\/android-icon-48x48.png",
+ "sizes": "48x48",
+ "type": "image\/png",
+ "density": "1.0"
+ },
+ {
+ "src": "\/android-icon-72x72.png",
+ "sizes": "72x72",
+ "type": "image\/png",
+ "density": "1.5"
+ },
+ {
+ "src": "\/android-icon-96x96.png",
+ "sizes": "96x96",
+ "type": "image\/png",
+ "density": "2.0"
+ },
+ {
+ "src": "\/android-icon-144x144.png",
+ "sizes": "144x144",
+ "type": "image\/png",
+ "density": "3.0"
+ },
+ {
+ "src": "\/android-icon-192x192.png",
+ "sizes": "192x192",
+ "type": "image\/png",
+ "density": "4.0"
+ },
+ {
+ "src": "\/android-icon-512x512.png",
+ "sizes": "512x512",
+ "type": "image\/png"
+ }
+ ]
}
\ No newline at end of file
diff --git a/static/sw.js b/static/sw.js
new file mode 100644
index 0000000..062ee68
--- /dev/null
+++ b/static/sw.js
@@ -0,0 +1,48 @@
+var CACHE_NAME = 'ml-02';
+var urlsToCache = [
+ '/css/bootstrap-4.3.1.min.css',
+ '/css/styles.css',
+ '/js/jquery-3.3.1.slim.min.js',
+ '/js/bootstrap-4.3.1.min.js',
+ '/js/popper-1.14.7.min.js',
+ '/js/hammer-2.0.8.js',
+ '/js/three-r76.js',
+ '/js/SolveSpaceControls.js',
+ '/js/SolveSpaceControls.js',
+ '/js/models/kf25.js',
+ '/js/models/viewport.js',
+ '/js/models/multiport.js',
+ '/js/models/chamber.js',
+ '/js/models/k526s-body.js',
+ '/js/models/k526s-head.js',
+ '/js/models/k526s-fixture.js',
+ '/js/models/k526s-adapter.js',
+ '/js/models/k526s-adapter-assy.js',
+];
+
+self.addEventListener('install', function(event) {
+ console.log('[SW] Install');
+ event.waitUntil(
+ caches.open(CACHE_NAME)
+ .then(function(cache) {
+ console.log('[SW] add to cache');
+ return cache.addAll(urlsToCache);
+ })
+ );
+});
+
+self.addEventListener('fetch', function (event) {
+ console.log('[SW] Fetch');
+ event.respondWith(
+ caches.match(event.request).then(function (response) {
+ return response || fetch(event.request);
+ })
+ );
+});
+
+self.addEventListener('message', function (event) {
+ if (event.data.action === 'skipWaiting') {
+ self.skipWaiting();
+ caches.delete(CACHE_NAME);
+ }
+});
\ No newline at end of file
diff --git a/templates/_base.html b/templates/_base.html
index ee34c42..8f02bae 100644
--- a/templates/_base.html
+++ b/templates/_base.html
@@ -21,6 +21,7 @@
{% block meta %}{% endblock meta %}
+
@@ -41,8 +42,6 @@
-
-
{% block styles %}{% endblock %}
@@ -120,6 +119,25 @@
{% endblock %}
+
+
+