File size: 3,883 Bytes
d1900e5 a9e0658 d1900e5 6494095 d1900e5 b9e72c1 9345bb0 e7aba96 d1900e5 b0cd06f d1900e5 5175686 d1900e5 a9e0658 1b16896 d1900e5 7731cce d1900e5 a9e0658 5ed82df 7731cce a9e0658 5ed82df a9e0658 5ed82df 7731cce a9e0658 5ed82df a9e0658 6494095 a9e0658 5ed82df a9e0658 5ed82df 5175686 5ed82df d1900e5 5ed82df | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | <!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>У Гарика - приложение</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">
<link rel="icon" href="icon.png" type="image/png">
<meta name="google-site-verification" content="V6EqDTA9Oj9V1OfNbnBHj5RKrdcXlABD8tqfEFVUHJY" />
<meta name="description" content=" ">
</head>
<body>
<iframe
src="https://metastore-full.hf.space/633275/catalog?mode=online&staff_id="
frameborder="0"
allowfullscreen
allow="cross-origin-isolated; cookies"></iframe>
<!-- Кнопка скрыта по умолчанию и отображается только при готовности к установке -->
<button id="installButton" style="display: none;">Установить приложение</button>
<script>
let deferredPrompt;
const installButton = document.getElementById('installButton');
// Отслеживаем событие готовности к установке PWA (в основном Android и десктопные браузеры Chrome/Edge)
window.addEventListener('beforeinstallprompt', (event) => {
event.preventDefault();
deferredPrompt = event;
installButton.style.display = 'block';
installButton.classList.add('pulse-animation');
});
// Обработчик клика по кнопке установки
installButton.addEventListener('click', async () => {
if (deferredPrompt) {
deferredPrompt.prompt();
const { outcome } = await deferredPrompt.userChoice;
if (outcome === 'accepted') {
console.log('Пользователь принял запрос на установку');
} else {
console.log('Пользователь отклонил запрос на установку');
}
deferredPrompt = null;
installButton.style.display = 'none';
installButton.classList.remove('pulse-animation');
}
});
// Скрываем кнопку, если приложение уже успешно установлено
window.addEventListener('appinstalled', () => {
console.log('Приложение успешно установлено');
installButton.style.display = 'none';
installButton.classList.remove('pulse-animation');
deferredPrompt = null;
});
// Регистрация Service Worker
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('/service-worker.js')
.then((registration) => {
console.log('Сервисный рабочий процесс зарегистрирован:', registration);
})
.catch((error) => {
console.log('Ошибка регистрации сервисного рабочего процесса:', error);
});
});
}
// Перехват ошибок
window.addEventListener('error', (event) => {
console.error('Произошла ошибка:', event.message, event.filename, event.lineno);
});
</script>
</body>
</html> |