/** * Kanbante — Wallboard: slide rotation, clock, live refresh. * * The wall is a display, not a workspace: no interaction to protect, * so a realtime event simply reloads the page (plus a slow safety * reload in case the stream drops silently). */ (function () { var slides = Array.from(document.querySelectorAll('.wall-slide')); var ROTATE_MS = 30000; var current = 0; if (slides.length > 1) { setInterval(function () { slides[current].classList.remove('active'); current = (current + 1) % slides.length; slides[current].classList.add('active'); }, ROTATE_MS); } function tickClock() { var now = new Date(); var time = now.toLocaleTimeString('fr-CA', { hour: '2-digit', minute: '2-digit' }); var date = now.toLocaleDateString('fr-CA', { weekday: 'long', day: 'numeric', month: 'long', }); document.querySelectorAll('[data-clock]').forEach(function (el) { el.textContent = time; }); document.querySelectorAll('[data-date]').forEach(function (el) { el.textContent = date; }); } tickClock(); setInterval(tickClock, 15000); // Live: any board activity refreshes the wall. try { var source = new EventSource('/api/stream'); source.onmessage = function () { location.reload(); }; } catch (err) { console.warn('Wallboard live stream unavailable:', err); } // Safety net. setTimeout(function () { location.reload(); }, 5 * 60 * 1000); })();