Files
cv-site/static/hyperscript/keyboard._hs
T

44 lines
1.6 KiB
Plaintext
Raw Normal View History

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