Files
two-stands-cg/top10.html
T
2026-08-02 13:09:39 +03:00

204 lines
5.7 KiB
HTML

<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=1920, initial-scale=1">
<title>Top 10 — Revenue</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
<style>
@font-face { font-family: 'ONY One'; src: local('ONY One Regular'), url('file:///home/itten/.local/share/fonts/ONYOne-Regular.otf') format('opentype'); font-weight: 400; }
@font-face { font-family: 'ONY One'; src: local('ONY One Medium'), url('file:///home/itten/.local/share/fonts/ONYOne-Medium.otf') format('opentype'); font-weight: 500; }
@font-face { font-family: 'ONY One'; src: local('ONY One Bold'), url('file:///home/itten/.local/share/fonts/ONYOne-Bold.otf') format('opentype'); font-weight: 700; }
:root {
--bg: #222524;
--white: #FFFFFF;
--neutral: #919292;
--accent: #91FF55;
--negative: #F8F700;
--row-alt: #2A2D2C;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
width: 1920px;
height: 1080px;
background: var(--bg);
overflow: hidden;
font-family: 'ONY One', 'Arial Narrow', sans-serif;
-webkit-font-smoothing: antialiased;
}
.frame {
position: relative;
width: 1920px;
height: 1080px;
display: flex;
align-items: center;
justify-content: center;
}
.table-wrapper {
width: fit-content;
max-width: 1730px;
position: relative;
margin: 0 auto;
}
.table-title {
font-size: 48px;
font-weight: 700;
text-transform: uppercase;
color: var(--white);
text-align: center;
margin-bottom: 28px;
letter-spacing: 3px;
}
.table-header {
display: grid;
grid-template-columns: 80px auto 80px 160px 160px 160px;
align-items: center;
border-bottom: 3px solid var(--white);
padding-bottom: 16px;
margin-bottom: 8px;
}
.header-cell {
font-size: 28px;
font-weight: 700;
text-transform: uppercase;
text-align: center;
color: var(--neutral);
letter-spacing: 1px;
}
.header-cell.left { text-align: left; }
.header-cell.right { text-align: right; }
.table-row {
display: grid;
grid-template-columns: 80px auto 80px 160px 160px 160px;
align-items: center;
height: 72px;
transition: background 0.2s;
}
.table-row:nth-child(even) {
background: var(--row-alt);
}
.col-rank {
font-size: 32px;
font-weight: 700;
color: var(--neutral);
text-align: center;
}
.col-team {
font-size: 32px;
font-weight: 500;
color: var(--white);
padding-left: 24px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.col-val {
font-size: 28px;
font-weight: 500;
color: var(--white);
text-align: right;
padding-right: 24px;
white-space: nowrap;
}
.col-diff {
font-size: 28px;
font-weight: 700;
text-align: right;
padding-right: 24px;
white-space: nowrap;
}
.diff-positive { color: var(--accent); }
.diff-negative { color: var(--negative); }
.diff-zero { color: var(--neutral); }
</style>
</head>
<body>
<div class="frame">
<div class="table-wrapper">
<div class="table-title">Топ-10 команд по доходам</div>
<div class="table-header">
<div class="header-cell"></div>
<div class="header-cell left">Команда</div>
<div></div>
<div class="header-cell right">Доходы</div>
<div class="header-cell right">Затраты</div>
<div class="header-cell right">Разница</div>
</div>
<div id="rows"></div>
</div>
</div>
<script>
var CSV_URL = "top-10-teams-by-revenue.csv";
function parseCSV(text) {
var lines = text.trim().split(/\r?\n/);
var result = [];
for (var i = 1; i < lines.length; i++) {
var line = lines[i].trim();
if (!line) continue;
var fields = [];
var cur = "", inQ = false;
for (var j = 0; j < line.length; j++) {
var ch = line[j];
if (ch === '"') inQ = !inQ;
else if (ch === ',' && !inQ) { fields.push(cur.trim()); cur = ""; }
else cur += ch;
}
fields.push(cur.trim());
if (fields.length >= 4) result.push({
team: fields[0], income: fields[1], spend: fields[2], diff: fields[3]
});
}
return result;
}
function fmt(val) {
return val;
}
function diffClass(val) {
var n = parseFloat(val.replace(",", ".").replace("«", "").replace("»", ""));
if (isNaN(n) || n === 0) return "diff-zero";
return n > 0 ? "diff-positive" : "diff-negative";
}
function buildRow(idx, row) {
return '<div class="table-row">' +
'<div class="col-rank">' + (idx + 1) + '</div>' +
'<div class="col-team">' + row.team + '</div>' +
'<div></div>' +
'<div class="col-val">' + row.income + '</div>' +
'<div class="col-val">' + row.spend + '</div>' +
'<div class="col-diff ' + diffClass(row.diff) + '">' + row.diff + '</div>' +
'</div>';
}
fetch(CSV_URL)
.then(function (r) { return r.text(); })
.then(function (text) {
var data = parseCSV(text);
document.getElementById("rows").innerHTML =
data.map(function (row, i) { return buildRow(i, row); }).join("");
console.log("Loaded " + data.length + " rows");
})
.catch(function (e) { console.error("Failed to load CSV", e); });
</script>
</body>
</html>