This commit is contained in:
2019-04-20 17:30:49 +02:00
parent 7cf7582560
commit ecb9ea25f7
8 changed files with 90 additions and 4 deletions

45
Web/ServiceWorker.js Normal file
View File

@@ -0,0 +1,45 @@
var cacheName = 'CandyFucker-v2';
var filesToCache = [
'./index.html',
'./style.css',
'./code/CandyFucker.js',
'./code/GameLib.js',
'./gfx/BallsBlue.png',
'./gfx/BallsCyan.png',
'./gfx/BallsGreen.png',
'./gfx/BallsRed.png',
'./gfx/BallsYellow.png',
'./gfx/favicon.ico',
'./gfx/favicon.png',
'./gfx/FragsBlue.png',
'./gfx/FragsCyan.png',
'./gfx/FragsGreen.png',
'./gfx/FragsRed.png',
'./gfx/FragsYellow.png',
'./gfx/logo.png',
//'../sfx/explosion1.wav',
//'../sfx/pickcandy.wav',
//'../sfx/swapinvalid.wav',
];
self.addEventListener('install', function (e) {
console.log('[ServiceWorker] Install');
e.waitUntil(
caches.open(cacheName).then(function (cache) {
console.log('[ServiceWorker] Caching app shell');
return cache.addAll(filesToCache);
})
);
});
self.addEventListener('activate', event => {
event.waitUntil(self.clients.claim());
});
self.addEventListener('fetch', event => {
event.respondWith(
caches.match(event.request, { ignoreSearch: true }).then(response => {
return response || fetch(event.request);
})
);
});

BIN
Web/icons/icon-128.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

BIN
Web/icons/icon-144.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

BIN
Web/icons/icon-152.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

BIN
Web/icons/icon-192.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

BIN
Web/icons/icon-512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@@ -1,13 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Candy Fucker</title>
<link rel="shortcut icon" href="gfx/favicon.ico" type="image/x-icon" />
<meta name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta name="theme-color" content="#000000"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<link href="style.css" type="text/css" rel="stylesheet" />
<link rel="manifest" href="manifest.json">
</head>
<body>
<div id="divLogo">
<img src="gfx/logo.png" alt="Candy Fucker" />
@@ -19,7 +22,14 @@
<script src="code/GameLib.js"></script>
<script src="code/CandyFucker.js"></script>
<script>
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('ServiceWorker.js')
.then(function () {
console.log('Service Worker Registered');
});
}
new CandyFucker("cnvScreen", "divInfoDisplay");
</script>
</body>
</html>

31
Web/manifest.json Normal file
View File

@@ -0,0 +1,31 @@
{
"name": "Candy Fucker",
"short_name": "Candy Fucker",
"icons": [{
"src": "icons/icon-128.png",
"sizes": "128x128",
"type": "image/png"
}, {
"src": "icons/icon-144.png",
"sizes": "144x144",
"type": "image/png"
}, {
"src": "icons/icon-152.png",
"sizes": "152x152",
"type": "image/png"
}, {
"src": "icons/icon-192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "icons/icon-512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"start_url": "index.html",
"display": "standalone",
"background_color": "#000000",
"theme_color": "#000000"
}