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
|