diff --git a/shiftregister/signage/templates/terminal.html b/shiftregister/signage/templates/terminal.html index 3ca225b..66bf8b0 100644 --- a/shiftregister/signage/templates/terminal.html +++ b/shiftregister/signage/templates/terminal.html @@ -33,6 +33,10 @@ const max = document.body.scrollHeight - window.innerHeight; let current = 0; let interval; + let interacted = false; + + window.addEventListener('click', () => interacted = true); + window.addEventListener('touchstart', () => interacted = true); setTimeout(() => { window.scrollTo({top: 0}); @@ -40,12 +44,15 @@ if (max > 0) { setTimeout(() => { + if (interacted) return; interval = setInterval(() => { + if (interacted) return; current += 1; window.scrollTo({top: current}); if (window.scrollY >= max) { + if (interacted) return; clearInterval(interval); setTimeout(() => { window.location.reload(); @@ -55,7 +62,10 @@ }, 5000) } - setTimeout(window.location.reload, 120 * 1000) + setTimeout(() => { + if (interacted) return; + window.location.reload(); + }, 120 * 1000) });