44116eba5a
- 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
36 lines
1.0 KiB
Plaintext
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
|
|
|