Files
cv-site/static/hyperscript/pdf-modal._hs
T
juanatsap 3c49f8f7cf refactor: use idiomatic hyperscript selector syntax
Replace verbose document.getElementById() and document.querySelectorAll()
with cleaner hyperscript syntax:
- #id for ID selectors
- .class and the first .class for class selectors
- <selector/> query literals for complex selectors
- #{variable} for dynamic ID interpolation

Files changed:
- utils._hs: scrollHeight, details, footer buttons, scrollToSection
- zoom._hs: all zoom control element selectors (14 changes)
- pdf-modal._hs: modal selector
- keyboard._hs: dynamic toggle and modal selectors
- contact-modal.html: response div and modal close
- index.html: ninja-keys bar selector
2025-12-02 16:23:40 +00:00

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 #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