-
Notifications
You must be signed in to change notification settings - Fork 0
/
games.html
33 lines (32 loc) · 1011 Bytes
/
games.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
<!DOCTYPE html>
<html>
<head>
<title>My Recent Lichess Games</title>
<style>
.game {
margin-bottom: 2em;
white-space: pre-wrap;
font-family: monospace;
}
</style>
</head>
<body>
<h1>My 10 Most Recent Games from Lichess</h1>
<div id="games"></div>
<script>
fetch('.tuttlepower_games.pgn')
.then(response => response.text())
.then(data => {
// Split games by two newline characters
const games = data.split('\n\n').filter(game => game.trim() !== '');
const gamesDiv = document.getElementById('games');
games.forEach((game, index) => {
const gameDiv = document.createElement('div');
gameDiv.className = 'game';
gameDiv.textContent = `Game ${index + 1}:\n${game}`;
gamesDiv.appendChild(gameDiv);
});
});
</script>
</body>
</html>