2025-11-20 09:17:09 +00:00
|
|
|
-- File: keyboard._hs
|
|
|
|
|
-- Purpose: Keyboard shortcut handlers for CV application
|
2025-11-30 05:58:44 +00:00
|
|
|
-- Last Updated: 2025-11-30
|
2025-11-20 09:17:09 +00:00
|
|
|
|
2025-11-30 05:58:44 +00:00
|
|
|
-- ==============================================================================
|
|
|
|
|
-- 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 document.getElementById(toggleId)
|
|
|
|
|
if toggle is null
|
|
|
|
|
set toggle to document.getElementById(menuToggleId)
|
2025-11-20 09:17:09 +00:00
|
|
|
end
|
2025-11-30 05:58:44 +00:00
|
|
|
if toggle is not null
|
|
|
|
|
set toggle.checked to (not toggle.checked)
|
|
|
|
|
send change to toggle
|
2025-11-20 09:17:09 +00:00
|
|
|
end
|
2025-11-30 05:58:44 +00:00
|
|
|
end
|
2025-11-20 09:17:09 +00:00
|
|
|
|
2025-11-30 05:58:44 +00:00
|
|
|
-- ==============================================================================
|
|
|
|
|
-- MODAL SHORTCUT HELPER
|
|
|
|
|
-- ==============================================================================
|
|
|
|
|
-- Helper function to open a modal dialog by ID
|
|
|
|
|
def openModalShortcut(modalId)
|
|
|
|
|
set modal to document.getElementById(modalId)
|
|
|
|
|
if modal is not null
|
|
|
|
|
call modal.showModal()
|
2025-11-20 09:17:09 +00:00
|
|
|
end
|
|
|
|
|
end
|
2025-11-30 05:58:44 +00:00
|
|
|
|
|
|
|
|
-- ==============================================================================
|
|
|
|
|
-- 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)
|