mirror of
https://github.com/nuttylmao/nutty.gg.git
synced 2026-09-18 19:50:58 -04:00
Add files via upload
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
|
||||
<link rel="stylesheet" href="./style.css" />
|
||||
<div id="mainContainer">
|
||||
<label id="uptimeLabel"></label>
|
||||
</div>
|
||||
|
||||
<script src="./script.js"></script>
|
||||
@@ -0,0 +1,40 @@
|
||||
////////////////////
|
||||
// URL PARAMETERS //
|
||||
////////////////////
|
||||
|
||||
const queryString = window.location.search;
|
||||
const urlParams = new URLSearchParams(queryString);
|
||||
const twitchUsername = urlParams.get("username") || '';
|
||||
|
||||
///////////////
|
||||
// FUNCTIONS //
|
||||
///////////////
|
||||
|
||||
async function UpdateUptime() {
|
||||
document.getElementById("uptimeLabel").innerHTML = await GetUptime();
|
||||
|
||||
setTimeout(UpdateUptime, 30000);
|
||||
}
|
||||
|
||||
UpdateUptime();
|
||||
|
||||
async function GetUptime() {
|
||||
const response = await fetch(`https://decapi.me/twitch/uptime/${twitchUsername}`);
|
||||
const metric = await response.text();
|
||||
|
||||
if (metric.includes("second"))
|
||||
{
|
||||
return removeTextAfterLastComma(metric);
|
||||
}
|
||||
else
|
||||
return metric;
|
||||
}
|
||||
|
||||
function removeTextAfterLastComma(str) {
|
||||
const lastCommaIndex = str.lastIndexOf(',');
|
||||
if (lastCommaIndex !== -1) {
|
||||
return str.substring(0, lastCommaIndex);
|
||||
} else {
|
||||
return str; // No comma found, return the original string
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#mainContainer {
|
||||
text-align: center;
|
||||
font-size: 40px;
|
||||
text-transform: uppercase;
|
||||
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
|
||||
|
||||
font-weight: 700;
|
||||
font-size: 36px;
|
||||
text-shadow: rgb(0, 0, 0) 2px 2px 2px;
|
||||
color: white;
|
||||
}
|
||||
Reference in New Issue
Block a user