diff --git a/public/index.html b/public/index.html index 364fe01..5230a9c 100644 --- a/public/index.html +++ b/public/index.html @@ -16,7 +16,7 @@ đ STOP ALL - v1.201 + v1.203 đ„ INSTALLER diff --git a/public/script.js b/public/script.js index 5568919..17fabe3 100644 --- a/public/script.js +++ b/public/script.js @@ -4,28 +4,38 @@ let deferredPrompt; const installBtn = document.getElementById('installBtn'); + const isFirefox = typeof InstallTrigger !== 'undefined'; window.addEventListener('beforeinstallprompt', (e) => { - // EmpĂȘche Chrome d'afficher sa propre mini-barre - e.preventDefault(); - // Stocke l'Ă©vĂ©nement pour l'utiliser plus tard - deferredPrompt = e; - // Affiche votre bouton personnalisĂ© - installBtn.style.display = 'block'; + // EmpĂȘche Chrome d'afficher sa propre mini-barre + e.preventDefault(); + // Stocke l'Ă©vĂ©nement pour l'utiliser plus tard + deferredPrompt = e; + // Affiche votre bouton personnalisĂ© + installBtn.style.display = 'block'; - installBtn.addEventListener('click', async () => { - if (deferredPrompt) { - // Montre la fenĂȘtre d'installation native - deferredPrompt.prompt(); - // Attend la rĂ©ponse de l'utilisateur - const { outcome } = await deferredPrompt.userChoice; - console.log(`L'utilisateur a rĂ©pondu : ${outcome}`); - // On nettoie - deferredPrompt = null; - installBtn.style.display = 'none'; + installBtn.addEventListener('click', async () => { + if (deferredPrompt) { + // Montre la fenĂȘtre d'installation native + deferredPrompt.prompt(); + // Attend la rĂ©ponse de l'utilisateur + const { outcome } = await deferredPrompt.userChoice; + console.log(`L'utilisateur a rĂ©pondu : ${outcome}`); + // On nettoie + deferredPrompt = null; + installBtn.style.display = 'none'; + } + }); + }); + + if (isFirefox && !window.matchMedia('(display-mode: standalone)').matches) { + // On peut par exemple afficher un petit texte dans le header + const infoZone = document.getElementById('app-version'); // On utilise la zone de version + if (infoZone) { + infoZone.innerHTML += " (Install. non dispo sur Firefox PC)"; + infoZone.style.color = "#ff8800"; // Orange pour attirer l'oeil gentiment } - }); - }); + } // Cache le bouton si l'app est dĂ©jĂ installĂ©e window.addEventListener('appinstalled', () => { @@ -196,6 +206,7 @@ init(); if ('serviceWorker' in navigator) { - navigator.serviceWorker.register('sw.js') - .then(() => console.log("Service Worker EnregistrĂ©")); - } \ No newline at end of file + navigator.serviceWorker.register('sw.js') + .then(() => console.log("Service Worker EnregistrĂ©")); + } + \ No newline at end of file diff --git a/public/sw.js b/public/sw.js index 6eed1fa..952ffda 100644 --- a/public/sw.js +++ b/public/sw.js @@ -1,4 +1,4 @@ -const CACHE_NAME = 'sb-v1.201'; // Change ce numĂ©ro pour forcer une mise Ă jour globale +const CACHE_NAME = 'sb-v1.203'; // Change ce numĂ©ro pour forcer une mise Ă jour globale const ASSETS = [ './', // Racine './index.html',