refactor: Major hyperscript refactoring and JS elimination
Inline Hyperscript Refactoring: - Body tag keyboard handlers: 20→8 lines (using helper functions) - Zoom control handlers: 85→35 lines (using zoom._hs) - PDF modal card selection: 90→6 lines (3 identical blocks eliminated) New Hyperscript Files: - zoom._hs: handleZoomInput, handleZoomReset, initZoomControl - pdf-modal._hs: selectPdfCard, handlePdfCardKey JavaScript Elimination (232 lines removed): - cv-functions.js: REMOVED - hyperscript defs are globally available - scroll-at-bottom-handler.js: REMOVED - duplicate of handleScroll() - footer-buttons-interaction.js: REMOVED - moved to hyperscript Added Tests: - 32-hyperscript-multi-src.test.mjs: Verifies multi-file loading - 33-keyboard-shortcuts-refactored.test.mjs: Keyboard shortcuts - 34-hyperscript-refactor-comprehensive.test.mjs: Full test suite Key Findings: - No hyperscript multi-file bug in 0.9.14 - Hyperscript def statements are globally accessible - Previous refactoring failures were syntax errors, not library bugs
This commit is contained in:
@@ -46,38 +46,8 @@
|
||||
aria-checked="false"
|
||||
aria-label="{{if eq .Lang "es"}}CV Corto - 4 páginas, información esencial{{else}}Short CV - 4 pages, essential information{{end}}"
|
||||
tabindex="0"
|
||||
_="on click
|
||||
-- Remove selected from all cards
|
||||
set cards to .pdf-option-card in #pdf-modal
|
||||
for card in cards
|
||||
remove .selected from card
|
||||
set card's @aria-checked to 'false'
|
||||
end
|
||||
|
||||
-- Add selected to this card
|
||||
add .selected to me
|
||||
set my @aria-checked to 'true'
|
||||
|
||||
-- Enable download button
|
||||
set downloadBtn to .pdf-download-btn in #pdf-modal
|
||||
remove @disabled from downloadBtn
|
||||
|
||||
-- Store selected format
|
||||
set :selectedFormat to my @data-cv-format
|
||||
|
||||
-- Announce to screen readers
|
||||
set announcement to #pdf-selection-announcement
|
||||
if :selectedFormat is 'short'
|
||||
set announcement.textContent to '{{if eq .Lang "es"}}Seleccionado: CV Corto - Una página{{else}}Selected: Short CV - One page{{end}}'
|
||||
end
|
||||
end
|
||||
|
||||
on keydown
|
||||
if event.key is 'Enter' or event.key is ' '
|
||||
halt the event
|
||||
trigger click on me
|
||||
end
|
||||
end">
|
||||
_="on click call selectPdfCard(me)
|
||||
on keydown call handlePdfCardKey(me, event)">
|
||||
|
||||
<div class="pdf-thumbnail thumbnail-short">
|
||||
<!-- Header representation -->
|
||||
@@ -111,38 +81,8 @@
|
||||
aria-checked="true"
|
||||
aria-label="{{if eq .Lang "es"}}CV Por Defecto - 5 páginas con habilidades (Recomendado){{else}}Default CV - 5 pages with skills (Recommended){{end}}"
|
||||
tabindex="0"
|
||||
_="on click
|
||||
-- Remove selected from all cards
|
||||
set cards to .pdf-option-card in #pdf-modal
|
||||
for card in cards
|
||||
remove .selected from card
|
||||
set card's @aria-checked to 'false'
|
||||
end
|
||||
|
||||
-- Add selected to this card
|
||||
add .selected to me
|
||||
set my @aria-checked to 'true'
|
||||
|
||||
-- Enable download button
|
||||
set downloadBtn to .pdf-download-btn in #pdf-modal
|
||||
remove @disabled from downloadBtn
|
||||
|
||||
-- Store selected format
|
||||
set :selectedFormat to my @data-cv-format
|
||||
|
||||
-- Announce to screen readers
|
||||
set announcement to #pdf-selection-announcement
|
||||
if :selectedFormat is 'default'
|
||||
set announcement.textContent to '{{if eq .Lang "es"}}Seleccionado: CV Por Defecto (Recomendado){{else}}Selected: Default CV (Recommended){{end}}'
|
||||
end
|
||||
end
|
||||
|
||||
on keydown
|
||||
if event.key is 'Enter' or event.key is ' '
|
||||
halt the event
|
||||
trigger click on me
|
||||
end
|
||||
end">
|
||||
_="on click call selectPdfCard(me)
|
||||
on keydown call handlePdfCardKey(me, event)">
|
||||
|
||||
<div class="pdf-thumbnail thumbnail-default">
|
||||
<!-- Two-column layout with sidebar -->
|
||||
@@ -184,38 +124,8 @@
|
||||
aria-checked="false"
|
||||
aria-label="{{if eq .Lang "es"}}CV Extendido - 9 páginas, versión completa{{else}}Extended CV - 9 pages, full version{{end}}"
|
||||
tabindex="0"
|
||||
_="on click
|
||||
-- Remove selected from all cards
|
||||
set cards to .pdf-option-card in #pdf-modal
|
||||
for card in cards
|
||||
remove .selected from card
|
||||
set card's @aria-checked to 'false'
|
||||
end
|
||||
|
||||
-- Add selected to this card
|
||||
add .selected to me
|
||||
set my @aria-checked to 'true'
|
||||
|
||||
-- Enable download button
|
||||
set downloadBtn to .pdf-download-btn in #pdf-modal
|
||||
remove @disabled from downloadBtn
|
||||
|
||||
-- Store selected format
|
||||
set :selectedFormat to my @data-cv-format
|
||||
|
||||
-- Announce to screen readers
|
||||
set announcement to #pdf-selection-announcement
|
||||
if :selectedFormat is 'long'
|
||||
set announcement.textContent to '{{if eq .Lang "es"}}Seleccionado: CV Completo - Versión completa{{else}}Selected: Long CV - Full version{{end}}'
|
||||
end
|
||||
end
|
||||
|
||||
on keydown
|
||||
if event.key is 'Enter' or event.key is ' '
|
||||
halt the event
|
||||
trigger click on me
|
||||
end
|
||||
end">
|
||||
_="on click call selectPdfCard(me)
|
||||
on keydown call handlePdfCardKey(me, event)">
|
||||
|
||||
<div class="pdf-thumbnail thumbnail-long">
|
||||
<!-- Header representation -->
|
||||
|
||||
Reference in New Issue
Block a user