-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevent.html
72 lines (66 loc) · 2.62 KB
/
event.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Event Details</title>
<style>
body {
font-size: 80px;
}
.event-title, .talk-title {
font-family: 'Cantarell', sans-serif;
font-weight: bold;
color: #a30000;
}
.speaker {
font-family: 'Roboto', sans-serif;
font-weight: bold;
color: #ffffff;
}
</style>
</head>
<body>
<div id="event-details">
<div class="event-title" id="event-title">Loading event...</div>
</div>
<script>
function fetchEventData() {
fetch('event.json')
.then(response => response.json())
.then(data => {
document.getElementById('event-title').innerText = data.event;
const eventDetails = document.getElementById('event-details');
// Clear existing talk details
eventDetails.querySelectorAll('.talk-title, .speaker').forEach(element => element.remove());
data.talks.forEach((talk, index) => {
const talkTitle = document.createElement('div');
talkTitle.className = 'talk-title';
talkTitle.id = `talk${index + 1}-title`;
talkTitle.innerText = talk.title;
eventDetails.appendChild(talkTitle);
const speaker = document.createElement('div');
speaker.className = 'speaker';
speaker.id = `talk${index + 1}-speaker`;
speaker.innerText = talk.speaker;
eventDetails.appendChild(speaker);
});
// Check URL fragment and display only the relevant section
const fragment = window.location.hash.substring(1);
if (fragment) {
document.querySelectorAll('#event-details > div').forEach(element => {
if (element.id !== fragment) {
element.style.display = 'none';
}
});
}
})
.catch(error => console.error('Error fetching the JSON:', error));
}
// Fetch event data initially
fetchEventData();
// Refresh event data every 10 seconds
setInterval(fetchEventData, 10000);
</script>
</body>
</html>