DmitrMakeev commited on
Commit
5c1e691
·
verified ·
1 Parent(s): fcc319d

Update plot_week.html

Browse files
Files changed (1) hide show
  1. plot_week.html +62 -0
plot_week.html CHANGED
@@ -82,9 +82,71 @@ body {
82
  height: 280px; /* Ещё немного увеличил высоту */
83
  }
84
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  </style>
86
  </head>
87
  <body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
 
89
  <!-- Навигационная панель -->
90
  <nav class="navbar navbar-light bg-light w-100">
 
82
  height: 280px; /* Ещё немного увеличил высоту */
83
  }
84
  }
85
+ #protection-overlay {
86
+ position: fixed;
87
+ top: 0;
88
+ left: 0;
89
+ width: 100%;
90
+ height: 100%;
91
+ background: rgba(0, 0, 0, 0.5); /* Полупрозрачный чёрный */
92
+ z-index: 5; /* На передний план */
93
+ display: block; /* Включено по умолчанию */
94
+ pointer-events: auto; /* Блокирует клики */
95
+ }
96
+ /* Поднимаем SweetAlert2 выше */
97
+ .swal2-container {
98
+ z-index: 10 !important;
99
+ }
100
  </style>
101
  </head>
102
  <body>
103
+ <div id="protection-overlay"></div> <!-- Полупрозрачный фон -->
104
+ <script>
105
+ document.addEventListener("DOMContentLoaded", function () {
106
+ const overlay = document.getElementById("protection-overlay");
107
+ let pageKey = localStorage.getItem("page_key");
108
+ // Функция проверки ключа
109
+ function checkApiKey(apiKey) {
110
+ fetch(`/page_key?api_sys=${apiKey}`)
111
+ .then(response => response.json())
112
+ .then(data => {
113
+ if (data.status === "ok") {
114
+ overlay.style.display = "none"; // ✅ Убираем защиту
115
+ } else {
116
+ requestNewKey("Неверный код. Введите заново!");
117
+ }
118
+ })
119
+ .catch(() => requestNewKey("Ошибка сервера. Попробуйте снова."));
120
+ }
121
+ // Функция запроса нового ключа
122
+ function requestNewKey(message = "Введите код доступа:") {
123
+ Swal.fire({
124
+ title: "Внимание!",
125
+ text: message,
126
+ input: "text",
127
+ inputAttributes: { autocapitalize: "off" },
128
+ showCancelButton: false,
129
+ confirmButtonText: "Отправить",
130
+ confirmButtonColor: "#3085d6",
131
+ allowOutsideClick: false
132
+ }).then((result) => {
133
+ if (result.isConfirmed && result.value) {
134
+ localStorage.setItem("page_key", result.value); // 🔥 Сохраняем ключ
135
+ checkApiKey(result.value); // 🔥 Проверяем ключ
136
+ } else {
137
+ requestNewKey("Введите корректный код!"); // Повторяем ввод
138
+ }
139
+ });
140
+ }
141
+ // Если ключ есть → Проверяем его, иначе запрашиваем новый
142
+ if (pageKey) {
143
+ checkApiKey(pageKey);
144
+ } else {
145
+ requestNewKey();
146
+ }
147
+ });
148
+ </script>
149
+
150
 
151
  <!-- Навигационная панель -->
152
  <nav class="navbar navbar-light bg-light w-100">