feat: initial release of pengzhan.dev personal editorial blog platform
- Editorial web platform built with Node.js, Express, EJS, and Vanilla CSS - Markdown content engine with YAML frontmatter, bilingual variants, and hot-reload watcher - Unified SQLite with FTS5 search indexing, query logging, and schema filters - Centered editorial post layout with margin-docked left TOC and mobile bottom sheet - WordPress-grade comment system with moderation dashboard and bulk operations under /guanli - Complete SEO suite (JSON-LD structured data, RSS/Atom feeds, XML sitemap, robots.txt) - CI/CD workflows for linting, security audits (Gitleaks), automated tests, and Docker releases
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* Mobile Navigation Drawer Controller
|
||||
*/
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const toggleBtn = document.getElementById('mobile-menu-toggle');
|
||||
const drawer = document.getElementById('mobile-nav-drawer');
|
||||
|
||||
if (toggleBtn && drawer) {
|
||||
toggleBtn.addEventListener('click', () => {
|
||||
const isOpen = drawer.classList.contains('is-open');
|
||||
if (isOpen) {
|
||||
drawer.classList.remove('is-open');
|
||||
toggleBtn.classList.remove('is-active');
|
||||
toggleBtn.setAttribute('aria-expanded', 'false');
|
||||
} else {
|
||||
drawer.classList.add('is-open');
|
||||
toggleBtn.classList.add('is-active');
|
||||
toggleBtn.setAttribute('aria-expanded', 'true');
|
||||
}
|
||||
});
|
||||
|
||||
// Close on navigation link click
|
||||
drawer.querySelectorAll('.mobile-nav-link').forEach(link => {
|
||||
link.addEventListener('click', () => {
|
||||
drawer.classList.remove('is-open');
|
||||
toggleBtn.classList.remove('is-active');
|
||||
toggleBtn.setAttribute('aria-expanded', 'false');
|
||||
});
|
||||
});
|
||||
|
||||
// Close when clicking outside
|
||||
document.addEventListener('click', (e) => {
|
||||
if (drawer.classList.contains('is-open') && !drawer.contains(e.target) && !toggleBtn.contains(e.target)) {
|
||||
drawer.classList.remove('is-open');
|
||||
toggleBtn.classList.remove('is-active');
|
||||
toggleBtn.setAttribute('aria-expanded', 'false');
|
||||
}
|
||||
});
|
||||
|
||||
// Close on Escape key
|
||||
document.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Escape' && drawer.classList.contains('is-open')) {
|
||||
drawer.classList.remove('is-open');
|
||||
toggleBtn.classList.remove('is-active');
|
||||
toggleBtn.setAttribute('aria-expanded', 'false');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user