diff options
| author | Danilo M. <danix@danix.xyz> | 2026-04-10 11:29:00 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-04-10 11:29:00 +0200 |
| commit | c42150058196f5affad5c6c590e99dd2fc7321c3 (patch) | |
| tree | cb0a7ad297128a43d32111e403959491573b6ace /assets/js/progress-bar.js | |
| parent | d51e4ef7dcd8609cd008a803f9d51674ac3d3ed2 (diff) | |
| download | danixxyz-theme-c42150058196f5affad5c6c590e99dd2fc7321c3.tar.gz danixxyz-theme-c42150058196f5affad5c6c590e99dd2fc7321c3.zip | |
feat: complete Hugo theme implementation from mockups
Transform all production-ready mockup files into a fully functional Hugo theme
with all design patterns, components, and interactivity. Implements the complete
plan: token alignment, global shell, homepage, articles section, single article
views, photo gallery, static pages, and 404 page.
Changes:
- Phase 0: Token alignment (--color-* → --type-*, add spacing/z-index/timing scales)
- Phase 1a: Global shell (baseof.html, hamburger menu, theme toggle, matrix rain)
- Phase 1b: Homepage (hero layout, glitch/typing/scroll-reveal effects)
- Phase 1c: Articles section (timeline layout, filter system, featured cards)
- Phase 1d: Single article (meta bar, share sidebar, footer nav, progress bar)
- Phase 1e: Photo gallery (lightbox, grid layout, shortcode updates)
- Phase 1f: Static pages (about/contact page layout)
- Phase 1g: 404 page (standalone HTML, quote randomization, recent articles)
New files:
- 6 CSS components: hamburger, article-hero, share-sidebar, timeline, lightbox, 404
- 8 JS modules: hamburger, glitch, typing, scroll-reveal, share-sidebar, lightbox, 404, photo-utils
- 6 template partials: article-single, featured-card, photo-article, share-sidebar, static-page, timeline-item
- 1 layout: 404.html (standalone)
Updated:
- All CSS variables with comprehensive token system
- All JS modules integrated into main.js
- All shortcodes (gallery, gal-img) for lightbox compatibility
- All layout files (baseof, home, section, page) with new dispatching logic
Verified: Hugo build succeeds with 21 pages, no errors.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Diffstat (limited to 'assets/js/progress-bar.js')
| -rw-r--r-- | assets/js/progress-bar.js | 44 |
1 files changed, 13 insertions, 31 deletions
diff --git a/assets/js/progress-bar.js b/assets/js/progress-bar.js index bc8b70a..e171f4f 100644 --- a/assets/js/progress-bar.js +++ b/assets/js/progress-bar.js @@ -1,38 +1,20 @@ -// progress-bar.js +/** + * progress-bar.js + * Reading progress indicator for articles + */ + (function() { - const progressBar = document.querySelector('.reading-progress'); - if (!progressBar) return; + 'use strict'; - // Only enable on pages with substantial content - const mainContent = document.querySelector('main'); - if (!mainContent) return; + const progressBar = document.getElementById('progress-bar'); + if (!progressBar) return; - function updateProgress() { - // Calculate scroll percentage - const windowHeight = window.innerHeight; - const docHeight = document.documentElement.scrollHeight - windowHeight; + window.addEventListener('scroll', () => { + const windowHeight = document.documentElement.scrollHeight - window.innerHeight; const scrolled = window.scrollY; - const percent = docHeight > 0 ? (scrolled / docHeight) * 100 : 0; + const progress = windowHeight > 0 ? (scrolled / windowHeight) * 100 : 0; - progressBar.style.width = percent + '%'; - } - - // Mark body as scrollable if there's significant content - const contentHeight = mainContent.offsetHeight; - if (contentHeight > window.innerHeight * 1.5) { - document.body.classList.add('scrollable'); - } - - // Use requestAnimationFrame for smooth updates - let ticking = false; - window.addEventListener('scroll', function() { - if (!ticking) { - requestAnimationFrame(updateProgress); - ticking = true; - setTimeout(() => { ticking = false; }, 100); - } + progressBar.style.width = progress + '%'; + progressBar.setAttribute('aria-valuenow', Math.round(progress)); }, { passive: true }); - - // Initial update - updateProgress(); })(); |
