-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
100 lines (90 loc) · 4.15 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Human-Centered AI Reading Group</title>
<link rel="stylesheet" href="styles.css">
<!-- Google Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inconsolata:[email protected]&family=Micro+5&display=swap" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/public-google-sheets-parser@latest"></script>
<script>
const upcoming_events_div = document.getElementById("events");
const parser = new PublicGoogleSheetsParser('1GLPG7ugimrKaaJjhGHymV8fttoSfgtGLzHD4C0oxdL4', { useFormat: true });
const eventsData = {
events: [],
past_events: [],
};
const retrieveDataPromises = [];
// Extract first sheet
parser.setOption({ sheetName: "Upcoming Events" });
retrieveDataPromises.push(
parser.parse().then(data => (eventsData.events = data))
);
// Extract second sheet
parser.setOption({ sheetName: "Past Events" });
retrieveDataPromises.push(
parser.parse().then(data => (eventsData.past_events = data))
);
// When the document loads, inject the event data from the Google Sheet:
document.addEventListener('DOMContentLoaded', function() {
Promise.allSettled(retrieveDataPromises).then(results => {
if (results.some(r => r.status === "rejected")) {
// Error retrieving the spreadsheet, default to just injecting the link directly:
const container_div = document.getElementById("container");
container_div.innerHTML = `
<p>😰 Error loading event data dynamically. See the schedule in the <a href="https://docs.google.com/spreadsheets/d/1GLPG7ugimrKaaJjhGHymV8fttoSfgtGLzHD4C0oxdL4/edit?usp=sharing">public Google Sheet</a>.</p>
`;
return;
}
// Remove all loading spinners
document.querySelectorAll('.lds-ellipsis').forEach(e => e.remove());
// Success processing sheet --inject it into the HTML:
Object.keys(eventsData).forEach((event_container_id) => {
let eventsContainer = document.getElementById(event_container_id);
eventsData[event_container_id].forEach(function(event) {
const speakerInfo = event.Speaker ? `\n<h4>Speaker: ${event.Speaker}</h4>` : "";
const eventHtml = `
<div class="event">
<h3>Title: ${event.Title}</h3>${speakerInfo}
<p>Date: ${event.Date}</p>
<p>Location: ${event.Location}</p>
<p>${event.Synopsis}</p>
</div>
`;
eventsContainer.innerHTML += eventHtml;
});
});
});
});
</script>
</head>
<body>
<header>
<h1>Human-Centered AI Reading Group</h1>
<p>Bringing human factors to AI at Mila since 2024.</p>
</header>
<div id="container">
<section id="events">
<h2>Upcoming Events</h2>
<div class="lds-ellipsis"><div></div><div></div><div></div><div></div></div>
<!-- Add more events as needed -->
</section>
<section id="past_events">
<h2>Past Events</h2>
<div class="lds-ellipsis"><div></div><div></div><div></div><div></div></div>
<!-- Add more past events as needed -->
</section>
<section id="organizers">
<h2>Organizers</h2>
<ul>
<li><a href="https://avinashbhat.github.io/about" target="_blank">Avinash Bhat</a>, PhD student in Computer Science, McGill University</li>
<li><a href="https://www.cs.mcgill.ca/~jguo/" target="_blank">Jin L.C. Guo</a>, Associate Professor of Software Engineering, McGill University</li>
<li><a href="https://ianarawjo.com" target="_blank">Ian Arawjo</a>, Assistant Professor of Human-Computer Interaction, Université de Montréal</li>
</ul>
</section>
</div>
</body>
</html>