Aleksmorshen commited on
Commit
1b16896
·
verified ·
1 Parent(s): 94efc7a

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +35 -10
index.html CHANGED
@@ -38,7 +38,9 @@
38
  <div id="iosInstallModal">
39
  <div class="modal-content">
40
  <h2>Установите приложение Morshen Alpha</h2>
41
- <img src="https://huggingface.co/spaces/Morshen/alpha/resolve/main/pwa_ios.png" alt="Инструкция по установке PWA на iOS">
 
 
42
  <p>1. Нажмите кнопку "Поделиться" внизу Safari.</p>
43
  <p>2. Выберите "На экран «Домой»".</p>
44
  <p>3. Подтвердите установку.</p>
@@ -46,12 +48,22 @@
46
  </div>
47
  </div>
48
 
 
 
 
 
 
 
49
  <script>
50
- let deferredPrompt;
51
  const installButton = document.getElementById('installButton');
52
  const iosInstallPrompt = document.getElementById('iosInstallPrompt');
53
  const iosInstallModal = document.getElementById('iosInstallModal');
54
  const closeIosModal = document.getElementById('closeIosModal');
 
 
 
 
55
 
56
  function isIos() {
57
  return /iphone|ipad|ipod/i.test(navigator.userAgent);
@@ -64,8 +76,8 @@
64
  window.addEventListener('beforeinstallprompt', (event) => {
65
  event.preventDefault();
66
  deferredPrompt = event;
67
- installButton.style.display = 'block';
68
- installButton.classList.add('pulse-animation');
69
 
70
  installButton.addEventListener('click', async () => {
71
  deferredPrompt.prompt();
@@ -77,12 +89,12 @@
77
  }
78
  deferredPrompt = null;
79
  installButton.style.display = 'none';
80
- installButton.classList.remove('pulse-animation');
81
  });
82
  });
83
 
84
  if (isIos() && !isInStandaloneMode()) {
85
- iosInstallPrompt.style.display = 'block';
86
  installButton.style.display = 'none';
87
  iosInstallPrompt.classList.add('pulse-animation');
88
 
@@ -95,21 +107,34 @@
95
  iosInstallModal.style.display = 'none';
96
  });
97
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  } else {
99
- installButton.style.display = deferredPrompt ? 'block' : 'none';
100
  iosInstallPrompt.style.display = 'none';
101
- if (deferredPrompt) {
102
  installButton.classList.add('pulse-animation');
103
  }
104
  }
105
-
106
- // При загрузке страницы:
107
  if (isIos() && !isInStandaloneMode() && localStorage.getItem('iosInstallPromptShown') === 'true') {
108
  setTimeout(() => {
109
  iosInstallModal.style.display = 'block';
110
  }, 5000); // 5 секунд
111
  }
112
 
 
 
113
  if ('serviceWorker' in navigator) {
114
  window.addEventListener('load', () => {
115
  navigator.serviceWorker.register('/service-worker.js')
 
38
  <div id="iosInstallModal">
39
  <div class="modal-content">
40
  <h2>Установите приложение Morshen Alpha</h2>
41
+ <a href="#" id="openZoomModal">
42
+ <img src="https://huggingface.co/spaces/Morshen/alpha/resolve/main/pwa_ios.png" alt="Инструкция по установке PWA на iOS">
43
+ </a>
44
  <p>1. Нажмите кнопку "Поделиться" внизу Safari.</p>
45
  <p>2. Выберите "На экран «Домой»".</p>
46
  <p>3. Подтвердите установку.</p>
 
48
  </div>
49
  </div>
50
 
51
+ <!-- Модальное окно для увеличения изображения -->
52
+ <div id="imageZoomModal">
53
+ <span id="closeZoomModal">×</span>
54
+ <img id="zoomedImage" src="" alt="Увеличенное изображение">
55
+ </div>
56
+
57
  <script>
58
+ let deferredPrompt;
59
  const installButton = document.getElementById('installButton');
60
  const iosInstallPrompt = document.getElementById('iosInstallPrompt');
61
  const iosInstallModal = document.getElementById('iosInstallModal');
62
  const closeIosModal = document.getElementById('closeIosModal');
63
+ const openZoomModal = document.getElementById('openZoomModal'); // Добавлено
64
+ const imageZoomModal = document.getElementById('imageZoomModal'); // Добавлено
65
+ const closeZoomModal = document.getElementById('closeZoomModal'); // Добавлено
66
+ const zoomedImage = document.getElementById('zoomedImage'); // Добавлено
67
 
68
  function isIos() {
69
  return /iphone|ipad|ipod/i.test(navigator.userAgent);
 
76
  window.addEventListener('beforeinstallprompt', (event) => {
77
  event.preventDefault();
78
  deferredPrompt = event;
79
+ installButton.style.display = 'block';
80
+ installButton.classList.add('pulse-animation');
81
 
82
  installButton.addEventListener('click', async () => {
83
  deferredPrompt.prompt();
 
89
  }
90
  deferredPrompt = null;
91
  installButton.style.display = 'none';
92
+ installButton.classList.remove('pulse-animation');
93
  });
94
  });
95
 
96
  if (isIos() && !isInStandaloneMode()) {
97
+ iosInstallPrompt.style.display = 'block';
98
  installButton.style.display = 'none';
99
  iosInstallPrompt.classList.add('pulse-animation');
100
 
 
107
  iosInstallModal.style.display = 'none';
108
  });
109
 
110
+ // Открытие модального окна с увеличенным изображением
111
+ openZoomModal.addEventListener('click', (event) => {
112
+ event.preventDefault(); // Предотвращаем переход по ссылке
113
+ zoomedImage.src = 'https://huggingface.co/spaces/Morshen/alpha/resolve/main/pwa_ios.png'; // Устанавливаем src
114
+ imageZoomModal.style.display = 'block';
115
+ });
116
+
117
+ // Закрытие модального окна с увеличенным изображением
118
+ closeZoomModal.addEventListener('click', () => {
119
+ imageZoomModal.style.display = 'none';
120
+ });
121
+
122
  } else {
123
+ installButton.style.display = deferredPrompt ? 'block' : 'none';
124
  iosInstallPrompt.style.display = 'none';
125
+ if (deferredPrompt) {
126
  installButton.classList.add('pulse-animation');
127
  }
128
  }
129
+ // При загрузке страницы:
 
130
  if (isIos() && !isInStandaloneMode() && localStorage.getItem('iosInstallPromptShown') === 'true') {
131
  setTimeout(() => {
132
  iosInstallModal.style.display = 'block';
133
  }, 5000); // 5 секунд
134
  }
135
 
136
+
137
+
138
  if ('serviceWorker' in navigator) {
139
  window.addEventListener('load', () => {
140
  navigator.serviceWorker.register('/service-worker.js')