ctucx.git: trainsearch

web based trip-planner, fork of https://cyberchaos.dev/yuka/trainsearch

commit f0aaad39fb37153fb1dc141e668992ae86f5bad9
parent d2c37c93687bec76fd3d62bc81b42d715e91def5
Author: Katja (ctucx) <git@ctu.cx>
Date: Tue, 21 Jan 2025 22:49:39 +0100

departuresView: add back button if possible
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/departuresView.js b/src/departuresView.js
@@ -15,7 +15,7 @@ const departuresTemplate = (data, profile) => {
 	return html`
 		<div class="departures">
 			<header>
-				<a class="icon-back hidden"></a>
+				<a id="back" class="icon-back hidden" title="${t('back')}" @click=${() => history.back()}>${t('back')}</a>
 				<div class="content">
 					<h3>Departures from ${data.name}</h3>
 				</div>

@@ -74,4 +74,7 @@ export const departuresView = async (match, isUpdate) => {
 
 	render(departuresTemplate(data, profile), ElementById('content'));
 
+	if (history.length > 0) {
+		ElementById('back').classList.remove('hidden');
+	}
 };