-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathteaching.html
More file actions
64 lines (58 loc) · 1.95 KB
/
Copy pathteaching.html
File metadata and controls
64 lines (58 loc) · 1.95 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Teaching — Unary Lab</title>
<meta name="description" content="Courses taught by Di Wu at UCF (Unary Lab).">
<link rel="icon" href="file/logo/unary-logo-black.svg" type="image/svg+xml">
<link rel="stylesheet" href="css/style.css?v=1">
</head>
<body>
<div id="nav-placeholder"></div>
<main>
<div class="container">
<div id="teaching-root">
<p class="placeholder-msg">Loading…</p>
</div>
</div>
</main>
<script src="js/utils.js?v=1"></script>
<script>
document.addEventListener('DOMContentLoaded', async () => {
try {
const [courses, boards] = await Promise.all([
loadCSV('data/teaching.csv'),
loadCSV('data/leaderboard.csv'),
]);
const introHtml = boards.length
? `<p class="teaching-intro">${boards.map(b =>
`<a href="${esc(b.url)}" target="_blank" rel="noopener">${esc(b.title)}</a>`
).join('<br>')}</p>`
: '';
let listHtml;
if (courses.length === 0) {
listHtml = placeholder('No courses listed yet.');
} else {
const sorted = sortDescByDate(courses);
listHtml = `<ul class="teaching-list">${sorted.map(c => {
const d = parseNewsDate(c.date);
const semYear = [c.semester, d ? d.getFullYear() : ''].filter(Boolean).join(' ');
const meta = [semYear, c.role].filter(Boolean).join(' — ');
return `
<li class="teaching-item">
<div class="teaching-course">${esc(c.title)}</div>
<div class="teaching-detail">${esc(meta)}</div>
</li>`;
}).join('')}</ul>`;
}
document.getElementById('teaching-root').innerHTML =
`<h1 class="page-title">Teaching</h1>${introHtml}${listHtml}`;
} catch (e) {
document.getElementById('teaching-root').innerHTML = placeholder('Could not load teaching data.');
console.error(e);
}
});
</script>
</body>
</html>