mirror of
https://github.com/nextcloud/all-in-one.git
synced 2026-05-29 15:00:09 +00:00
46 lines
1.9 KiB
Twig
46 lines
1.9 KiB
Twig
<html lang="en">
|
|
<head>
|
|
<style>
|
|
button {
|
|
position: fixed;
|
|
top: 1rem;
|
|
right: 1rem;
|
|
font-size: 1.3rem;
|
|
}
|
|
</style>
|
|
<script>
|
|
document.addEventListener("DOMContentLoaded", () => {
|
|
// Give the browser a short moment to render all text and calculate the scrollHeight, to avoid
|
|
// problems with scrolling to the bottom.
|
|
setTimeout(() => window.scrollTo(0, document.body.scrollHeight), 100);
|
|
// Reload after a short while if the window is visible to the user.
|
|
const reloadTimer = setTimeout(() => {
|
|
if (document.visibilityState === 'visible') {
|
|
location.reload()
|
|
}
|
|
}, 5000);
|
|
// Provide a button that allows to disable the reloads.
|
|
const button = document.querySelector('button');
|
|
document.querySelector('button').addEventListener('click', (event) => {
|
|
event.preventDefault();
|
|
clearTimeout(reloadTimer);
|
|
button.disabled = true;
|
|
button.textContent = 'Reloading was disabled';
|
|
});
|
|
// Reload immediately if the window gets visible to the user again (unless the
|
|
// no-reload-button had been clicked).
|
|
document.addEventListener('visibilitychange', () => {
|
|
if (document.visibilityState === 'visible' && button.disabled !== true) {
|
|
location.reload();
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<button>Disable auto-reloading</button>
|
|
<pre>{{ logContent }}</pre>
|
|
<div id="bottom"></div>
|
|
</body>
|
|
</html>
|