terminal: disable auto scroll and reload on user interaction
This commit is contained in:
parent
160c006a28
commit
f290c45b9c
|
@ -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)
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
|
Loading…
Reference in New Issue