* than the trees */
animation: citycopyscroll 20s linear infinite;
}
+
+ /*****************/
+ /* QR code focus */
+ /*****************/
+
+ #serviceid, #servicename, #codebg, #codetext {
+ transition-property: opacity;
+ transition-duration: 0.5s;
+ }
+ .transparent {
+ opacity: 0;
+ }
</style>
</head>
}
}
+ /**
+ * Focus or un-focus the QR code.
+ *
+ * The QR code grows to (almost) the full size of the ticket
+ * when it is tapped. In the process, the other ticket elements
+ * on the bottom portion quickly fade away, and the QR code
+ * slides over near the center of the ticket. The height of the
+ * ticket itself also grows somewhat, at least on BaltimoreLink
+ * tickets. When the QR code is tapped again, this process
+ * reverses.
+ */
+ function toggle_qr_focus(event) {
+ /* Don't swap night/day if the tap was on the QR code. */
+ event.stopPropagation();
+
+ const qr = document.getElementById("qr");
+ const serviceid = document.getElementById("serviceid");
+ const servicename = document.getElementById("servicename");
+ const codetext = document.getElementById("codetext");
+ const codebg = document.getElementById("codebg");
+
+ let ticket_class; /* transparent, or none (opaque) */
+ let qr_class; /* big, or none (normal sized) */
+
+ if (qr.getAttribute("class") == "big") {
+ ticket_class = "";
+ qr_class = "";
+ }
+ else {
+ ticket_class = "transparent";
+ qr_class = "big";
+ }
+
+ serviceid.setAttribute("class", ticket_class);
+ servicename.setAttribute("class", ticket_class);
+ codetext.setAttribute("class", ticket_class);
+ codebg.setAttribute("class", ticket_class);
+
+ qr.setAttribute("class", qr_class);
+ }
+
/**
* Compute the zone (string) for the given origin/destination pair.
/* Swap colors when the screen is tapped */
document.body.addEventListener("click", swap_day_night);
+
+ /* Focus (grow) or unfocus (ungrow) the QR code */
+ document.getElementById("qr").addEventListener("click",
+ toggle_qr_focus);
}
else {
/* If we haven't submitted the form yet, set up change handlers