2021-11-20 08:05:08 +00:00
|
|
|
schedule = null;
|
2021-11-22 09:14:25 +00:00
|
|
|
event_info = null;
|
2021-11-20 08:05:08 +00:00
|
|
|
|
2023-02-28 10:17:14 +00:00
|
|
|
function get_current_talk(max_offset) {
|
2023-02-28 08:51:07 +00:00
|
|
|
room_name = get_room_name();
|
2021-11-20 08:05:08 +00:00
|
|
|
|
2023-02-28 08:51:07 +00:00
|
|
|
if (!room_name) {
|
|
|
|
return null;
|
2021-11-20 08:05:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
current_talk = null;
|
|
|
|
|
2023-02-28 10:17:14 +00:00
|
|
|
for (let offset = 0; offset <= max_offset; offset++) {
|
2022-11-08 19:00:04 +00:00
|
|
|
time_start = new Date(Date.now() + offset*60000).getTime();
|
|
|
|
time_end = new Date(Date.now() - offset*60000).getTime();
|
2021-11-20 08:05:08 +00:00
|
|
|
|
2022-11-08 19:00:04 +00:00
|
|
|
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;
|
|
|
|
}
|
2021-11-20 08:05:08 +00:00
|
|
|
|
2022-11-08 19:00:04 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
2021-11-20 08:05:08 +00:00
|
|
|
|
2022-11-08 19:00:04 +00:00
|
|
|
if (current_talk) {
|
|
|
|
break;
|
2021-11-20 08:05:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-02-28 08:51:07 +00:00
|
|
|
return current_talk;
|
|
|
|
}
|
2021-11-20 08:22:16 +00:00
|
|
|
|
2023-02-28 08:51:07 +00:00
|
|
|
function get_room_name() {
|
|
|
|
room_name = null;
|
|
|
|
try {
|
|
|
|
hash = decodeURIComponent(window.location.hash.substring(1));
|
|
|
|
room_name = hash;
|
|
|
|
} catch (e) {
|
|
|
|
console.error(e);
|
2021-11-20 08:05:08 +00:00
|
|
|
}
|
2023-02-28 08:51:07 +00:00
|
|
|
return room_name;
|
2021-11-20 08:05:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function update_schedule() {
|
2021-11-22 11:09:01 +00:00
|
|
|
$.getJSON('../event.json', function(data) {
|
2021-11-22 09:14:25 +00:00
|
|
|
event_info = data;
|
|
|
|
});
|
2021-11-22 11:09:01 +00:00
|
|
|
$.getJSON('../schedule.json', function(data) {
|
2022-11-08 18:43:17 +00:00
|
|
|
if ('error' in data) {
|
|
|
|
console.error(data['error']);
|
|
|
|
} else {
|
|
|
|
console.info('schedule updated with ' + data['talks'].length + ' talks in ' + data['rooms'].length + ' rooms');
|
|
|
|
}
|
2021-11-20 08:05:08 +00:00
|
|
|
|
|
|
|
schedule = data;
|
|
|
|
|
|
|
|
window.setTimeout(update_schedule, 30000);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
update_schedule();
|