add load time and autofocus
Some checks failed
Create and publish a Docker image / build-and-push-image (push) Failing after 10m5s
Some checks failed
Create and publish a Docker image / build-and-push-image (push) Failing after 10m5s
This commit is contained in:
parent
917428507d
commit
5539c8521d
10 changed files with 153 additions and 11 deletions
|
|
@ -18,6 +18,17 @@
|
|||
<link rel="icon" type="image/x-icon" href="/assets/favicon.ico">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
</head>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
setTimeout(() => {
|
||||
const perfData = window.performance.timing;
|
||||
const pageLoadTime = perfData.loadEventEnd - perfData.navigationStart;
|
||||
|
||||
const loadTimeElement = document.getElementById('js_load_time');
|
||||
loadTimeElement.textContent += ` ${pageLoadTime}ms`;
|
||||
}, 0); // Minimal delay to wait for `loadEventEnd` to be populated
|
||||
};
|
||||
</script>
|
||||
<noscript>
|
||||
<style>
|
||||
.js-only {
|
||||
|
|
@ -67,6 +78,7 @@
|
|||
{% if let Some(load_time) = load_time_ms %}
|
||||
<p style="marin-top: 5px; color: #555555;"><small><i>Data loaded in {{ *load_time | format_load_time }}</i></small></p>
|
||||
{% endif %}
|
||||
<p class="js-only" style="marin-top: 5px; color: #555555;"><small><i id="js_load_time">Total load time</i></small></p>
|
||||
</div>
|
||||
<div>
|
||||
{% if widescreen %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue