Add files via upload

This commit is contained in:
nuttylmao
2025-03-23 22:04:07 +11:00
committed by GitHub
parent f133722899
commit 6c53d973f7
97 changed files with 15625 additions and 0 deletions
+40
View File
@@ -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
}
}