diff --git a/assets/diary/diary-calendar.html b/assets/diary/diary-calendar.html
new file mode 100644
index 0000000..7a1cd41
--- /dev/null
+++ b/assets/diary/diary-calendar.html
@@ -0,0 +1,28 @@
+
+
+
+
+
+ | Mo | Di | Mi | Do | Fr | Sa | So |
+
+
+ {{range .Weeks}}{{range .}}| {{if .Num}}{{.Num}}{{end}} | {{end}}
+ {{end}}
+
+
+
diff --git a/assets/diary/diary-calendar.js b/assets/diary/diary-calendar.js
new file mode 100644
index 0000000..075e3d6
--- /dev/null
+++ b/assets/diary/diary-calendar.js
@@ -0,0 +1,60 @@
+(function () {
+ var cal = document.querySelector(".diary-cal");
+ if (!cal) return;
+
+ var toggle = document.createElement("button");
+ toggle.type = "button";
+ toggle.className = "diary-cal-toggle";
+ toggle.textContent = "Kalender";
+ toggle.setAttribute("aria-expanded", "false");
+ toggle.addEventListener("click", function () {
+ var open = cal.classList.toggle("is-open");
+ toggle.setAttribute("aria-expanded", open ? "true" : "false");
+ });
+
+ var main = document.querySelector("main");
+ if (main) {
+ main.parentNode.insertBefore(toggle, main);
+ main.parentNode.insertBefore(cal, main);
+ }
+
+ // Wire up month/year dropdowns inside the calendar.
+ var drops = cal.querySelectorAll(".diary-cal-drop");
+ drops.forEach(function (drop) {
+ var trigger = drop.querySelector("button");
+ var menu = drop.querySelector(".dropdown-menu");
+ if (!trigger || !menu) return;
+ trigger.addEventListener("click", function (e) {
+ e.stopPropagation();
+ drops.forEach(function (other) {
+ if (other !== drop) {
+ other.querySelector(".dropdown-menu").classList.remove("is-open");
+ }
+ });
+ menu.classList.toggle("is-open");
+ });
+ });
+ document.addEventListener("click", function (e) {
+ drops.forEach(function (drop) {
+ if (!drop.contains(e.target)) {
+ drop.querySelector(".dropdown-menu").classList.remove("is-open");
+ }
+ });
+ });
+ document.addEventListener("keydown", function (e) {
+ if (e.key !== "Escape") return;
+ drops.forEach(function (drop) {
+ drop.querySelector(".dropdown-menu").classList.remove("is-open");
+ });
+ });
+
+ var pageHeader = document.querySelector("header");
+ function updateTop() {
+ if (!pageHeader || getComputedStyle(cal).position !== "fixed") return;
+ var rect = pageHeader.getBoundingClientRect();
+ cal.style.top = Math.max(8, rect.bottom + 8) + "px";
+ }
+ window.addEventListener("scroll", updateTop, { passive: true });
+ window.addEventListener("resize", updateTop);
+ updateTop();
+})();
diff --git a/assets/page.html b/assets/page.html
index 7520d54..5ee64b1 100644
--- a/assets/page.html
+++ b/assets/page.html
@@ -99,5 +99,9 @@
{{end}}
{{end}}
+ {{if .DiaryWidget}}
+ {{.DiaryWidget}}
+
+ {{end}}