Update index.html
Browse files37 unmodified lines383940414142434445461 unmodified line48495051525354555657505859606162636465666768696 unmodified lines767778676879808182835 unmodified lines899091809293949596859798991006 unmodified lines1071081091101111121131141151161171181191201211229912312410112512612712810510612913013113213313413513613713813914037 unmodified lines <div id="iosInstallModal"> <div class="modal-content"> <h2>Установите приложение Morshen Alpha</h2> <a href="#" id="openZoomModal"> <img src="https://huggingface.co/spaces/Morshen/alpha/resolve/main/pwa_ios.png" alt="Инструкция по установке PWA на iOS"> <img src="https://huggingface.co/spaces/Morshen/alpha/resolve/main/pwa_ios.png" alt="Инструкция по установке PWA на iOS"> </a> <p>1. Нажмите кнопку "Поделиться" внизу Safari.</p> <p>2. Выберите "На экран «Домой»".</p> <p>3. Подтвердите установку.</p>1 unmodified line </div> </div>
<!-- Модальное окно для увеличения изображения --> <div id="imageZoomModal"> <span id="closeZoomModal">×</span> <img id="zoomedImage" src="" alt="Увеличенное изображение"> </div>
<script> let deferredPrompt; let deferredPrompt; const installButton = document.getElementById('installButton'); const iosInstallPrompt = document.getElementById('iosInstallPrompt'); const iosInstallModal = document.getElementById('iosInstallModal'); const closeIosModal = document.getElementById('closeIosModal'); const openZoomModal = document.getElementById('openZoomModal'); // Добавлено const imageZoomModal = document.getElementById('imageZoomModal'); // Добавлено const closeZoomModal = document.getElementById('closeZoomModal'); // Добавлено const zoomedImage = document.getElementById('zoomedImage'); // Добавлено
function isIos() { return /iphone|ipad|ipod/i.test(navigator.userAgent);6 unmodified lines window.addEventListener('beforeinstallprompt', (event) => { event.preventDefault(); deferredPrompt = event; installButton.style.display = 'block'; installButton.classList.add('pulse-animation'); installButton.style.display = 'block'; installButton.classList.add('pulse-animation');
installButton.addEventListener('click', async () => { deferredPrompt.prompt();5 unmodified lines } deferredPrompt = null; installButton.style.display = 'none'; installButton.classList.remove('pulse-animation'); installButton.classList.remove('pulse-animation'); }); });
if (isIos() && !isInStandaloneMode()) { iosInstallPrompt.style.display = 'block'; iosInstallPrompt.style.display = 'block'; installButton.style.display = 'none'; iosInstallPrompt.classList.add('pulse-animation');
6 unmodified lines iosInstallModal.style.display = 'none'; });
// Открытие модального окна с увеличенным изображением openZoomModal.addEventListener('click', (event) => { event.preventDefault(); // Предотвращаем переход по ссылке zoomedImage.src = 'https://huggingface.co/spaces/Morshen/alpha/resolve/main/pwa_ios.png'; // Устанавливаем src imageZoomModal.style.display = 'block'; });
// Закрытие модального окна с увеличенным изображением closeZoomModal.addEventListener('click', () => { imageZoomModal.style.display = 'none'; });
} else { installButton.style.display = deferredPrompt ? 'block' : 'none'; installButton.style.display = deferredPrompt ? 'block' : 'none'; iosInstallPrompt.style.display = 'none'; if (deferredPrompt) { if (deferredPrompt) { installButton.classList.add('pulse-animation'); } }
// При загрузке страницы: // При загрузке страницы: if (isIos() && !isInStandaloneMode() && localStorage.getItem('iosInstallPromptShown') === 'true') { setTimeout(() => { iosInstallModal.style.display = 'block'; }, 5000); // 5 секунд }
if ('serviceWorker' in navigator) { window.addEventListener('load', () => { navigator.serviceWorker.register('/service-worker.js')index.html+35-10