Update online.html
Browse files- online.html +65 -1
online.html
CHANGED
@@ -9,11 +9,75 @@
|
|
9 |
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
10 |
|
11 |
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
|
15 |
</head>
|
16 |
<body>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
<nav class="navbar navbar-light bg-light">
|
19 |
<a class="navbar-brand" href="/online">
|
|
|
9 |
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
10 |
|
11 |
|
12 |
+
<style>
|
13 |
+
|
14 |
+
#protection-overlay {
|
15 |
+
position: fixed;
|
16 |
+
top: 0;
|
17 |
+
left: 0;
|
18 |
+
width: 100%;
|
19 |
+
height: 100%;
|
20 |
+
background: rgba(0, 0, 0, 0.5); /* Полупрозрачный чёрный */
|
21 |
+
z-index: 5; /* На передний план */
|
22 |
+
display: block; /* Включено по умолчанию */
|
23 |
+
pointer-events: auto; /* Блокирует клики */
|
24 |
+
}
|
25 |
+
/* Поднимаем SweetAlert2 выше */
|
26 |
+
.swal2-container {
|
27 |
+
z-index: 10 !important;
|
28 |
+
}
|
29 |
+
</style>
|
30 |
|
31 |
|
32 |
</head>
|
33 |
<body>
|
34 |
+
<div id="protection-overlay"></div> <!-- Полупрозрачный фон -->
|
35 |
+
<script>
|
36 |
+
document.addEventListener("DOMContentLoaded", function () {
|
37 |
+
const overlay = document.getElementById("protection-overlay");
|
38 |
+
let pageKey = localStorage.getItem("page_key");
|
39 |
+
// Функция проверки ключа
|
40 |
+
function checkApiKey(apiKey) {
|
41 |
+
fetch(`/page_key?api_sys=${apiKey}`)
|
42 |
+
.then(response => response.json())
|
43 |
+
.then(data => {
|
44 |
+
if (data.status === "ok") {
|
45 |
+
overlay.style.display = "none"; // ✅ Убираем защиту
|
46 |
+
} else {
|
47 |
+
requestNewKey("Неверный код. Введите заново!");
|
48 |
+
}
|
49 |
+
})
|
50 |
+
.catch(() => requestNewKey("Ошибка сервера. Попробуйте снова."));
|
51 |
+
}
|
52 |
+
// Функция запроса нового ключа
|
53 |
+
function requestNewKey(message = "Введите код доступа:") {
|
54 |
+
Swal.fire({
|
55 |
+
title: "Внимание!",
|
56 |
+
text: message,
|
57 |
+
input: "text",
|
58 |
+
inputAttributes: { autocapitalize: "off" },
|
59 |
+
showCancelButton: false,
|
60 |
+
confirmButtonText: "Отправить",
|
61 |
+
confirmButtonColor: "#3085d6",
|
62 |
+
allowOutsideClick: false
|
63 |
+
}).then((result) => {
|
64 |
+
if (result.isConfirmed && result.value) {
|
65 |
+
localStorage.setItem("page_key", result.value); // 🔥 Сохраняем ключ
|
66 |
+
checkApiKey(result.value); // 🔥 Проверяем ключ
|
67 |
+
} else {
|
68 |
+
requestNewKey("Введите корректный код!"); // Повторяем ввод
|
69 |
+
}
|
70 |
+
});
|
71 |
+
}
|
72 |
+
// Если ключ есть → Проверяем его, иначе запрашиваем новый
|
73 |
+
if (pageKey) {
|
74 |
+
checkApiKey(pageKey);
|
75 |
+
} else {
|
76 |
+
requestNewKey();
|
77 |
+
}
|
78 |
+
});
|
79 |
+
</script>
|
80 |
+
|
81 |
|
82 |
<nav class="navbar navbar-light bg-light">
|
83 |
<a class="navbar-brand" href="/online">
|