Files
cv-site/static/hyperscript/pdf-modal._hs
T
juanatsap 44116eba5a refactor: use hyperscript event filtering and destructuring
- Use event filtering [key is 'Enter' or key is ' '] on PDF modal cards
- Remove handlePdfCardKey helper function (now inline)
- Use event destructuring on keydown(key, target, ctrlKey, metaKey, altKey)
- Cleaner, more idiomatic hyperscript patterns
2025-12-02 17:55:45 +00:00

36 lines
1.0 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 #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