-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
104 lines (79 loc) · 2.56 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<html>
<head>
<!--Get your own code at fontawesome.com-->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css">
<script>
$(document).ready(function () {
$.get('users.txt', function (data) {
const myArray = data.split(",");
var rownumbe=1
myArray.forEach(x => {
CallApi(rownumbe,x)
rownumbe++;
})
});
function CallApi(rownumber,username) {
var jqxhr = $.get("https://lichess.org/api/user/" + username, function (data) {
AddDatatToTable(rownumber, data);
})
}
function AddDatatToTable(rowNumber, data) {
var row = '<tr><th scope="row">' + rowNumber + '</th>';
row += '<td><h5><a href=' + data.url + '>' + data.username + '</a></h5></td>';
// ======================= classical
row += AddTd(data.perfs.classical)
// ======================= rapid
row += AddTd(data.perfs.rapid)
// ======================= blitz
row += AddTd(data.perfs.blitz)
row += '</tr>';
$('#table_data').append(row);
}
function AddTd(data) {
var row = '<td><span class="rpNumber">' + data.rating + '</span>';
var downOrUp = "";
var badOrGood = "";
if (data.prog != 0) {
downOrUp = (data.prog > 0) ? 'up' : 'down';
badOrGood = (data.prog > 0) ? 'good' : 'bad';
row += '<i class="rp-' + badOrGood + ' bi bi-arrow-' + downOrUp + '-right">' + data.prog + '</i>';
}
row += '</td>';
return row;
}
});
</script>
<style>
.rpNumber {
color: #787878;
font-weight: bold;
font-size: 1.2em;
}
.rp-bad {
color: #c33;
}
.rp-good {
color: #629924;
}
</style>
</head>
<body>
<table class="table table-striped">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Players</th>
<th scope="col">Classical</th>
<th scope="col">Rapid</th>
<th scope="col">Blitz</th>
</tr>
</thead>
<tbody id="table_data">
</tbody>
</table>
</body>
</html>