summaryrefslogtreecommitdiff
path: root/main.js
diff options
context:
space:
mode:
authorsillylaird <sillylaird@fastmail.ca>2026-02-03 21:27:57 -0500
committersillylaird <sillylaird@fastmail.ca>2026-02-03 21:27:57 -0500
commit720d752748b793a2f5cf3cc14cb75ad86e8919c0 (patch)
tree29120103307cb17e7d6c283cc198ec2484f934cd /main.js
First commit
Diffstat (limited to 'main.js')
-rw-r--r--main.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/main.js b/main.js
new file mode 100644
index 0000000..7a12254
--- /dev/null
+++ b/main.js
@@ -0,0 +1,30 @@
+document.addEventListener('DOMContentLoaded', () => {
+ /**
+ * Updates the 'last modified' timestamp on the page.
+ * Looks for an element with the ID 'lastmod'.
+ */
+ const lastModElement = document.getElementById('lastmod');
+ if (lastModElement) {
+ // Use a standard YYYY-MM-DD format for the date.
+ const lastModifiedDate = new Date(document.lastModified);
+ lastModElement.textContent = lastModifiedDate.toISOString().split('T')[0];
+ }
+
+ /**
+ * Handles the mobile sidebar toggle functionality.
+ * Looks for a button with ID 'menu-toggle' and a sidebar with ID 'mobile-sidebar'.
+ */
+ const menuToggleButton = document.getElementById('menu-toggle');
+ const mobileSidebar = document.getElementById('mobile-sidebar');
+
+ if (menuToggleButton && mobileSidebar) {
+ const closedText = menuToggleButton.textContent;
+ const openText = menuToggleButton.dataset.openText || 'Hide menu'; // Fallback text
+
+ menuToggleButton.addEventListener('click', () => {
+ const isExpanded = mobileSidebar.classList.toggle('visible');
+ menuToggleButton.setAttribute('aria-expanded', String(isExpanded));
+ menuToggleButton.textContent = isExpanded ? openText : closedText;
+ });
+ }
+}); \ No newline at end of file