Spaces:
Running
Running
Commit
·
611e0a5
1
Parent(s):
6fa48cc
הוספת כפתור התקן את האפליקציה
Browse files- index.html +35 -2
index.html
CHANGED
@@ -748,6 +748,17 @@ https://bit.ly/a-tools
|
|
748 |
|
749 |
<!-- <span>© 2025 כל הזכויות שמורות לשגיא בר און.</span> -->
|
750 |
<div class="container mx-auto px-4 py-3 text-center space-y-2">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
751 |
<div class="flex justify-center gap-4">
|
752 |
<!-- אייקונים -->
|
753 |
<a
|
@@ -1801,8 +1812,7 @@ https://bit.ly/a-tools
|
|
1801 |
});
|
1802 |
}
|
1803 |
}
|
1804 |
-
|
1805 |
-
<script>
|
1806 |
if ('serviceWorker' in navigator) {
|
1807 |
navigator.serviceWorker
|
1808 |
.register('/service-worker.js')
|
@@ -1811,6 +1821,29 @@ https://bit.ly/a-tools
|
|
1811 |
console.error('Service Worker registration failed:', err)
|
1812 |
);
|
1813 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1814 |
</script>
|
1815 |
|
1816 |
<!-- /* --------------------------------- */
|
|
|
748 |
|
749 |
<!-- <span>© 2025 כל הזכויות שמורות לשגיא בר און.</span> -->
|
750 |
<div class="container mx-auto px-4 py-3 text-center space-y-2">
|
751 |
+
<!-- כפתור התקנת אפליקציה -->
|
752 |
+
<div id="installAppContainer" class="flex justify-center">
|
753 |
+
<button
|
754 |
+
id="installAppBtn"
|
755 |
+
class="mt-2 px-4 py-2 rounded-xl bg-gradient-to-br from-green-500 to-emerald-600 text-white font-bold shadow hover:scale-105 transition"
|
756 |
+
style="display: none"
|
757 |
+
>
|
758 |
+
📲 התקן את האפליקציה
|
759 |
+
</button>
|
760 |
+
</div>
|
761 |
+
|
762 |
<div class="flex justify-center gap-4">
|
763 |
<!-- אייקונים -->
|
764 |
<a
|
|
|
1812 |
});
|
1813 |
}
|
1814 |
}
|
1815 |
+
|
|
|
1816 |
if ('serviceWorker' in navigator) {
|
1817 |
navigator.serviceWorker
|
1818 |
.register('/service-worker.js')
|
|
|
1821 |
console.error('Service Worker registration failed:', err)
|
1822 |
);
|
1823 |
}
|
1824 |
+
|
1825 |
+
let deferredPrompt;
|
1826 |
+
const installBtn = document.getElementById('installAppBtn');
|
1827 |
+
const container = document.getElementById('installAppContainer');
|
1828 |
+
|
1829 |
+
window.addEventListener('beforeinstallprompt', (e) => {
|
1830 |
+
e.preventDefault();
|
1831 |
+
deferredPrompt = e;
|
1832 |
+
installBtn.style.display = 'inline-block';
|
1833 |
+
|
1834 |
+
installBtn.addEventListener('click', () => {
|
1835 |
+
deferredPrompt.prompt();
|
1836 |
+
deferredPrompt.userChoice.then((choiceResult) => {
|
1837 |
+
if (choiceResult.outcome === 'accepted') {
|
1838 |
+
console.log('User accepted the A2HS prompt');
|
1839 |
+
installBtn.style.display = 'none';
|
1840 |
+
} else {
|
1841 |
+
console.log('User dismissed the A2HS prompt');
|
1842 |
+
}
|
1843 |
+
deferredPrompt = null;
|
1844 |
+
});
|
1845 |
+
});
|
1846 |
+
});
|
1847 |
</script>
|
1848 |
|
1849 |
<!-- /* --------------------------------- */
|