diff options
| author | caleb.mabry.15@cnu.edu <caleb.mabry.15@cnu.edu> | 2022-03-07 00:33:14 -0500 |
|---|---|---|
| committer | caleb.mabry.15@cnu.edu <caleb.mabry.15@cnu.edu> | 2022-03-07 00:33:14 -0500 |
| commit | 7beba90d2ef87005fe6e12a4786101ea97c5e4fd (patch) | |
| tree | 0f39ee8bacdc6f7933db04789b309631052b9778 /webAO | |
| parent | ccbca8b9cede972480dd1ef7a73db71a99be9609 (diff) | |
Now 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 | 29 |
6 files changed, 65 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..aba104a --- /dev/null +++ b/webAO/sw.js @@ -0,0 +1,29 @@ +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 + return 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 => { + return response || fetch(event.request); + }) + ); +}); |
