(function () {
	"use strict";

	function pad(value) {
		return String(value).padStart(2, "0");
	}

	function updateClock() {
		var el = document.getElementById("clock");
		if (!el) {
			return;
		}
		var now = new Date();
		el.textContent =
			"Rendered client-side at " +
			pad(now.getHours()) +
			":" +
			pad(now.getMinutes()) +
			":" +
			pad(now.getSeconds());
	}

	function showOrigin() {
		var el = document.getElementById("origin");
		if (el) {
			el.textContent = window.location.host;
		}
	}

	document.addEventListener("DOMContentLoaded", function () {
		showOrigin();
		updateClock();
		setInterval(updateClock, 1000);
	});
})();
