simple server info page for xenforo node page
This commit is contained in:
@@ -0,0 +1 @@
|
||||
[{"name": "UNLOZE.com/stoat | Zombie Escape | Stage: [Purple] | Nosteam", "map": "ze_minimal_v4_1", "players": "65/65", "ip": "51.195.188.106:27015"}, {"name": "UNLOZE.com/stoat | [ZRiot: Day 8/12] BOSS - Nightmares | Ranking", "map": "zr_roblox_crossroads_scythx", "players": "1/65", "ip": "51.195.188.106:27016"}, {"name": "UNLOZE | Minigames | FastDL | Ranking", "map": "mg_GumObstacle", "players": "2/41", "ip": "51.195.188.106:27017"}, {"name": "UNLOZE.com/stoat | Zombie Escape 2 | UK", "map": "ze_random_v9", "players": "7/65", "ip": "51.195.188.106:27035"}, {"name": "UNLOZE Sven Server", "map": "sandstone", "players": "0/32", "ip": "51.195.188.106:27025"}]
|
||||
@@ -0,0 +1,102 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>UNLOZE Server Status</title>
|
||||
<style>
|
||||
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: #121212; color: #e0e0e0; padding: 20px; }
|
||||
.container { max-width: 900px; margin: auto; }
|
||||
h1 { border-bottom: 2px solid #444; padding-bottom: 10px; color: #fff; }
|
||||
|
||||
.server-card {
|
||||
background: #1e1e1e;
|
||||
border-radius: 8px;
|
||||
padding: 15px;
|
||||
margin-bottom: 15px;
|
||||
border-left: 5px solid #00ff41; /* Green accent */
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
transition: transform 0.2s;
|
||||
}
|
||||
.server-card:hover { transform: translateX(5px); background: #252525; }
|
||||
|
||||
.info-main { flex-grow: 1; }
|
||||
.server-name { font-weight: bold; font-size: 1.1em; color: #00ff41; margin-bottom: 5px; }
|
||||
.server-sub { font-size: 0.9em; color: #aaa; }
|
||||
|
||||
.stats { text-align: right; min-width: 120px; }
|
||||
.players { font-size: 1.2em; font-weight: bold; color: #fff; }
|
||||
|
||||
.btn-connect {
|
||||
background: #00ff41;
|
||||
color: #000;
|
||||
text-decoration: none;
|
||||
padding: 8px 15px;
|
||||
border-radius: 4px;
|
||||
font-weight: bold;
|
||||
font-size: 0.8em;
|
||||
margin-left: 20px;
|
||||
}
|
||||
.btn-connect:hover { background: #00cc33; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="container">
|
||||
<h1>UNLOZE Server Info</h1>
|
||||
<div id="server-list">Loading servers...</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
async function loadServers() {
|
||||
try {
|
||||
const response = await fetch('servers.json');
|
||||
const data = await response.json();
|
||||
|
||||
const listContainer = document.getElementById('server-list');
|
||||
listContainer.innerHTML = '';
|
||||
|
||||
data.forEach(server => {
|
||||
const card = document.createElement('div');
|
||||
card.className = 'server-card';
|
||||
card.innerHTML = `
|
||||
<div class="info-main">
|
||||
<div class="server-name">${server.name}</div>
|
||||
<div class="server-sub">Map: <strong>${server.map}</strong></div>
|
||||
</div>
|
||||
<div class="stats">
|
||||
<div class="players">${server.players}</div>
|
||||
<div class="server-sub">${server.ip}</div>
|
||||
</div>
|
||||
<a href="steam://connect/${server.ip}" class="btn-connect">CONNECT</a>
|
||||
`;
|
||||
listContainer.appendChild(card);
|
||||
});
|
||||
|
||||
// --- ADD THIS LINE HERE ---
|
||||
// Tell the parent XenForo page to resize now that the content is actually here
|
||||
sendHeight();
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error loading JSON:', error);
|
||||
document.getElementById('server-list').innerText = 'Failed to load server data.';
|
||||
}
|
||||
}
|
||||
|
||||
function sendHeight() {
|
||||
// Add a little buffer (e.g., + 20) to ensure nothing is clipped
|
||||
const height = document.body.scrollHeight + 20;
|
||||
window.parent.postMessage({ type: 'setHeight', height: height }, '*');
|
||||
}
|
||||
|
||||
// Initial load
|
||||
loadServers();
|
||||
// Refresh every 30s
|
||||
setInterval(loadServers, 30000);
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user