Dark grey background, name top left, date and clock top right, a flat panel with a blue top edge. The pages show the kiosk link (token masked) and the management address; the clock code is shared in kiosk.js. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
26 lines
1.0 KiB
JavaScript
26 lines
1.0 KiB
JavaScript
// Shared by the local kiosk pages: device name, clock/date, kiosk link and admin address.
|
|
const params = new URLSearchParams(location.search);
|
|
const fmtTime = new Intl.DateTimeFormat("nl-NL", { hour: "2-digit", minute: "2-digit" });
|
|
const fmtDate = new Intl.DateTimeFormat("nl-NL", { weekday: "long", day: "numeric", month: "long" });
|
|
|
|
function setText(id, text) {
|
|
const el = document.getElementById(id);
|
|
if (el) el.textContent = text;
|
|
}
|
|
|
|
setText("name", params.get("name") || "VoxIP Kiosk");
|
|
// The link arrives with its token already masked (…abcd).
|
|
const link = (params.get("url") || "").replace(/^https:\/\//, "");
|
|
if (link) setText("link-url", link);
|
|
else document.getElementById("link")?.setAttribute("hidden", "");
|
|
setText("admin", params.get("admin") ? "Beheer: " + params.get("admin") : "");
|
|
|
|
function tickClock() {
|
|
const now = new Date();
|
|
setText("clock", fmtTime.format(now));
|
|
const date = fmtDate.format(now);
|
|
setText("date", date.charAt(0).toUpperCase() + date.slice(1));
|
|
}
|
|
tickClock();
|
|
setInterval(tickClock, 1000);
|