Updated Websites

Added Playercounts to home pages
This commit is contained in:
Pengu 2024-09-07 23:28:14 -05:00
parent f59488f557
commit cdf9a8f655
6 changed files with 188 additions and 0 deletions

View File

@ -62,6 +62,53 @@
<a>Content Warning,<br>but</a> <a>Content Warning,<br>but</a>
<a class="main1_actcent">better</a><a>.</a> <a class="main1_actcent">better</a><a>.</a>
</div> </div>
<title>Player Counts</title>
<style>
#player-count {
font-size: 2em;
color: #ebe3e3;
}
#loading {
display: none;
color: #777;
}
</style>
<div class="main1_actcent" id="player-count">Loading...</div>
<script>
const playerCountElement = document.getElementById('player-count');
const prometheusURL = 'http://5.161.51.188:9090/api/v1/query?query=active_users';
// Function to fetch player count from Prometheus
async function fetchPlayerCount() {
try {
const response = await fetch(prometheusURL);
const data = await response.json();
// Extract the player count from the response
if (data.status === 'success' && data.data.result.length > 0) {
const playerCount = data.data.result[0].value[1];
playerCountElement.textContent = `Current Player Count: ${playerCount}`;
} else {
playerCountElement.textContent = 'No data';
}
} catch (error) {
console.error('Error fetching player count:', error);
playerCountElement.textContent = 'Error fetching data';
} finally {
}
}
// Fetch player count every 15 seconds
setInterval(fetchPlayerCount, 5000);
// Initial fetch when the page loads
fetchPlayerCount();
</script>
<p></p>
<div class="main1_ipcopier_div"> <div class="main1_ipcopier_div">
<button class="main1_ipcopier" type="button"> <button class="main1_ipcopier" type="button">
<span class="main1_ipcopier_text1"></span> <span class="main1_ipcopier_text1"></span>

View File

@ -61,6 +61,53 @@
<a>Lethal Company,<br>but</a> <a>Lethal Company,<br>but</a>
<a class="main1_actcent">better</a><a>.</a> <a class="main1_actcent">better</a><a>.</a>
</div> </div>
<title>Player Counts</title>
<style>
#player-count {
font-size: 2em;
color: #ebe3e3;
}
#loading {
display: none;
color: #777;
}
</style>
<div class="main1_actcent" id="player-count">Loading...</div>
<script>
const playerCountElement = document.getElementById('player-count');
const prometheusURL = 'http://5.161.51.188:9090/api/v1/query?query=le_active_users';
// Function to fetch player count from Prometheus
async function fetchPlayerCount() {
try {
const response = await fetch(prometheusURL);
const data = await response.json();
// Extract the player count from the response
if (data.status === 'success' && data.data.result.length > 0) {
const playerCount = data.data.result[0].value[1];
playerCountElement.textContent = `Current Player Count: ${playerCount}`;
} else {
playerCountElement.textContent = 'No data';
}
} catch (error) {
console.error('Error fetching player count:', error);
playerCountElement.textContent = 'Error fetching data';
} finally {
}
}
// Fetch player count every 15 seconds
setInterval(fetchPlayerCount, 5000);
// Initial fetch when the page loads
fetchPlayerCount();
</script>
<p></p>
<div class="main1_ipcopier_div"> <div class="main1_ipcopier_div">
<button class="main1_ipcopier" type="button"> <button class="main1_ipcopier" type="button">
<span class="main1_ipcopier_text1"></span> <span class="main1_ipcopier_text1"></span>

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

@ -60,6 +60,53 @@
<a>Subnautica,<br>but</a> <a>Subnautica,<br>but</a>
<a class="main1_actcent">fishier</a><a>.</a> <a class="main1_actcent">fishier</a><a>.</a>
</div> </div>
<title>Player Counts</title>
<style>
#player-count {
font-size: 2em;
color: #ebe3e3;
}
#loading {
display: none;
color: #777;
}
</style>
<div class="main1_actcent" id="player-count">Loading...</div>
<script>
const playerCountElement = document.getElementById('player-count');
const prometheusURL = 'http://5.161.51.188:9090/api/v1/query?query=se_active_users';
// Function to fetch player count from Prometheus
async function fetchPlayerCount() {
try {
const response = await fetch(prometheusURL);
const data = await response.json();
// Extract the player count from the response
if (data.status === 'success' && data.data.result.length > 0) {
const playerCount = data.data.result[0].value[1];
playerCountElement.textContent = `Current Player Count: ${playerCount}`;
} else {
playerCountElement.textContent = 'No data';
}
} catch (error) {
console.error('Error fetching player count:', error);
playerCountElement.textContent = 'Error fetching data';
} finally {
}
}
// Fetch player count every 15 seconds
setInterval(fetchPlayerCount, 5000);
// Initial fetch when the page loads
fetchPlayerCount();
</script>
<p></p>
<div class="main1_ipcopier_div"> <div class="main1_ipcopier_div">
<button class="main1_ipcopier" type="button"> <button class="main1_ipcopier" type="button">
<span class="main1_ipcopier_text1"></span> <span class="main1_ipcopier_text1"></span>

View File

@ -60,6 +60,53 @@
<a>Risk of Rain,<br>but</a> <a>Risk of Rain,<br>but</a>
<a class="main1_actcent">Riskier</a><a>.</a> <a class="main1_actcent">Riskier</a><a>.</a>
</div> </div>
<title>Player Counts</title>
<style>
#player-count {
font-size: 2em;
color: #ebe3e3;
}
#loading {
display: none;
color: #777;
}
</style>
<div class="main1_actcent" id="player-count">Loading...</div>
<script>
const playerCountElement = document.getElementById('player-count');
const prometheusURL = 'http://5.161.51.188:9090/api/v1/query?query=st_active_users';
// Function to fetch player count from Prometheus
async function fetchPlayerCount() {
try {
const response = await fetch(prometheusURL);
const data = await response.json();
// Extract the player count from the response
if (data.status === 'success' && data.data.result.length > 0) {
const playerCount = data.data.result[0].value[1];
playerCountElement.textContent = `Current Player Count: ${playerCount}`;
} else {
playerCountElement.textContent = 'No data';
}
} catch (error) {
console.error('Error fetching player count:', error);
playerCountElement.textContent = 'Error fetching data';
} finally {
}
}
// Fetch player count every 15 seconds
setInterval(fetchPlayerCount, 5000);
// Initial fetch when the page loads
fetchPlayerCount();
</script>
<p></p>
<div class="main1_ipcopier_div"> <div class="main1_ipcopier_div">
<button class="main1_ipcopier" type="button"> <button class="main1_ipcopier" type="button">
<span class="main1_ipcopier_text1"></span> <span class="main1_ipcopier_text1"></span>