258 lines
11 KiB
HTML
258 lines
11 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>KittyRec — XP Leaderboard</title>
|
|
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
|
|
<link rel="icon" type="image/png" sizes="32x32" href="/static/kittyrec_icon.png">
|
|
<link rel="apple-touch-icon" href="/static/kittyrec_icon.png">
|
|
<style>
|
|
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
|
:root {
|
|
--bg: #06050f; --bg2: #0c0a1e; --bg3: #13102e; --bg4: #1a1640;
|
|
--purple: #8b5cf6; --purple-l: #a78bfa; --purple-d: #6d3bef;
|
|
--teal: #2dd4bf; --green: #34d399; --yellow: #fbbf24; --red: #f87171;
|
|
--text: #ede9fe; --text2: #a39dc8; --text3: #5c5488;
|
|
--card-r: 20px; --gap: 20px;
|
|
--ease: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
|
|
}
|
|
html { scroll-behavior: smooth; }
|
|
body {
|
|
background: var(--bg); color: var(--text);
|
|
font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
font-size: 14px; line-height: 1.6;
|
|
-webkit-font-smoothing: antialiased;
|
|
overflow-x: hidden; padding-bottom: 80px;
|
|
}
|
|
a { color: var(--purple-l); text-decoration: none; transition: var(--ease); }
|
|
a:hover { color: var(--text); }
|
|
|
|
.nav-wrapper {
|
|
position: fixed; top: 24px; left: 0; right: 0; z-index: 100;
|
|
display: flex; justify-content: center; pointer-events: none;
|
|
}
|
|
.nav {
|
|
pointer-events: auto; display: flex; align-items: center; justify-content: space-between;
|
|
background: rgba(12,10,30,0.65); backdrop-filter: blur(24px) saturate(1.2);
|
|
border: 1px solid rgba(255,255,255,0.05); padding: 0 24px; height: 56px;
|
|
border-radius: 100px; width: calc(100% - 48px); max-width: 1200px;
|
|
box-shadow: 0 12px 40px rgba(0,0,0,0.2);
|
|
}
|
|
.nav-brand { display: flex; align-items: center; }
|
|
.nav-links { display: flex; gap: 28px; align-items: center; }
|
|
.nav-links a { font-size: 13px; font-weight: 500; color: var(--text2); }
|
|
.nav-links a:hover { color: #fff; }
|
|
.nav-links a.active { color: #fff; }
|
|
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }
|
|
.nav-status { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--text); padding-left: 12px; border-left: 1px solid rgba(255,255,255,0.1); }
|
|
|
|
.page-wrap { max-width: 1200px; margin: 104px auto 0; padding: 0 24px; }
|
|
.page-head { margin-bottom: 32px; }
|
|
.page-title { font-size: clamp(28px, 4vw, 40px); font-weight: 700; color: #fff; letter-spacing: -0.03em; }
|
|
.page-sub { color: var(--text2); font-size: 15px; margin-top: 8px; }
|
|
.player-count { color: var(--text3); font-size: 13px; font-weight: 600; margin-top: 4px; }
|
|
|
|
.lb-list { display: flex; flex-direction: column; gap: 8px; }
|
|
.lb-row {
|
|
display: flex; align-items: center; gap: 16px; padding: 14px 20px;
|
|
background: var(--bg2); border: 1px solid rgba(255,255,255,0.03);
|
|
border-radius: 14px; cursor: pointer; transition: var(--ease);
|
|
}
|
|
.lb-row:hover {
|
|
transform: translateY(-2px); border-color: rgba(255,255,255,0.1);
|
|
box-shadow: 0 12px 32px rgba(0,0,0,0.3);
|
|
}
|
|
.lb-rank { font-size: 16px; font-weight: 800; min-width: 36px; text-align: center; }
|
|
.lb-pfp {
|
|
width: 44px; height: 44px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
|
|
background: var(--bg3); display: flex; align-items: center; justify-content: center;
|
|
font-weight: 700; font-size: 18px; color: var(--text2); position: relative;
|
|
}
|
|
.lb-pfp img { width: 100%; height: 100%; object-fit: cover; }
|
|
.lb-online {
|
|
position: absolute; bottom: 0; right: 0; width: 12px; height: 12px;
|
|
border-radius: 50%; background: var(--green); border: 2px solid var(--bg2);
|
|
box-shadow: 0 0 6px var(--green);
|
|
}
|
|
.lb-info { flex: 1; min-width: 0; }
|
|
.lb-name { font-weight: 600; font-size: 14px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
.lb-meta { font-size: 12px; color: var(--text3); }
|
|
.lb-xp { font-size: 15px; font-weight: 700; color: var(--teal); white-space: nowrap; }
|
|
|
|
.overlay {
|
|
position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,0.6);
|
|
backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center;
|
|
opacity: 0; transition: opacity 0.3s ease; pointer-events: none;
|
|
}
|
|
.overlay.visible { opacity: 1; pointer-events: auto; }
|
|
.popup {
|
|
background: var(--bg2); border: 1px solid rgba(255,255,255,0.06);
|
|
border-radius: 24px; padding: 40px; max-width: 400px; width: calc(100% - 48px);
|
|
text-align: center; transform: scale(0.92); transition: transform 0.3s ease;
|
|
box-shadow: 0 32px 64px rgba(0,0,0,0.5);
|
|
}
|
|
.overlay.visible .popup { transform: scale(1); }
|
|
.popup-pfp {
|
|
width: 88px; height: 88px; border-radius: 50%; margin: 0 auto 16px;
|
|
background: var(--bg3); overflow: hidden; display: flex; align-items: center;
|
|
justify-content: center; font-size: 36px; font-weight: 700; color: var(--text2);
|
|
}
|
|
.popup-pfp img { width: 100%; height: 100%; object-fit: cover; }
|
|
.popup-name { font-size: 20px; font-weight: 700; color: #fff; }
|
|
.popup-user { font-size: 13px; color: var(--text3); margin-top: 2px; }
|
|
.popup-badge {
|
|
display: inline-block; margin-top: 10px; padding: 3px 12px;
|
|
border-radius: 100px; font-size: 11px; font-weight: 700; text-transform: uppercase;
|
|
letter-spacing: 0.5px;
|
|
}
|
|
.popup-badge.dev { background: rgba(139,92,246,0.15); color: var(--purple-l); }
|
|
.popup-badge.player { background: rgba(45,212,191,0.1); color: var(--teal); }
|
|
.popup-bio { color: var(--text2); font-size: 13px; margin-top: 14px; line-height: 1.5; }
|
|
.popup-stats {
|
|
display: flex; gap: 24px; justify-content: center; margin-top: 20px;
|
|
padding-top: 20px; border-top: 1px solid rgba(255,255,255,0.05);
|
|
}
|
|
.popup-stat-label { font-size: 11px; color: var(--text3); text-transform: uppercase; font-weight: 600; letter-spacing: 0.5px; }
|
|
.popup-stat-val { font-size: 20px; font-weight: 700; color: #fff; margin-top: 2px; }
|
|
|
|
.empty { color: var(--text3); font-size: 13px; padding: 48px 0; text-align: center; }
|
|
|
|
@media (max-width: 600px) {
|
|
.lb-row { padding: 12px 14px; gap: 12px; }
|
|
.lb-pfp { width: 36px; height: 36px; font-size: 14px; }
|
|
.lb-rank { min-width: 28px; font-size: 14px; }
|
|
.lb-xp { font-size: 13px; }
|
|
.popup { padding: 28px 20px; }
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<div class="nav-wrapper">
|
|
<nav class="nav">
|
|
<a href="/" class="nav-brand"><img src="/static/kittyrec_icon.png" alt="KittyRec" style="height:38px;width:38px;"></a>
|
|
<div class="nav-links">
|
|
<a href="/">Home</a>
|
|
<a href="/leaderboard" class="active">Leaderboard</a>
|
|
<a href="/recnet">RecNet</a>
|
|
<a href="/account">Account</a>
|
|
<a href="/api-docs">API</a>
|
|
<div class="nav-status"><div class="dot"></div><span id="nav-online">Online</span></div>
|
|
</div>
|
|
</nav>
|
|
</div>
|
|
|
|
<div class="page-wrap">
|
|
<div class="page-head">
|
|
<div class="page-title">XP Leaderboard</div>
|
|
<div class="page-sub">who's got the most xp</div>
|
|
<div class="player-count" id="player-count"></div>
|
|
</div>
|
|
<div class="lb-list" id="lb-list">
|
|
<div class="empty">Loading...</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="overlay" id="overlay">
|
|
<div class="popup" id="popup"></div>
|
|
</div>
|
|
|
|
<script>
|
|
function esc(s) {
|
|
var d = document.createElement("div");
|
|
d.appendChild(document.createTextNode(s));
|
|
return d.innerHTML;
|
|
}
|
|
|
|
var EXCLUDE = ["myawired", "kittyrec", "player"];
|
|
|
|
function rankColor(i) {
|
|
if (i === 1) return "#c9a227";
|
|
if (i === 2) return "#8a8a8a";
|
|
if (i === 3) return "#a0522d";
|
|
return "var(--text3)";
|
|
}
|
|
|
|
function formatXP(n) {
|
|
if (n >= 1000000) return (n / 1000000).toFixed(1).replace(/\.0$/, "") + "M";
|
|
if (n >= 1000) return (n / 1000).toFixed(1).replace(/\.0$/, "") + "K";
|
|
return String(n);
|
|
}
|
|
|
|
function openProfile(id, name) {
|
|
var o = document.getElementById("overlay");
|
|
var p = document.getElementById("popup");
|
|
var initial = esc((name || "?")[0].toUpperCase());
|
|
p.innerHTML = '<div class="popup-pfp">' + initial + '</div><div class="popup-name">Loading...</div>';
|
|
o.classList.add("visible");
|
|
|
|
fetch("/api/public/v1/profile/" + id).then(function(r) { return r.json(); }).then(function(d) {
|
|
var pfpHTML = d.profile_image
|
|
? '<img src="/alt/' + encodeURIComponent(d.profile_image) + '" onerror="this.parentNode.innerHTML=\'' + initial + '\'">'
|
|
: initial;
|
|
var badge = d.developer
|
|
? '<div class="popup-badge dev">Dev</div>'
|
|
: '<div class="popup-badge player">Player</div>';
|
|
var bio = d.bio ? '<div class="popup-bio">' + esc(d.bio) + '</div>' : '';
|
|
p.innerHTML =
|
|
'<div class="popup-pfp">' + pfpHTML + '</div>' +
|
|
'<div class="popup-name">' + esc(d.display_name || d.username) + '</div>' +
|
|
'<div class="popup-user">@' + esc(d.username) + '</div>' +
|
|
badge + bio +
|
|
'<div class="popup-stats">' +
|
|
'<div><div class="popup-stat-label">Level</div><div class="popup-stat-val">' + d.level + '</div></div>' +
|
|
'<div><div class="popup-stat-label">XP</div><div class="popup-stat-val" style="color:var(--teal)">' + formatXP(d.xp) + '</div></div>' +
|
|
'</div>';
|
|
});
|
|
}
|
|
|
|
document.getElementById("overlay").addEventListener("click", function(e) {
|
|
if (e.target === this) this.classList.remove("visible");
|
|
});
|
|
document.addEventListener("keydown", function(e) {
|
|
if (e.key === "Escape") document.getElementById("overlay").classList.remove("visible");
|
|
});
|
|
|
|
fetch("/web/leaderboard").then(function(r) { return r.json(); }).then(function(players) {
|
|
var filtered = players.filter(function(p) {
|
|
return EXCLUDE.indexOf((p.username || "").toLowerCase()) === -1;
|
|
});
|
|
filtered.sort(function(a, b) { return b.xp - a.xp; });
|
|
|
|
document.getElementById("player-count").textContent = filtered.length + " players";
|
|
|
|
var list = document.getElementById("lb-list");
|
|
if (!filtered.length) { list.innerHTML = '<div class="empty">No players yet.</div>'; return; }
|
|
|
|
var html = "";
|
|
for (var i = 0; i < filtered.length; i++) {
|
|
var p = filtered[i];
|
|
var rank = i + 1;
|
|
var name = p.display_name || p.username;
|
|
var initial = (name || "?")[0].toUpperCase();
|
|
html +=
|
|
'<div class="lb-row" onclick="openProfile(' + p.id + ',\'' + esc(name).replace(/'/g, "\\'") + '\')">' +
|
|
'<div class="lb-rank" style="color:' + rankColor(rank) + '">#' + rank + '</div>' +
|
|
'<div class="lb-pfp" style="position:relative;">' +
|
|
(p.has_image ? '<img src="/alt/' + p.id + '" style="position:absolute;inset:0;width:100%;height:100%;object-fit:cover;">' : '') +
|
|
'<span style="position:relative;z-index:0;">' + esc(initial) + '</span>' +
|
|
(p.online ? '<div class="lb-online"></div>' : '') +
|
|
'</div>' +
|
|
'<div class="lb-info">' +
|
|
'<div class="lb-name">' + esc(name) + '</div>' +
|
|
'<div class="lb-meta">@' + esc(p.username) + ' · Lv ' + p.level + '</div>' +
|
|
'</div>' +
|
|
'<div class="lb-xp">' + formatXP(p.xp) + ' XP</div>' +
|
|
'</div>';
|
|
}
|
|
list.innerHTML = html;
|
|
});
|
|
|
|
fetch("/web/status").then(function(r) { return r.json(); }).then(function(d) {
|
|
document.getElementById("nav-online").textContent = d.online + " Online";
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|