Update index.html

This commit is contained in:
Degradin 2025-01-20 23:50:12 +03:00
parent ae0a59fc3b
commit 4e7e710bf5

View File

@ -235,19 +235,15 @@
}
}
// Подписываемся на обновления данных
tg.subscribeToData((data) => {
console.log("Обновление данных:", data);
});
// При получении сообщения от бота обновляем страницу
tg.subscribeToMessages((messages) => {
console.log("Получено сообщение:", messages);
location.reload();
});
// Обновляем сайт каждые 5 секунд для получения актуальных данных
setInterval(() => {
// Добавляем внизу кнопку для обновления данных
const container = document.querySelector(".container");
const updateButton = document.createElement("button");
updateButton.textContent = "🔄 Обновить данные"
updateButton.classList.add("button");
updateButton.addEventListener("click", () => {
window.location.reload();
}, 5000);
});
container.appendChild(updateButton);
</script>
</body>
</html>