From 78dacff90d5bbbce09a75a6808173b939392620b Mon Sep 17 00:00:00 2001 From: Florian Sorg Date: Sun, 27 Dec 2020 20:36:52 +0100 Subject: [PATCH] update bauchbinde --- static/bauchbinde/assets/script.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/static/bauchbinde/assets/script.js b/static/bauchbinde/assets/script.js index b814def..b91aeba 100644 --- a/static/bauchbinde/assets/script.js +++ b/static/bauchbinde/assets/script.js @@ -11,6 +11,7 @@ let time = null; let startDelay = 1000; let gracePeriod = 5; + let interval = null; async function getCurrentTalkByRoomName(roomName, offset) { if (!offset) { @@ -94,7 +95,10 @@ root.style.setProperty('--width', value); } if (key === 'gracePeriod') { - gracePeriod = parseInt(value, 10) + gracePeriod = parseInt(value, 10); + } + if (key === 'interval') { + interval = parseInt(value, 10); } } } @@ -283,10 +287,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 animate(); } + if (interval) { + setTimeout(cycle, interval * 1000); + } + } + + window.addEventListener('load', () => { + cycle(); }); })();