Feat: PWA-Implementierung - Offline-Funktionalität hinzugefügt

This commit is contained in:
2025-03-18 16:16:47 +01:00
parent 35645fc671
commit 4c69478fa8
5 changed files with 200 additions and 1 deletions

View File

@@ -5,6 +5,12 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>medisoftware Kundensuche</title>
<link rel="icon" type="image/x-icon" href="{{ url_for('static', filename='favicon.ico') }}">
<link rel="manifest" href="{{ url_for('static', filename='manifest.json') }}">
<meta name="theme-color" content="#4CAF50">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="MEDI">
<link rel="apple-touch-icon" href="{{ url_for('static', filename='images/icon-192x192.png') }}">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" rel="stylesheet">
<link href="{{ url_for('static', filename='css/styles.css') }}" rel="stylesheet">
@@ -105,6 +111,28 @@
</footer>
<script>
// Service Worker Registrierung
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('/sw.js')
.then(registration => {
console.log('ServiceWorker registration successful');
})
.catch(err => {
console.log('ServiceWorker registration failed: ', err);
});
});
}
// Offline-Status-Überwachung
window.addEventListener('online', function() {
document.body.classList.remove('offline');
});
window.addEventListener('offline', function() {
document.body.classList.add('offline');
});
let searchTimeout;
let lastResults = [];