77 lines
2.2 KiB
HTML
77 lines
2.2 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(streamer) {
|
|
// Fetch the status of the webpage
|
|
fetch(`https://decapi.me/twitch/uptime/${streamer}`)
|
|
.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 if (data.includes("Error")) {
|
|
document.getElementById("status").style.backgroundColor = "yellow";
|
|
document.getElementById("status").innerHTML = "Error";
|
|
} else {
|
|
document.getElementById("status").style.backgroundColor = "green";
|
|
document.getElementById("status").innerHTML = "Online";
|
|
}
|
|
})
|
|
.catch((error) => {
|
|
console.error("Error:", error);
|
|
});
|
|
}
|
|
// Check default streamers status in page load
|
|
checkStatus(document.getElementById("streamer").value);
|
|
|
|
// Call the checkStatus function every minute
|
|
setInterval(() => {
|
|
checkStatus(document.getElementById("streamer").value);
|
|
}, 60000);
|
|
|
|
function updateStatus() {
|
|
const streamer = document.getElementById("streamer").value;
|
|
checkStatus(streamer);
|
|
}
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<label for="streamer">Enter Streamer Name:</label>
|
|
<input type="text" id="streamer" value="CJ_Games_Live">
|
|
<button onclick="updateStatus()">Confirm</button>
|
|
<div id="status">OFFLINE</div>
|
|
</body>
|
|
</html>
|