2021-12-23 21:40:48 +01:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
2021-12-23 21:53:57 +01:00
|
|
|
<meta charset="utf-8">
|
|
|
|
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
|
|
|
<title>
|
|
|
|
Infobeamer
|
|
|
|
</title>
|
2021-12-23 23:13:01 +01:00
|
|
|
<link rel="stylesheet" href="/style.css">
|
|
|
|
<script>
|
2021-12-23 21:40:48 +01:00
|
|
|
main().then(() => console.log("loaded"));
|
|
|
|
|
2021-12-23 23:13:01 +01:00
|
|
|
function parseDuration(duration) {
|
|
|
|
if (!/^\d+:\d+$/.test(duration)) {
|
2021-12-23 21:40:48 +01:00
|
|
|
return 0;
|
|
|
|
}
|
2021-12-23 23:13:01 +01:00
|
|
|
|
2021-12-23 21:40:48 +01:00
|
|
|
const [hours, minutes] = duration.split(":");
|
|
|
|
return (hours * 60 * 60 + minutes * 60) * 1000;
|
|
|
|
}
|
|
|
|
|
2021-12-23 23:13:01 +01:00
|
|
|
function sanitize(unsafe) {
|
|
|
|
const element = document.createElement("div");
|
|
|
|
element.innerHTML = unsafe;
|
|
|
|
return element.innerText;
|
|
|
|
}
|
|
|
|
|
2021-12-23 21:40:48 +01:00
|
|
|
function render(talk) {
|
2021-12-23 21:53:57 +01:00
|
|
|
// const now = new Date();
|
2021-12-23 23:13:01 +01:00
|
|
|
const now = Date.parse("2021-12-27T11:35:00+01:00");
|
2021-12-23 21:40:48 +01:00
|
|
|
const max = talk.end - talk.start;
|
2021-12-23 23:13:01 +01:00
|
|
|
|
|
|
|
let value = 0;
|
2021-12-23 21:40:48 +01:00
|
|
|
if (talk.start < now && talk.end > now) {
|
|
|
|
value = talk.end - now;
|
|
|
|
value = max - value
|
2021-12-23 23:13:01 +01:00
|
|
|
} else if (talk.end < now) {
|
2021-12-23 21:40:48 +01:00
|
|
|
value = max;
|
|
|
|
}
|
|
|
|
|
|
|
|
return `
|
|
|
|
<li class="box">
|
2021-12-23 23:13:01 +01:00
|
|
|
<h2 class="box-header">${sanitize(talk.title)}</h2>
|
2021-12-23 21:40:48 +01:00
|
|
|
<div class="box-content">
|
|
|
|
<p class="date">
|
2021-12-23 23:13:01 +01:00
|
|
|
Speakers: ${sanitize(talk.persons.join(", ") || "---")}<br>
|
|
|
|
Stage: ${sanitize(talk.room)}<br>
|
|
|
|
Time: ${sanitize(talk.start_string)}<br>
|
|
|
|
Duration: ${sanitize(talk.duration)}<br>
|
2021-12-23 21:40:48 +01:00
|
|
|
</p>
|
2021-12-23 23:13:01 +01:00
|
|
|
<p>${sanitize(talk.abstract)}</p>
|
2021-12-23 21:40:48 +01:00
|
|
|
<progress max="${max}" value="${value}">
|
|
|
|
</div>
|
|
|
|
</li>`;
|
|
|
|
}
|
|
|
|
|
|
|
|
async function main() {
|
|
|
|
const resp = await fetch("https://static.rc3.world/schedule/everything.json");
|
|
|
|
const schedule = await resp.json();
|
|
|
|
|
|
|
|
const now = new Date();
|
|
|
|
|
2021-12-23 23:13:01 +01:00
|
|
|
const upcoming = [];
|
2021-12-23 21:40:48 +01:00
|
|
|
for (const day of schedule.schedule.conference.days) {
|
|
|
|
for (const [channel, talks] of Object.entries(day.rooms)) {
|
|
|
|
for (const talk of talks) {
|
2021-12-23 23:13:01 +01:00
|
|
|
const talk_end = Date.parse(talk.date) + parseDuration(talk.duration);
|
2021-12-23 21:40:48 +01:00
|
|
|
if (talk_end > now) {
|
2021-12-23 23:13:01 +01:00
|
|
|
const parsed = {
|
2021-12-23 21:40:48 +01:00
|
|
|
start: Date.parse(talk.date),
|
|
|
|
date_string: talk.date,
|
|
|
|
end: talk_end,
|
|
|
|
start_string: talk.start,
|
|
|
|
duration: talk.duration,
|
|
|
|
room: talk.room,
|
|
|
|
title: talk.title,
|
|
|
|
abstract: talk.abstract,
|
|
|
|
persons: talk.persons.map(person => person.public_name),
|
|
|
|
};
|
|
|
|
upcoming.push(parsed);
|
|
|
|
break;
|
|
|
|
}
|
2021-12-23 23:13:01 +01:00
|
|
|
}
|
2021-12-23 21:40:48 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-23 23:13:01 +01:00
|
|
|
let content = "";
|
2021-12-23 21:40:48 +01:00
|
|
|
upcoming.sort((a, b) => a.end - b.end);
|
2021-12-23 23:13:01 +01:00
|
|
|
for (const talk of upcoming.slice(0, 6)) {
|
2021-12-23 21:40:48 +01:00
|
|
|
content += render(talk);
|
|
|
|
}
|
|
|
|
|
|
|
|
document.getElementById("list").innerHTML = content;
|
|
|
|
const hours = `${now.getHours()}`.padStart(2, '0');
|
|
|
|
const minutes = `${now.getMinutes()}`.padStart(2, '0');
|
2021-12-23 23:13:01 +01:00
|
|
|
document.getElementById("time").innerText = `${hours}:${minutes}`;
|
|
|
|
|
|
|
|
setTimeout(main, (60-new Date().getSeconds())*1000+500);
|
2021-12-23 21:40:48 +01:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
2021-12-23 21:53:57 +01:00
|
|
|
<header>
|
|
|
|
<nav class="nav nav-main">
|
|
|
|
<a class="nav-logo" href="/">
|
2021-12-23 23:13:01 +01:00
|
|
|
<img src="/franconianNet.svg"
|
|
|
|
alt="Logo of franconian.net">
|
|
|
|
franconian.net
|
|
|
|
</a>
|
|
|
|
<a class="nav-link" id="time"></a>
|
2021-12-23 21:53:57 +01:00
|
|
|
</nav>
|
|
|
|
</header>
|
2021-12-23 21:40:48 +01:00
|
|
|
<main>
|
|
|
|
<h1>running / upcoming</h1>
|
|
|
|
<ul class="box-grid" id="list">
|
2021-12-23 21:53:57 +01:00
|
|
|
</ul>
|
2021-12-23 21:40:48 +01:00
|
|
|
</main>
|
|
|
|
</body>
|
|
|
|
</html>
|