Merge branch 'main' of https://git.luj0ga.de/franconian/www.franconian.net into main
continuous-integration/drone/push Build is passing Details

This commit is contained in:
spezi 2020-12-27 23:57:41 +01:00
commit ef437880dc
2 changed files with 25 additions and 9 deletions

View File

@ -6,11 +6,12 @@
let headline = null;
let speaker = null;
let isIntro = false;
let holdDuration = 4000;
let holdDuration = 10;
let room = null;
let time = null;
let startDelay = 1000;
let gracePeriod = 5;
let startDelay = 1;
let gracePeriod = 360;
let interval = null;
async function getCurrentTalkByRoomName(roomName, offset) {
if (!offset) {
@ -21,7 +22,7 @@
now = Date.parse(time) + offset;
}
if (!data) {
if (!offset || !data) {
const response = await fetch(scheduleUrl);
data = await response.json();
}
@ -90,17 +91,23 @@
if (key === 'bottom') {
root.style.setProperty('--bottom', value);
}
if (key === 'top') {
root.style.setProperty('--top', value);
}
if (key === 'width') {
root.style.setProperty('--width', value);
}
if (key === 'gracePeriod') {
gracePeriod = parseInt(value, 10)
gracePeriod = parseInt(value, 10);
}
if (key === 'interval') {
interval = parseInt(value, 10);
}
}
}
if (room) {
let offset = gracePeriod * 60 * 1000;
let offset = gracePeriod * 1000;
let talk = await getCurrentTalkByRoomName(room);
if (!talk) {
talk = await getCurrentTalkByRoomName(room, -offset);
@ -191,7 +198,7 @@
fadeInText(),
]);
}
await new Promise(r => setTimeout(r, holdDuration));
await new Promise(r => setTimeout(r, holdDuration * 1000));
await Promise.all([
fadeOut(),
fadeOutText(),
@ -283,10 +290,17 @@
await new Promise(r => setTimeout(r, 1000));
}
window.addEventListener('load', async () => {
async function cycle() {
if (await init()) {
await new Promise(r => setTimeout(r, startDelay));
await new Promise(r => setTimeout(r, startDelay * 1000));
await animate();
}
if (interval) {
setTimeout(cycle, interval * 1000);
}
}
window.addEventListener('load', () => {
cycle();
});
})();

View File

@ -11,6 +11,7 @@
--bottom: 9vw;
--left: 12.5vw;
--width: 67.5vw;
--top: auto;
}
:root.theme-main {
@ -45,6 +46,7 @@ body {
bottom: var(--bottom);
left: var(--left);
width: var(--width);
top: var(--top);
}
.background {