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
|
|
@ -31,7 +31,22 @@
|
|||
</style>
|
||||
|
||||
<script>
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
document.querySelectorAll("details[data-direction-id]").forEach(details => {
|
||||
details.addEventListener("toggle", () => {
|
||||
if (details.open) {
|
||||
// Delay scroll until DOM is expanded/rendered
|
||||
setTimeout(() => {
|
||||
const directionId = details.getAttribute("data-direction-id");
|
||||
const target = document.getElementById("next-col-" + directionId);
|
||||
if (target) {
|
||||
target.scrollIntoView({ behavior: "smooth", inline: "start", block: "nearest" });
|
||||
}
|
||||
}, 50); // Short delay to allow rendering
|
||||
}
|
||||
});
|
||||
});
|
||||
document.querySelectorAll(".train-direction-table").forEach((table) => {
|
||||
table.addEventListener("click", (e) => {
|
||||
const cell = e.target.closest("td, th");
|
||||
|
|
@ -74,7 +89,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||
</div>
|
||||
|
||||
{% for timetable in timetables %}
|
||||
<details style="margin-top: 15px;">
|
||||
<details style="margin-top: 15px;" data-direction-id="{{ timetable.direction.direction_id }}">
|
||||
<summary>
|
||||
<div style="display: inline-block;">
|
||||
<h3>{{ timetable.direction.direction | capitalize }} to</h3>
|
||||
|
|
@ -87,7 +102,17 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||
<tr>
|
||||
<th>Stop</th>
|
||||
{% for trip_id in timetable.trip_ids %}
|
||||
<th>{{ trip_id }}</th>
|
||||
{% if let Some(next_id_v) = timetable.next_id %}
|
||||
{% if next_id_v == trip_id %}
|
||||
<th class="next-col" id="next-col-{{ timetable.direction.direction_id }}">
|
||||
{% else %}
|
||||
<th>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<th>
|
||||
{% endif %}
|
||||
{{ trip_id }}
|
||||
</th>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue