add offline status detection
This commit is contained in:
+24
@@ -1,4 +1,28 @@
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Détection de l'état de connexion
|
||||
function updateOnlineStatus() {
|
||||
const offlineIndicator = document.querySelector('.offline-indicator');
|
||||
|
||||
if (!navigator.onLine) {
|
||||
if (!offlineIndicator) {
|
||||
const indicator = document.createElement('div');
|
||||
indicator.className = 'offline-indicator show';
|
||||
indicator.textContent = 'Mode hors ligne - Fonctionnalités limitées';
|
||||
document.body.insertBefore(indicator, document.body.firstChild);
|
||||
}
|
||||
} else {
|
||||
if (offlineIndicator) {
|
||||
offlineIndicator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Écouter les changements de connexion
|
||||
window.addEventListener('online', updateOnlineStatus);
|
||||
window.addEventListener('offline', updateOnlineStatus);
|
||||
|
||||
// Vérifier l'état initial
|
||||
updateOnlineStatus();
|
||||
// Gestion du menu mobile
|
||||
const mobileMenuToggle = document.querySelector('.mobile-menu-toggle');
|
||||
const mobileMenu = document.querySelector('.mobile-menu');
|
||||
|
||||
Reference in New Issue
Block a user