-
Notifications
You must be signed in to change notification settings - Fork 0
/
leaderboard.html
87 lines (82 loc) · 2.1 KB
/
leaderboard.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
<!DOCTYPE html>
<html>
<head>
<style>
body, html {
overflow: hidden;
margin: 0;
padding: 0;
height: 100%;
}
.container {
width: 100%;
height: 100%;
display: flex; /* Add Flexbox */
align-items: center; /* Align children vertically center */
justify-content: center; /* Align children horizontally center */
}
.textbox {
width: 55vw;
height: 65vh;
font-size: 1.2vw;
color: white;
padding: 4vw;
border: 0.5vw solid #ccc;
border-radius: 5vw;
background-color: rgba(0, 100, 0, 0.5);
font-family: Verdana, Geneva, Tahoma, sans-serif;
overflow-y: auto; /* Add scroll for overflow */
}
button {
width: 30.5%;
height: 12%;
background-image: url('static/start.png');
background-size: cover;
border: none;
cursor: pointer;
}
</style>
</head>
<body>
<div class="container">
<p class="textbox" id="fileContent"></p>
</div>
<script>
// Function to fetch file content and display it
function fetchAndDisplayFile(fileName) {
fetch(`http://127.0.0.1:8000/dataFolder/${fileName}`)
.then(response => {
if (!response.ok) {
throw new Error(`Failed to fetch file: ${fileName}`);
}
return response.text();
})
.then(data => {
const fileContentElement = document.getElementById('fileContent');
fileContentElement.textContent = data;
})
.catch(error => {
console.error('Error:', error);
});
}
// Function to read all files in the dataFolder
fetch('/dataFolder')
.then(response => {
if (!response.ok) {
throw new Error('Failed to fetch files from dataFolder');
}
return response.json();
})
.then(files => {
files.forEach(fileName => {
if (fileName.includes('Level 3_overall')) {
fetchAndDisplayFile(fileName);
}
});
})
.catch(error => {
console.error('Error:', error);
});
</script>
</body>
</html>