Files
Uptime-Kuma-Status-Page/index.html
T
2026-01-18 11:51:52 +00:00

205 lines
5.2 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pi Status Dashboard</title>
<link href="https://fonts.googleapis.com/css2?family=Play&display=swap" rel="stylesheet">
<style>
body {
background-color: #121212;
color: #fff;
margin: 0;
font-family: 'Play', sans-serif;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh;
}
.container {
display: flex;
justify-content: center;
align-items: center;
flex-direction: row;
}
.badge-container {
display: flex;
flex-direction: column;
align-items: center;
margin: 0 20px; /* Adjust margin as needed */
}
.badge {
font-size: 36px;
padding: 20px; /* Increased padding */
background-color: #444;
border-radius: 10px; /* Increased border radius */
}
.title {
font-size: 30px; /* Increased font size */
margin-bottom: 10px; /* Increased margin */
}
.divider {
width: 2px;
height: 150px; /* Increased height */
background-color: #777;
margin: 0 40px; /* Adjusted margin */
}
.clock {
font-size: 50px; /* Increased font size */
margin-top: 30px; /* Increased margin */
}
.date {
font-size: 45px; /* Increased font size */
margin-top: 30px; /* Increased margin */
}
.timer {
position: fixed;
bottom: 10px; /* Adjust this value to set the distance from the bottom */
right: 10px; /* Adjust this value to set the distance from the right */
font-size: 25px;
color: gray;
}
/* Ensure dark mode */
@media (prefers-color-scheme: light) {
body {
background-color: #121212;
color: #fff;
}
.badge {
background-color: #444;
}
}
</style>
</head>
<body>
<div class="date" id="date"></div>
<p>
<div class="container">
<div class="badge-container">
<div class="title">Pi 4</div>
<img class="badge" id="badgeImage1" src="http://..../api/status-page/{slug}/badge?label=Containers%20arelabel=Containers%20are" alt="Pi 4 Status" width="250" height="40">
</div>
<div class="divider"></div>
<div class="badge-container">
<div class="title">Pi 5</div>
<img class="badge" id="badgeImage2" src="http://..../api/status-page/{slug}/badge?label=Containers%20are" alt="Pi 5 Status" width="250" height="40">
</div>
</div>
<div class="clock" id="clock"></div>
<span id="timer" class="timer"></span>
<script>
// function to diplay the date
function displayDate() {
var currentDate = new Date();
var options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
var dateString = currentDate.toLocaleDateString('en-GB', options);
document.getElementById('date').innerText = dateString;
}
// Function to update date every day
function refreshAtMidnight() {
var now = new Date();
var night = new Date(
now.getFullYear(),
now.getMonth(),
now.getDate() + 1, // the next day, midnight
0, 0, 0 // midnight
);
var timeToMidnight = night - now;
setTimeout(function () {
location.reload();
}, timeToMidnight);
}
// Initial call to update date at midnight
displayDate();
refreshAtMidnight();
// Function to update clock
function updateClock() {
var now = new Date();
var hours = now.getHours().toString().padStart(2, '0');
var minutes = now.getMinutes().toString().padStart(2, '0');
var seconds = now.getSeconds().toString().padStart(2, '0');
var timeString = hours + ":" + minutes + ":" + seconds;
document.getElementById('clock').textContent = timeString;
setTimeout(updateClock, 1000); // Update every second
}
// Function to refresh badges every 5 minutes
function refreshBadges() {
// Badge 1
var badgeImage1 = document.getElementById('badgeImage1');
var url1 = badgeImage1.src;
badgeImage1.src = "";
setTimeout(function() {
badgeImage1.src = url1;
}, 100);
// Badge 2
var badgeImage2 = document.getElementById('badgeImage2');
var url2 = badgeImage2.src;
badgeImage2.src = "";
setTimeout(function() {
badgeImage2.src = url2;
}, 100);
// Restart timer
updateTimer(300); // Restart the timer for 5 minutes
}
// Call refreshBadges() function every 5 minutes
setInterval(refreshBadges, 300000); // 5 minutes
// Function to update the countdown timer
function updateTimer(seconds) {
let timerElement = document.getElementById('timer');
if (!timerElement) {
const newTimerElement = document.createElement('span');
newTimerElement.id = 'timer';
newTimerElement.className = 'timer';
document.body.appendChild(newTimerElement);
timerElement = newTimerElement;
}
let countdown = seconds;
const timerInterval = setInterval(() => {
const minutes = Math.floor(countdown / 60);
const remainingSeconds = countdown % 60;
if (countdown <= 0) {
clearInterval(timerInterval);
timerElement.textContent = ''; // Clear timer text
// Call any additional function needed after countdown reaches 0
} else {
timerElement.textContent = 'Next update in ' + minutes + ' min ' + remainingSeconds + ' sec';
}
countdown--;
}, 1000);
}
// Call updateTimer(seconds) with the desired time interval (in seconds)
updateTimer(300); // This example sets the timer to 5 minutes (300 seconds)
// Initial call to update clock
updateClock();
</script>
</body>
</html>