mirror of
https://github.com/jakejarvis/npqueue.git
synced 2025-11-01 12:34:02 -04:00
initial commit
This commit is contained in:
442087
directory.json
Normal file
442087
directory.json
Normal file
File diff suppressed because it is too large
Load Diff
BIN
favicon.ico
Normal file
BIN
favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 66 KiB |
BIN
favicon.png
Normal file
BIN
favicon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 42 KiB |
78
fetch.js
Normal file
78
fetch.js
Normal file
@@ -0,0 +1,78 @@
|
||||
document.addEventListener("DOMContentLoaded", updateData, false);
|
||||
|
||||
async function fetchData() {
|
||||
let request = await fetch("https://hidden-depths-42970.herokuapp.com/api/list");
|
||||
if(request.status == 200) {
|
||||
console.log("New JSON successfully fetched!");
|
||||
let data = await request.json();
|
||||
return data;
|
||||
}
|
||||
throw new Error(request.status);
|
||||
}
|
||||
|
||||
function updateData() {
|
||||
fetchData().then(data => updateTable(data)).catch(data => console.log(data));
|
||||
|
||||
// Re-fetch data every 15 seconds
|
||||
setTimeout(updateData, 15000);
|
||||
}
|
||||
|
||||
function updateTable(data) {
|
||||
active = document.getElementById("active");
|
||||
active.innerText = `Active Players: ${data.currentPlayers} / 32`;
|
||||
|
||||
queue = document.getElementById("queue");
|
||||
queue.innerText = `In Queue: ${data.currentQueue}`;
|
||||
|
||||
table = document.getElementsByTagName("table")[0].getElementsByTagName("tbody")[0];
|
||||
|
||||
data.players = data.players.sort((a, b) => (a.id > b.id) ? 1 : ((b.id > a.id) ? -1 : 0));
|
||||
|
||||
data.players.forEach(function(player, i) {
|
||||
newRow = table.insertRow(table.rows.length);
|
||||
|
||||
newCell = newRow.insertCell(0);
|
||||
newText = document.createTextNode(`${i+1}`)
|
||||
newCell.appendChild(newText);
|
||||
|
||||
newCell = newRow.insertCell(1);
|
||||
newText = document.createTextNode(`${player.id}`)
|
||||
newCell.appendChild(newText);
|
||||
|
||||
newCell = newRow.insertCell(2);
|
||||
a = document.createElement('a');
|
||||
a.setAttribute('href', `https://www.twitch.tv/${player.identifiers[3]}`);
|
||||
a.setAttribute('target', '_blank');
|
||||
a.setAttribute('rel', 'noopener noreferrer nofollow');
|
||||
a.innerHTML = player.identifiers[3];
|
||||
newCell.appendChild(a);
|
||||
|
||||
newCell = newRow.insertCell(3);
|
||||
a = document.createElement('a');
|
||||
a.setAttribute('href', `https://www.nopixel.net/upload/index.php?members/${player.identifiers[4]}`);
|
||||
a.setAttribute('target', '_blank');
|
||||
a.setAttribute('rel', 'noopener noreferrer nofollow');
|
||||
a.innerHTML = player.identifiers[0];
|
||||
newCell.appendChild(a);
|
||||
|
||||
newCell = newRow.insertCell(4);
|
||||
a = document.createElement('a');
|
||||
a.setAttribute('href', `https://steamcommunity.com/profiles/${player.identifiers[2]}`);
|
||||
a.setAttribute('target', '_blank');
|
||||
a.setAttribute('rel', 'noopener noreferrer nofollow');
|
||||
a.innerHTML = player.name;
|
||||
newCell.appendChild(a);
|
||||
|
||||
newCell = newRow.insertCell(5);
|
||||
newText = document.createTextNode(`${player.identifiers[1]}`)
|
||||
newCell.appendChild(newText);
|
||||
|
||||
newCell = newRow.insertCell(6);
|
||||
newText = document.createTextNode(`${player.identifiers[2]}`)
|
||||
newCell.appendChild(newText);
|
||||
|
||||
newCell = newRow.insertCell(7);
|
||||
newText = document.createTextNode(`${player.ping} ms`)
|
||||
newCell.appendChild(newText);
|
||||
});
|
||||
}
|
||||
34
index.html
Normal file
34
index.html
Normal file
@@ -0,0 +1,34 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>NoPixel GTA5 RP Online Players</title>
|
||||
<link rel="icon" href="favicon.ico" type="image/x-icon">
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="title">NoPixel Server 1</h1>
|
||||
<h2 id="active">Active Players:</h2>
|
||||
<h2 id="queue">In Queue:</h2>
|
||||
<p>Please report missing or inaccurate on <a href="#">GitHub</a> or <a href="mailto:nopixellist@gmail.com">via email</a>.</p>
|
||||
<table id="players">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Session ID</th>
|
||||
<th>Twitch</th>
|
||||
<th>NoPixel Forums</th>
|
||||
<th>Steam Name</th>
|
||||
<th>Steam ID</th>
|
||||
<th>Steam64 ID</th>
|
||||
<th>Ping</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<script src="fetch.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
11
style.css
Normal file
11
style.css
Normal file
@@ -0,0 +1,11 @@
|
||||
body {
|
||||
font-size: 1em;
|
||||
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
|
||||
"Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans",
|
||||
"Droid Sans", "Helvetica Neue", sans-serif,
|
||||
"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
||||
}
|
||||
|
||||
table, th, td {
|
||||
border: 1px solid #000;
|
||||
}
|
||||
Reference in New Issue
Block a user