From c7dd518626122b5e76e5a9bdfd208d06a425df6b Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 2 Nov 2023 23:02:50 -0400 Subject: [PATCH] index.html.in: set the MARC origin/destination when applicable --- index.html.in | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/index.html.in b/index.html.in index 96dd04a..1584284 100644 --- a/index.html.in +++ b/index.html.in @@ -55,7 +55,7 @@ url("data:font/woff2;base64,@CBPREGULAR@") format("woff2") } - #servicename, #tickettime, #ticketdate, #codetext, #zone { + #origindest, #servicename, #tickettime, #ticketdate, #codetext, #zone { font-family: "CharmBypass Regular", sans-serif; } @@ -701,6 +701,32 @@ } } + + /*****************************************************/ + /* Set the origin and destination for the MARC Train */ + /*****************************************************/ + + function set_marc_origin_destination() { + const params = new URLSearchParams(document.location.search); + if (!params.get("origin") || !params.get("destination")) { + return; + } + + const src = params.get("origin"); + const dest = params.get("destination"); + + /* origindest contains both the origin and destination */ + const origindest = document.getElementById("origindest"); + + const origin = document.getElementById("origin"); + const destination = document.getElementById("destination"); + + origin.textContent = params.get("origin"); + destination.textContent = params.get("destination"); + + origindest.style.display = "block"; /* It's hidden by default */ + } + /******************************************/ /* Display the ticket (and hide the menu) */ /******************************************/ @@ -756,6 +782,9 @@ /* Set the ticket expiration date/time upon page load */ window.addEventListener("load", set_ticket_expiry); + /* Set the MARC Train origin and destination, if applicable */ + window.addEventListener("load", set_marc_origin_destination); + /* Set the MARC Train zone, if applicable */ window.addEventListener("load", set_marc_zone); -- 2.44.2