ba44b435e7
Inline Hyperscript Refactoring: - Body tag keyboard handlers: 20→8 lines (using helper functions) - Zoom control handlers: 85→35 lines (using zoom._hs) - PDF modal card selection: 90→6 lines (3 identical blocks eliminated) New Hyperscript Files: - zoom._hs: handleZoomInput, handleZoomReset, initZoomControl - pdf-modal._hs: selectPdfCard, handlePdfCardKey JavaScript Elimination (232 lines removed): - cv-functions.js: REMOVED - hyperscript defs are globally available - scroll-at-bottom-handler.js: REMOVED - duplicate of handleScroll() - footer-buttons-interaction.js: REMOVED - moved to hyperscript Added Tests: - 32-hyperscript-multi-src.test.mjs: Verifies multi-file loading - 33-keyboard-shortcuts-refactored.test.mjs: Keyboard shortcuts - 34-hyperscript-refactor-comprehensive.test.mjs: Full test suite Key Findings: - No hyperscript multi-file bug in 0.9.14 - Hyperscript def statements are globally accessible - Previous refactoring failures were syntax errors, not library bugs
46 lines
1.4 KiB
Plaintext
46 lines
1.4 KiB
Plaintext
-- File: pdf-modal._hs
|
|
-- Purpose: PDF modal helper functions
|
|
-- Last Updated: 2025-11-30
|
|
|
|
-- ==============================================================================
|
|
-- PDF CARD SELECTION HANDLER
|
|
-- ==============================================================================
|
|
-- Handles selection of PDF format cards in the modal
|
|
-- Called from each card's click event
|
|
def selectPdfCard(card)
|
|
-- Get the modal container
|
|
set modal to document.getElementById('pdf-modal')
|
|
if modal is null then exit end
|
|
|
|
-- Remove selected from all cards
|
|
set cards to modal.querySelectorAll('.pdf-option-card')
|
|
for c in cards
|
|
remove .selected from c
|
|
set c's @aria-checked to 'false'
|
|
end
|
|
|
|
-- Add selected to this card
|
|
add .selected to card
|
|
set card's @aria-checked to 'true'
|
|
|
|
-- Enable download button
|
|
set downloadBtn to modal.querySelector('.pdf-download-btn')
|
|
if downloadBtn is not null
|
|
remove @disabled from downloadBtn
|
|
end
|
|
|
|
-- Store selected format for download
|
|
set window.selectedPdfFormat to card's @data-cv-format
|
|
end
|
|
|
|
-- ==============================================================================
|
|
-- PDF CARD KEYDOWN HANDLER
|
|
-- ==============================================================================
|
|
-- Handles keyboard navigation for PDF cards (Enter/Space to select)
|
|
def handlePdfCardKey(card, evt)
|
|
if evt.key is 'Enter' or evt.key is ' '
|
|
call evt.preventDefault()
|
|
call selectPdfCard(card)
|
|
end
|
|
end
|