This commit is contained in:
juanatsap
2025-11-15 15:59:54 +00:00
parent aeab81dd42
commit 1f7757c848
39 changed files with 3781 additions and 797 deletions
+43 -23
View File
@@ -8,7 +8,6 @@
-- PRINT FUNCTIONS
-- ==============================================================================
-- Print friendly - applies clean theme and short version for printing
def printFriendly()
-- Store current state
set container to the first .cv-container
@@ -18,7 +17,9 @@ def printFriendly()
set currentZoom to localStorage.getItem('cv-zoom') or '100'
-- Apply print-friendly settings
if wasClean is false then add .theme-clean to container end
if wasClean is false
add .theme-clean to container
end
remove .cv-long from paper
add .cv-short to paper
@@ -33,7 +34,9 @@ def printFriendly()
wait 100ms
-- Restore original theme
if wasClean is false then remove .theme-clean from container end
if wasClean is false
remove .theme-clean from container
end
-- Restore original length
if wasLong is true
@@ -52,14 +55,12 @@ end
-- SCROLL BEHAVIOR
-- ==============================================================================
-- Initialize scroll behavior state
def initScrollBehavior()
set :lastScroll to 0
set :scrollThreshold to 100
set :keepHeaderVisible to false
end
-- Handle scroll events
def handleScroll()
set currentScroll to window.pageYOffset
set menu to the first .navigation-menu
@@ -75,39 +76,58 @@ def handleScroll()
set :keepHeaderVisible to false
end
-- Header visibility based on scroll direction
if currentScroll > :scrollThreshold
if currentScroll > :lastScroll and :keepHeaderVisible is false
-- Scrolling down - hide header
add .header-hidden to .action-bar
if isMenuOpen is true then add .header-hidden to menu end
else
-- Scrolling up - show header
remove .header-hidden from .action-bar
if isMenuOpen is true then remove .header-hidden from menu end
-- Header visibility: Scrolling down past threshold
if currentScroll > :scrollThreshold and currentScroll > :lastScroll and :keepHeaderVisible is false
add .header-hidden to .action-bar
if isMenuOpen is true
add .header-hidden to menu
end
else
-- At top - always show header
remove .header-hidden from .action-bar
if isMenuOpen is true then remove .header-hidden from menu end
end
-- Back to top button visibility (show after 300px scroll)
-- Header visibility: Scrolling up past threshold
if currentScroll > :scrollThreshold and (currentScroll <= :lastScroll or :keepHeaderVisible is true)
remove .header-hidden from .action-bar
if isMenuOpen is true
remove .header-hidden from menu
end
end
-- Header visibility: At top
if currentScroll <= :scrollThreshold
remove .header-hidden from .action-bar
if isMenuOpen is true
remove .header-hidden from menu
end
end
-- Back to top button visibility
if currentScroll > 300
set #back-to-top's *display to 'flex'
else
end
if currentScroll <= 300
set #back-to-top's *display to 'none'
end
-- At-bottom positioning for fixed buttons
-- At-bottom class for fixed buttons
if isAtBottom
add .at-bottom to #back-to-top
add .at-bottom to #info-button
else
add .at-bottom to #shortcuts-button
end
if not isAtBottom
remove .at-bottom from #back-to-top
remove .at-bottom from #info-button
remove .at-bottom from #shortcuts-button
end
-- Update last scroll position
set :lastScroll to currentScroll
end
-- ==============================================================================
-- KEYBOARD SHORTCUTS
-- ==============================================================================
-- Note: Keyboard event handlers are now defined inline in the body tag
-- because hyperscript 0.9.12 doesn't support nested event handlers (on ... inside def)