Add basic PWA support

pull/77/head
Jason Halvorson 2024-04-08 20:22:15 -07:00 committed by Samuel H
parent a9040edc84
commit 0ac58c3349
4 changed files with 41 additions and 1 deletions

View File

@ -41,6 +41,12 @@ body {
z-index: 3;
}
@media (orientation: portrait) {
#dpad, #apad {
bottom: calc(1rem + env(safe-area-inset-bottom));
}
}
#dpad {
left: 1rem;
}

View File

@ -10,7 +10,7 @@
<meta property="og:description" content="A Pokémon fangame heavily inspired by the roguelite genre. Battle endlessly while gathering stacking items, exploring many different biomes, and reaching Pokémon stats you never thought possible." />
<meta property="og:image" content="https://pokerogue.net/logo.png" />
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
<style type="text/css">
@font-face {
font-family: 'emerald';
@ -23,6 +23,21 @@
}
</style>
<link rel="stylesheet" type="text/css" href="index.css" />
<link rel="manifest" href="manifest.json" />
<script>
if ("serviceWorker" in navigator) {
window.addEventListener("load", function () {
navigator.serviceWorker.register("/service-worker.js").then(
function (registration) {
console.log("ServiceWorker registration successful");
},
function (err) {
console.log("ServiceWorker registration failed: ", err);
},
);
});
}
</script>
</head>
<body>

16
manifest.json Normal file
View File

@ -0,0 +1,16 @@
{
"name": "PokéRogue",
"short_name": "PokéRogue",
"description": "A Pokémon fangame heavily inspired by the roguelite genre. Battle endlessly while gathering stacking items, exploring many different biomes, and reaching Pokémon stats you never thought possible.",
"start_url": "/",
"display": "standalone",
"background_color": "#8c8c8c",
"theme_color": "#8c8c8c",
"icons": [
{
"src": "../logo.png",
"sizes": "128x128",
"type": "image/png"
}
]
}

3
service-worker.js Normal file
View File

@ -0,0 +1,3 @@
self.addEventListener('install', function () {
console.log('Service worker installing...');
});