1
0
Fork 0
mirror of https://github.com/Kunsi/pretalx-plugin-broadcast-tools synced 2024-11-22 01: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() { function update_lower_third() {
current_time = new Date(Date.now()).getTime()
try { try {
hash = decodeURIComponent(window.location.hash.substring(1)); hash = decodeURIComponent(window.location.hash.substring(1));
room_name = hash; room_name = hash;
@ -43,6 +41,10 @@ function update_lower_third() {
current_talk = null; current_talk = null;
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();
for (talk_i in schedule['talks']) { for (talk_i in schedule['talks']) {
talk = schedule['talks'][talk_i] talk = schedule['talks'][talk_i]
@ -54,8 +56,14 @@ function update_lower_third() {
talk_start = new Date(talk['start']).getTime(); talk_start = new Date(talk['start']).getTime();
talk_end = new Date(talk['end']).getTime(); talk_end = new Date(talk['end']).getTime();
if (talk_start < current_time && talk_end > current_time) { if (talk_start < time_start && talk_end > time_end) {
current_talk = talk; current_talk = talk;
break;
}
}
if (current_talk) {
break;
} }
} }