-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
137 lines (126 loc) · 4.86 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<html>
<head>
<title>Commit Leaderboard</title>
<meta name="twitter:card" content="summary_large_image" />
<meta name="description" content="commit every day marcelo!!" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
@media (prefers-color-scheme: dark) {
:root {
color-scheme: dark;
}
}
body {
margin: 20px;
}
nav {
margin: -20px;
margin-bottom: 0;
padding: 20px;
position: sticky;
top:0;
background: aquamarine;
}
table {
border-collapse: collapse;
width: 100%;
}
th, td {
padding: 8px;
text-align: left;
border-bottom: 1px solid color-mix(in srgb, currentColor 13%, transparent);
}
th {
background-color: color-mix(in srgb, currentColor 5%, transparent);
}
.horse-anything {
max-width: 100%;
height: auto;
}
</style>
<meta property="og:image" content="https://nolanchai.dev/Commit-Challenge-2024/images/marcelo_nod.gif" />
<script src="https://fastly.jsdelivr.net/gh/stevenjoezhang/live2d-widget@latest/autoload.js"></script>
</head>
<body>
<nav>
<a href="ascii">ASCII</a>
·
<a href="fish">fish</a>
·
<a href="pdf">PDF</a>
·
<a href="ucsd-tts">UCSD TTS</a>
·
<a href="ocean">ocean</a>
·
<a href="spamsound">spamsound</a>
</nav>
<h2>Commit Leaderboard</h2>
<table id="commitTable">
<tr>
<th>Author</th>
<th>Commits</th>
</tr>
</table>
<img src="images/diversity.png" alt="you CAN horse anything" class="horse-anything">
<img src="images/marcelo_nod.gif"alt="Marcelo nodding gif"/>
<div style="font-family: sans-serif; font-size: 10px; padding: 5px;gap:5px; border: 1px solid black; background:white; display: flex;gap:2px;color:black; align-items: center;">
<span style="padding: 5px;border-radius:2px;background-color:FDD835;">AD</span>
Are you out of storage? Try the WESTERN DIGITAL 2TB ELEMENTS PORTABLE HDD, EXTERNAL HARD DRIVE, USB 3.0 FOR PC & MAC, PLUG AND PLAY READY - WDBU6Y0020BBK-WESN now!
</div>
<div style="font-family: sans-serif; font-size: 10px; padding: 5px;gap:5px; border: 1px solid black; background:white; display: flex;gap:2px;color:black; align-items: center;">
<span style="padding: 5px;border-radius:2px;background-color:FDD835;">AD</span>
Are you tired of sitting in the dark? Try the PHILIPS FC12T9/COOL WHITEPLUS 32 WATT now!
</div>
<modal></modal>
<dialog id=dialoguement>
<form method="dialog">
<p>This site uses cookies. Visit our cookies policy page or click the link in any footer for more information and to change your preferences.</p>
<button>Accept all cookies</button>
<button>Accept </button>
</form>
</dialog>
<script>
window.onload = function() {
fetch('alias.txt')
.then(response => response.json())
.then(mappings => {
// generate leaderboard table
fetch('tables.txt')
.then(response => response.text())
.then(data => {
// remove strange characters
const regex = /[^\t\s\w\u1000]/g;
let rows = data.replace(regex,'').split('\n');
rows = rows.map(s => s.trim()).filter(Boolean);
// map people to their usernames
let map = new Map();
rows.forEach(row => {
let [commits, author] = row.split('\t');
const n_author = normalizeAuthor(author, mappings);
map.set(n_author, (map.get(n_author) || 0) + parseInt(commits));
});
let tableHTML = '';
const sortedMap = new Map([...map.entries()].sort((a, b) => b[1] - a[1]));
// generate table html
sortedMap.forEach((commits, author) => {
tableHTML += `<tr>\n<td>${author}</td>\n<td>${commits}</td>\n</tr>\n`;
});
document.getElementById('commitTable').innerHTML += tableHTML;
})
.catch(error => console.error('Error fetching file:', error));
})
.catch(error => console.error('Error fetching alias mappings:', error));
};
function normalizeAuthor(author, mappings) {
for (const [name, variations] of Object.entries(mappings)) {
if (variations.includes(author)) {
return name;
}
}
return author;
}
dialoguement.showModal()
</script>
</body>
</html>