diff options
| author | stonedDiscord <Tukz@gmx.de> | 2022-03-09 07:36:18 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-09 07:36:18 +0100 |
| commit | 679bc9be8b0459d298ac1ac3f3b7e61278c184d9 (patch) | |
| tree | 7025ffb3527bf78fd100a1f1bb9bf6aaa7752470 /webAO | |
| parent | 91c3769a78e59924a73db6c759844a9026e8da00 (diff) | |
| parent | 68169fb20e0406a3bf90ff6a56acb7c1b5a7ed5f (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.png | bin | 29302 -> 28737 bytes | |||
| -rw-r--r-- | webAO/index.html | 13 | ||||
| -rw-r--r-- | webAO/logo-new-512.png | bin | 0 -> 238578 bytes | |||
| -rw-r--r-- | webAO/logo-new.png | bin | 0 -> 29302 bytes | |||
| -rw-r--r-- | webAO/manifest.json | 23 | ||||
| -rw-r--r-- | webAO/sw.js | 26 |
6 files changed, 62 insertions, 0 deletions
diff --git a/webAO/images/logo-new.png b/webAO/images/logo-new.png Binary files differindex f53fe30..26e04aa 100644 --- a/webAO/images/logo-new.png +++ b/webAO/images/logo-new.png 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 Binary files differnew file mode 100644 index 0000000..33fd586 --- /dev/null +++ b/webAO/logo-new-512.png diff --git a/webAO/logo-new.png b/webAO/logo-new.png Binary files differnew file mode 100644 index 0000000..f53fe30 --- /dev/null +++ b/webAO/logo-new.png 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)), + ); +}); |
