3c49f8f7cf
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
44 lines
1.6 KiB
Plaintext
44 lines
1.6 KiB
Plaintext
-- File: keyboard._hs
|
|
-- Purpose: Keyboard shortcut handlers for CV application
|
|
-- Last Updated: 2025-11-30
|
|
|
|
-- ==============================================================================
|
|
-- TOGGLE SHORTCUT HELPER
|
|
-- ==============================================================================
|
|
-- Helper function to toggle a checkbox by ID (tries primary ID, then menu ID)
|
|
-- Called from inline keyboard handler in body tag
|
|
def handleToggleShortcut(toggleId, menuToggleId)
|
|
set toggle to #{toggleId}
|
|
if toggle is null
|
|
set toggle to #{menuToggleId}
|
|
end
|
|
if toggle is not null
|
|
set toggle.checked to (not toggle.checked)
|
|
send change to toggle
|
|
end
|
|
end
|
|
|
|
-- ==============================================================================
|
|
-- MODAL SHORTCUT HELPER
|
|
-- ==============================================================================
|
|
-- Helper function to open a modal dialog by ID
|
|
def openModalShortcut(modalId)
|
|
set modal to #{modalId}
|
|
if modal is not null
|
|
call modal.showModal()
|
|
end
|
|
end
|
|
|
|
-- ==============================================================================
|
|
-- REFERENCE: Full keyboard handler logic
|
|
-- ==============================================================================
|
|
-- NOTE: The actual keydown handler MUST stay inline in body tag because
|
|
-- hyperscript event handlers need direct access to the event context.
|
|
-- The inline handler uses the helper functions above.
|
|
--
|
|
-- Keyboard shortcuts:
|
|
-- '?' - Open shortcuts modal
|
|
-- 'L' - Toggle CV length (short/long)
|
|
-- 'I' - Toggle icons visibility
|
|
-- 'V' - Toggle visual theme (default/clean)
|