diff options
| author | sillylaird <sillylaird@fastmail.ca> | 2026-02-03 21:27:57 -0500 |
|---|---|---|
| committer | sillylaird <sillylaird@fastmail.ca> | 2026-02-03 21:27:57 -0500 |
| commit | 720d752748b793a2f5cf3cc14cb75ad86e8919c0 (patch) | |
| tree | 29120103307cb17e7d6c283cc198ec2484f934cd /main.js | |
First commit
Diffstat (limited to 'main.js')
| -rw-r--r-- | main.js | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -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 |
