1
0
Fork 0
mirror of https://github.com/Kunsi/pretalx-plugin-broadcast-tools synced 2024-11-21 19:31:02 +00:00

lower thirds: look up to five minutes into the future and into the past

This commit is contained in:
Franzi 2022-11-08 20:00:04 +01:00
parent 2b02350e29
commit 191ce772c5
Signed by: kunsi
GPG key ID: 12E3D2136B818350

View file

@ -7,8 +7,6 @@ $(function() {
});
function update_lower_third() {
current_time = new Date(Date.now()).getTime()
try {
hash = decodeURIComponent(window.location.hash.substring(1));
room_name = hash;
@ -43,19 +41,29 @@ function update_lower_third() {
current_talk = null;
for (talk_i in schedule['talks']) {
talk = schedule['talks'][talk_i]
for (let offset = 0; offset <= 5; offset++) {
time_start = new Date(Date.now() + offset*60000).getTime();
time_end = new Date(Date.now() - offset*60000).getTime();
if (schedule['rooms'].length > 1 && talk['room'] != room_name) {
// not in this room
continue;
for (talk_i in schedule['talks']) {
talk = schedule['talks'][talk_i]
if (schedule['rooms'].length > 1 && talk['room'] != room_name) {
// not in this room
continue;
}
talk_start = new Date(talk['start']).getTime();
talk_end = new Date(talk['end']).getTime();
if (talk_start < time_start && talk_end > time_end) {
current_talk = talk;
break;
}
}
talk_start = new Date(talk['start']).getTime();
talk_end = new Date(talk['end']).getTime();
if (talk_start < current_time && talk_end > current_time) {
current_talk = talk;
if (current_talk) {
break;
}
}