Aleksmorshen commited on
Commit
c27fad5
·
verified ·
1 Parent(s): acf1bf3

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +114 -41
index.html CHANGED
@@ -3,7 +3,7 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>eUM : Open Perflexity</title>
7
  <link rel="manifest" href="/manifest.json">
8
  <link rel="stylesheet" href="style.css">
9
  <style>
@@ -14,100 +14,173 @@
14
  }
15
 
16
  html, body {
17
- margin: 0;
18
- padding: 0;
19
- height: 200%; /* Занимаем всю высоту экрана */
20
- background-color: #fff; /* Или любой другой цвет фона по вашему желанию */
21
  }
22
 
23
  body {
24
  font-family: Arial, sans-serif;
25
  display: flex;
26
  flex-direction: column;
27
- height: 100vh; /* Важно: 100vh, чтобы занимать всю высоту viewport */
28
- overflow: hidden; /* Предотвращаем полосы прокрутки, если содержимое iframe больше */
29
  }
30
 
 
31
  header {
32
- background-color: #f8f9fa;
33
- padding: 0.5rem;
34
- box-shadow: 0 1px 2px rgba(0,0,0,0.1);
 
 
 
 
 
 
 
35
  display: flex;
36
  align-items: center;
37
- gap: 1rem;
38
- font-size: 0.8rem;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  }
40
 
 
41
  iframe {
42
  flex: 1;
43
  width: 100%;
44
- border: none; /* Убираем рамку у iframe */
45
  }
46
 
47
- #installButton {
48
- display: none; /* Скрываем кнопку по умолчанию */
 
49
  position: fixed;
50
  bottom: 20px;
51
  left: 50%;
52
  transform: translateX(-50%);
53
- padding: 10px 20px;
54
  background-color: #007bff;
55
  color: white;
56
  border: none;
57
  border-radius: 5px;
58
  cursor: pointer;
59
  z-index: 1000;
 
 
 
 
 
60
  }
61
  </style>
62
  </head>
63
  <body>
64
  <header>
65
- <!-- Удалены текст и элемент с количеством посетителей -->
 
 
 
 
 
 
 
 
 
66
  </header>
 
67
  <iframe src="https://eum-lovat.vercel.app" allowfullscreen></iframe>
68
 
69
- <button id="installButton">Install App</button>
 
70
 
71
  <script>
72
  let deferredPrompt;
73
  const installButton = document.getElementById('installButton');
 
 
74
 
75
- function showInstallPromotion() {
76
- installButton.style.display = 'block'; // Показываем кнопку установки
77
- installButton.addEventListener('click', async () => {
78
- if (deferredPrompt) {
79
- deferredPrompt.prompt(); // Показываем запрос установки
80
- const { outcome } = await deferredPrompt.userChoice;
81
- if (outcome === 'accepted') {
82
- console.log('User accepted the install prompt');
83
- } else {
84
- console.log('User dismissed the install prompt');
85
  }
86
- deferredPrompt = null; // Очищаем deferredPrompt
87
- installButton.style.display = 'none'; // Скрываем кнопку после установки или отклонения
88
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  });
90
  }
91
 
 
92
  window.addEventListener('beforeinstallprompt', (event) => {
93
- // Предотвращаем автоматическое появление баннера установки
94
  event.preventDefault();
95
  deferredPrompt = event;
96
- // Показываем кнопку установки или другой UI, чтобы предложить пользователю установить PWA
97
- showInstallPromotion();
 
 
 
 
 
 
 
 
 
 
98
  });
99
 
 
100
  if ('serviceWorker' in navigator) {
101
  window.addEventListener('load', () => {
102
  navigator.serviceWorker.register('/service-worker.js')
103
- .then((registration) => {
104
- console.log('Service Worker registered:', registration);
105
- })
106
- .catch((error) => {
107
- console.log('Service Worker registration failed:', error);
108
- });
109
  });
110
  }
111
  </script>
112
  </body>
113
- </html>
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>MASearch</title>
7
  <link rel="manifest" href="/manifest.json">
8
  <link rel="stylesheet" href="style.css">
9
  <style>
 
14
  }
15
 
16
  html, body {
17
+ height: 100vh;
18
+ background-color: #fff;
 
 
19
  }
20
 
21
  body {
22
  font-family: Arial, sans-serif;
23
  display: flex;
24
  flex-direction: column;
25
+ overflow: hidden;
 
26
  }
27
 
28
+ /* Верхний фрейм */
29
  header {
30
+ background: linear-gradient(135deg, #007bff, #00c6ff);
31
+ color: white;
32
+ padding: 10px 20px;
33
+ box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
34
+ display: flex;
35
+ align-items: center;
36
+ justify-content: space-between;
37
+ }
38
+
39
+ .logo-container {
40
  display: flex;
41
  align-items: center;
42
+ gap: 10px;
43
+ }
44
+
45
+ .logo-container img {
46
+ width: 40px;
47
+ height: 40px;
48
+ border-radius: 50%;
49
+ }
50
+
51
+ .header-info {
52
+ display: flex;
53
+ flex-direction: column;
54
+ font-size: 14px;
55
+ }
56
+
57
+ .visitor-counter {
58
+ font-size: 14px;
59
+ font-weight: bold;
60
+ background: rgba(255, 255, 255, 0.2);
61
+ padding: 5px 10px;
62
+ border-radius: 5px;
63
+ }
64
+
65
+ .community-link {
66
+ font-size: 12px;
67
+ color: white;
68
+ text-decoration: none;
69
+ opacity: 0.8;
70
  }
71
 
72
+ /* Основное содержимое */
73
  iframe {
74
  flex: 1;
75
  width: 100%;
76
+ border: none;
77
  }
78
 
79
+ /* Кнопки установки */
80
+ #installButton, #iosInstallPrompt {
81
+ display: none;
82
  position: fixed;
83
  bottom: 20px;
84
  left: 50%;
85
  transform: translateX(-50%);
86
+ padding: 10px 15px;
87
  background-color: #007bff;
88
  color: white;
89
  border: none;
90
  border-radius: 5px;
91
  cursor: pointer;
92
  z-index: 1000;
93
+ font-size: 14px;
94
+ }
95
+
96
+ #iosInstallPrompt {
97
+ background-color: #28a745;
98
  }
99
  </style>
100
  </head>
101
  <body>
102
  <header>
103
+ <div class="logo-container">
104
+ <img src="/icon.png" alt="Logo">
105
+ <div class="header-info">
106
+ <span>MASearch</span>
107
+ <a href="https://discord.gg/openfreeai" class="community-link" target="_blank">Сообщество</a>
108
+ </div>
109
+ </div>
110
+ <div class="visitor-counter">
111
+ Посетителей за месяц: <span id="visitorCount">0</span>
112
+ </div>
113
  </header>
114
+
115
  <iframe src="https://eum-lovat.vercel.app" allowfullscreen></iframe>
116
 
117
+ <button id="installButton">Установить это приложение</button>
118
+ <button id="iosInstallPrompt">Добавить на экран Домой</button>
119
 
120
  <script>
121
  let deferredPrompt;
122
  const installButton = document.getElementById('installButton');
123
+ const iosInstallPrompt = document.getElementById('iosInstallPrompt');
124
+ const visitorCountElement = document.getElementById('visitorCount');
125
 
126
+ /* Счетчик посетителей */
127
+ function updateVisitorCount() {
128
+ fetch('https://api.visitorbadge.io/api/visitors?path=https%3A%2F%2FVIDraft-eum.hf.space')
129
+ .then(response => response.text())
130
+ .then(data => {
131
+ const match = data.match(/"count":"(\d+)"/);
132
+ if (match) {
133
+ visitorCountElement.textContent = match[1];
 
 
134
  }
135
+ })
136
+ .catch(error => console.log('Ошибка загрузки счетчика:', error));
137
+ }
138
+
139
+ updateVisitorCount();
140
+ setInterval(updateVisitorCount, 60000); // Обновление раз в минуту
141
+
142
+ /* Обнаружение iOS и отображение инструкции */
143
+ function isIos() {
144
+ return /iphone|ipad|ipod/i.test(navigator.userAgent);
145
+ }
146
+
147
+ function isInStandaloneMode() {
148
+ return window.matchMedia('(display-mode: standalone)').matches || window.navigator.standalone;
149
+ }
150
+
151
+ if (isIos() && !isInStandaloneMode()) {
152
+ iosInstallPrompt.style.display = 'block';
153
+ iosInstallPrompt.addEventListener('click', () => {
154
+ alert("1. Нажмите кнопку 'Поделиться' (иконка внизу Safari).\n2. Выберите 'Добавить на экран Домой'.\n3. Подтвердите установку.");
155
  });
156
  }
157
 
158
+ /* Обработчик события для установки PWA */
159
  window.addEventListener('beforeinstallprompt', (event) => {
 
160
  event.preventDefault();
161
  deferredPrompt = event;
162
+ installButton.style.display = 'block';
163
+
164
+ installButton.addEventListener('click', async () => {
165
+ deferredPrompt.prompt();
166
+ const { outcome } = await deferredPrompt.userChoice;
167
+ if (outcome === 'accepted') {
168
+ console.log('User accepted the install prompt');
169
+ } else {
170
+ console.log('User dismissed the install prompt');
171
+ }
172
+ installButton.style.display = 'none';
173
+ });
174
  });
175
 
176
+ /* Регистрация Service Worker */
177
  if ('serviceWorker' in navigator) {
178
  window.addEventListener('load', () => {
179
  navigator.serviceWorker.register('/service-worker.js')
180
+ .then((registration) => console.log('Service Worker зарегистрирован:', registration))
181
+ .catch((error) => console.log('Ошибка Service Worker:', error));
 
 
 
 
182
  });
183
  }
184
  </script>
185
  </body>
186
+ </html>