create PWA

This commit is contained in:
Lurkars 2024-05-05 08:02:29 +02:00
parent 027e223e7e
commit 21aefb1710
2 changed files with 31 additions and 4 deletions

View File

@ -2,13 +2,30 @@
<html lang="en"> <html lang="en">
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>RPG Dices</title> <title>RPG Dices</title>
<meta name="viewport" content="width=device-width,initial-scale=1"> <meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="theme-color" content="#ffffff" />
<meta name="apple-mobile-web-app-status-bar" content="#ffffff" />
<link rel="apple-touch-icon" href="assets/icons/icon-72x72.png" />
<link rel="apple-touch-icon" href="assets/icons/icon-96x96.png" />
<link rel="apple-touch-icon" href="assets/icons/icon-128x128.png" />
<link rel="apple-touch-icon" href="assets/icons/icon-144x144.png" />
<link rel="apple-touch-icon" href="assets/icons/icon-152x152.png" />
<link rel="apple-touch-icon" href="assets/icons/icon-192x192.png" />
<link rel="apple-touch-icon" href="assets/icons/icon-384x384.png" />
<link rel="apple-touch-icon" href="assets/icons/icon-512x512.png" />
<link rel="manifest" href="manifest.json" />
<link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="style.css">
<script src="js/libs/moment.js"></script> <script src="js/libs/moment.js"></script>
<script src="js/libs/sidebar/sidebar.js"></script> <script src="js/libs/sidebar/sidebar.js"></script>
<link href="js/libs/sidebar/sidebar.css" type="text/css" rel="stylesheet" /> <link href="js/libs/sidebar/sidebar.css" type="text/css" rel="stylesheet" />
<style>
</style>
<body> <body>
<label id="sidebar-toggle" class="sidebar-toggle" for="sidebar-toggle-input"><img src="./assets/menu.svg"></label> <label id="sidebar-toggle" class="sidebar-toggle" for="sidebar-toggle-input"><img src="./assets/menu.svg"></label>

View File

@ -472,3 +472,13 @@ if (darkMode) {
document.getElementById("dark-mode-icon").src = "./assets/light.svg"; document.getElementById("dark-mode-icon").src = "./assets/light.svg";
document.getElementById("dark-mode-text").innerText = "Light Mode"; document.getElementById("dark-mode-text").innerText = "Light Mode";
} }
if ("serviceWorker" in navigator) {
window.addEventListener("load", function() {
navigator.serviceWorker
.register("/sw.js")
.then(res => console.trace("service worker registered"))
.catch(err => console.error("service worker not registered", err))
})
}