aboutsummaryrefslogtreecommitdiff
path: root/webAO
diff options
context:
space:
mode:
authorstonedDiscord <Tukz@gmx.de>2022-03-09 07:36:18 +0100
committerGitHub <noreply@github.com>2022-03-09 07:36:18 +0100
commit679bc9be8b0459d298ac1ac3f3b7e61278c184d9 (patch)
tree7025ffb3527bf78fd100a1f1bb9bf6aaa7752470 /webAO
parent91c3769a78e59924a73db6c759844a9026e8da00 (diff)
parent68169fb20e0406a3bf90ff6a56acb7c1b5a7ed5f (diff)
Merge pull request #98 from caleb-mabry/become-a-pwa
Turn Application into a PWA
Diffstat (limited to 'webAO')
-rw-r--r--webAO/images/logo-new.pngbin29302 -> 28737 bytes
-rw-r--r--webAO/index.html13
-rw-r--r--webAO/logo-new-512.pngbin0 -> 238578 bytes
-rw-r--r--webAO/logo-new.pngbin0 -> 29302 bytes
-rw-r--r--webAO/manifest.json23
-rw-r--r--webAO/sw.js26
6 files changed, 62 insertions, 0 deletions
diff --git a/webAO/images/logo-new.png b/webAO/images/logo-new.png
index f53fe30..26e04aa 100644
--- a/webAO/images/logo-new.png
+++ b/webAO/images/logo-new.png
Binary files differ
diff --git a/webAO/index.html b/webAO/index.html
index d3fc05f..c82cacf 100644
--- a/webAO/index.html
+++ b/webAO/index.html
@@ -26,6 +26,7 @@
content="default-src 'self' 'unsafe-inline' 'unsafe-eval' *.aceattorneyonline.com data:; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; connect-src 'self' ws:;">
<meta name="viewport" content="width=700, initial-scale=1">
+ <meta name="theme-color" content="#2c3d51">
<link href="https://fonts.googleapis.com/css?family=Poiret+One" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Oswald%7CRoboto+Condensed" rel="stylesheet">
@@ -35,6 +36,18 @@
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link rel="icon" href="images/favicon.ico">
<script src="master.b.js"></script>
+ <link rel="manifest" href="manifest.json">
+ <script>
+ if ('serviceWorker' in navigator) {
+ window.addEventListener('load', () => {
+ navigator.serviceWorker.register('../sw.js').then( () => {
+ console.log('Service Worker Registered')
+ })
+ })
+}
+ </script>
+
+
</head>
<body>
diff --git a/webAO/logo-new-512.png b/webAO/logo-new-512.png
new file mode 100644
index 0000000..33fd586
--- /dev/null
+++ b/webAO/logo-new-512.png
Binary files differ
diff --git a/webAO/logo-new.png b/webAO/logo-new.png
new file mode 100644
index 0000000..f53fe30
--- /dev/null
+++ b/webAO/logo-new.png
Binary files differ
diff --git a/webAO/manifest.json b/webAO/manifest.json
new file mode 100644
index 0000000..acda5d5
--- /dev/null
+++ b/webAO/manifest.json
@@ -0,0 +1,23 @@
+ {
+ "name": "Ace Attorney Online",
+ "short_name": "WebAO",
+ "start_url": "index.html",
+ "scope": "./",
+ "icons": [
+ {
+ "src": "/logo-new.png",
+ "sizes": "128x128",
+ "type": "image/png"
+ },
+ {
+ "src": "/logo-new-512.png",
+ "sizes": "512x512",
+ "type": "image/png",
+ "purpose": "any maskable"
+
+ }
+ ],
+ "theme_color": "#2c3d51",
+ "background_color": "#2c3d51",
+ "display": "standalone"
+ } \ No newline at end of file
diff --git a/webAO/sw.js b/webAO/sw.js
new file mode 100644
index 0000000..09a2251
--- /dev/null
+++ b/webAO/sw.js
@@ -0,0 +1,26 @@
+const cacheName = 'webAO';
+
+// Cache all the files to make a PWA
+self.addEventListener('install', (e) => {
+ e.waitUntil(
+ caches.open(cacheName).then((cache) =>
+ // Our application only has two files here index.html and manifest.json
+ // but you can add more such as style.css as your app grows
+ cache.addAll([
+ './',
+ './index.html',
+ '../manifest.json',
+ ])),
+ );
+});
+
+// Our service worker will intercept all fetch requests
+// and check if we have cached the file
+// if so it will serve the cached file
+self.addEventListener('fetch', (event) => {
+ event.respondWith(
+ caches.open(cacheName)
+ .then((cache) => cache.match(event.request, { ignoreSearch: true }))
+ .then((response) => response || fetch(event.request)),
+ );
+});