65 lines
1.5 KiB
HTML
65 lines
1.5 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Status Checker</title>
|
|
<style>
|
|
#status {
|
|
width: 70%;
|
|
min-height: 15px;
|
|
max-height: 100px;
|
|
min-width: 45px;
|
|
max-width: 300px;
|
|
height: 100%;
|
|
border-radius: 5px;
|
|
background-color: red;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
color: white;
|
|
font-family: play, sans-serif;
|
|
font-size: 2vw;
|
|
font-weight: bold;
|
|
text-transform: uppercase;
|
|
overflow: hidden;
|
|
white-space: nowrap;
|
|
text-overflow: ellipsis;
|
|
}
|
|
#status.green {
|
|
background-color: green;
|
|
}
|
|
#status.red {
|
|
background-color: red;
|
|
}
|
|
</style>
|
|
<script>
|
|
function checkStatus() {
|
|
// Fetch the status of the webpage
|
|
fetch("https://decapi.me/twitch/uptime/CJ_GamesLive")
|
|
.then((response) => response.text())
|
|
.then((data) => {
|
|
// Update the UI based on the status
|
|
if (data.includes("offline")) {
|
|
document.getElementById("status").style.backgroundColor = "red";
|
|
document.getElementById("status").innerHTML = "Offline";
|
|
} else {
|
|
document.getElementById("status").style.backgroundColor = "green";
|
|
document.getElementById("status").innerHTML = "Online";
|
|
}
|
|
})
|
|
.catch((error) => {
|
|
console.error("Error:", error);
|
|
});
|
|
}
|
|
|
|
// Call checkStatus on page load
|
|
checkStatus();
|
|
|
|
// Call the checkStatus function every minute
|
|
setInterval(checkStatus, 60000);
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<div id="status">OFFLINE</div>
|
|
</body>
|
|
</html>
|