| <!DOCTYPE html> |
| <html lang="ru"> |
| <head> |
| <meta charset="UTF-8"> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| <title>Morshenalpha PWA</title> |
| <link rel="manifest" href="/manifest.json"> |
| <link rel="stylesheet" href="style.css"> |
| <link rel="apple-touch-icon" href="/icon.png"> |
| <meta name="apple-mobile-web-app-capable" content="yes"> |
| <meta name="apple-mobile-web-app-status-bar-style" content="default"> |
| <link rel="icon" type="image/png" sizes="192x192" href="/icon.png"> |
|
|
| <style> |
| |
| body { |
| padding: 1rem; |
| font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif; |
| margin: 0; |
| } |
| |
| h1 { |
| font-size: 1.2rem; |
| margin-top: 0; |
| } |
| |
| p { |
| color: rgb(107, 114, 128); |
| font-size: 0.9rem; |
| margin-bottom: 0.5rem; |
| margin-top: 0.25rem; |
| } |
| |
| .card { |
| max-width: 100%; |
| margin: 0 auto; |
| padding: 0.5rem; |
| border: 1px solid lightgray; |
| border-radius: 0.5rem; |
| } |
| |
| .card p:last-child { |
| margin-bottom: 0; |
| } |
| |
| |
| @media (min-width: 640px) { |
| body { |
| padding: 2rem; |
| } |
| h1 { |
| font-size: 1.6rem; |
| } |
| p { |
| font-size: 1rem; |
| } |
| .card { |
| max-width: 620px; |
| padding: 1rem; |
| border-radius: 1rem; |
| } |
| } |
| |
| |
| iframe { |
| width: 100%; |
| height: 1000px; |
| border: none; |
| } |
| |
| |
| #installButton, #iosInstallPrompt { |
| display: none; |
| position: fixed; |
| bottom: 20px; |
| left: 50%; |
| transform: translateX(-50%); |
| padding: 10px 15px; |
| background-color: #007bff; |
| color: white; |
| border: none; |
| border-radius: 5px; |
| cursor: pointer; |
| z-index: 1000; |
| font-size: 14px; |
| } |
| |
| #iosInstallPrompt { |
| background-color: #28a745; |
| } |
| </style> |
| </head> |
| <body> |
|
|
| <iframe |
| src="https://taplink.cc/morshenalpha" |
| frameborder="0" |
| allowfullscreen></iframe> |
|
|
| <div class="card"> |
| <h1>Morshenalpha</h1> |
| <p>Все лучшее здесь!</p> |
| <p>Подписывайтесь и следите за обновлениями.</p> |
| </div> |
|
|
| <button id="installButton">Установить приложение</button> |
| <button id="iosInstallPrompt">Установить приложение (инструкция для iOS)</button> |
|
|
| <script> |
| let deferredPrompt; |
| const installButton = document.getElementById('installButton'); |
| const iosInstallPrompt = document.getElementById('iosInstallPrompt'); |
| |
| function isIos() { |
| return /iphone|ipad|ipod/i.test(navigator.userAgent); |
| } |
| |
| function isInStandaloneMode() { |
| return window.matchMedia('(display-mode: standalone)').matches || window.navigator.standalone; |
| } |
| |
| if (isIos() && !isInStandaloneMode()) { |
| iosInstallPrompt.style.display = 'block'; |
| iosInstallPrompt.addEventListener('click', () => { |
| alert("1. Нажмите кнопку 'Поделиться' (иконка внизу Safari).\n2. Выберите 'Добавить на экран Домой'.\n3. Подтвердите установку."); |
| }); |
| } |
| |
| window.addEventListener('beforeinstallprompt', (event) => { |
| event.preventDefault(); |
| deferredPrompt = event; |
| installButton.style.display = 'block'; |
| |
| installButton.addEventListener('click', async () => { |
| deferredPrompt.prompt(); |
| const { outcome } = await deferredPrompt.userChoice; |
| if (outcome === 'accepted') { |
| console.log('User accepted the install prompt'); |
| } else { |
| console.log('User dismissed the install prompt'); |
| } |
| deferredPrompt = null; |
| installButton.style.display = 'none'; |
| }); |
| }); |
| |
| if ('serviceWorker' in navigator) { |
| window.addEventListener('load', () => { |
| navigator.serviceWorker.register('/service-worker.js') |
| .then((registration) => { |
| console.log('Service Worker registered:', registration); |
| }) |
| .catch((error) => { |
| console.log('Service Worker registration failed:', error); |
| }); |
| }); |
| } |
| </script> |
| </body> |
| </html> |
|
|