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
+36
View File
@@ -0,0 +1,36 @@
////////////////////
// URL PARAMETERS //
////////////////////
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const followMode = urlParams.has("followMode");
const twitchUsername = urlParams.get("username") || '';
const defaultGoalLabel = !followMode ? 'SUB GOAL' : 'FOLLOW GOAL'
const goal = urlParams.get("goal") || defaultGoalLabel;
///////////////
// FUNCTIONS //
///////////////
async function UpdateMetrics() {
document.getElementById("goalLabel").innerHTML = `${goal}: `;
if (!followMode)
document.getElementById("subCountLabel").innerHTML = await GetSubCount(`https://decapi.me/twitch/subcount`);
else
document.getElementById("subCountLabel").innerHTML = await GetSubCount(`https://decapi.me/twitch/followcount`);
setTimeout(UpdateMetrics, 10000);
}
UpdateMetrics();
async function GetSubCount(url) {
const response = await fetch(`${url}/${twitchUsername}`);
const metric = await response.text();
if (metric.includes("decapi.me"))
return "-";
else
return `${metric}/${parseInt(metric) + 1}`;
}