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,8 @@
|
||||
|
||||
<link rel="stylesheet" href="./style.css" />
|
||||
<div id="mainContainer">
|
||||
<label id="goalLabel"></label>
|
||||
<label id="subCountLabel"></label>
|
||||
</div>
|
||||
|
||||
<script src="./script.js"></script>
|
||||
@@ -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}`;
|
||||
}
|
||||
@@ -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