feat: restore all missing hyperscript toggle and hover sync functions
Added 6 critical hyperscript functions that were lost during parse error fix: - toggleCVLength(isLong) - Toggle between long/short CV views with localStorage - toggleIcons(showIcons) - Toggle icon visibility with persistence - toggleTheme(isClean) - Toggle between default/clean themes - syncPdfHover(show) - Synchronized hover effects for PDF download buttons - syncPrintHover(show) - Synchronized hover effects for print buttons - highlightZoomControl(show) - Highlight zoom control on interaction All functions use hyperscript 0.9.12 compatible syntax (no 'else' blocks). Each toggle function syncs between action bar and menu checkboxes. Verified: - Zero parse errors in browser console - All 9 hyperscript functions properly defined - File grew from 134 to 250 lines (+87%) - Compatible with existing HTML templates
This commit is contained in:
@@ -126,6 +126,123 @@ def handleScroll()
|
||||
set :lastScroll to currentScroll
|
||||
end
|
||||
|
||||
-- ==============================================================================
|
||||
-- TOGGLE FUNCTIONS
|
||||
-- ==============================================================================
|
||||
|
||||
def toggleCVLength(isLong)
|
||||
set paper to the first .cv-paper
|
||||
set lengthCheckbox to the first #cv-length-toggle
|
||||
set menuLengthCheckbox to the first #menu-cv-length-toggle
|
||||
|
||||
-- Update DOM state
|
||||
if isLong is true
|
||||
remove .cv-short from paper
|
||||
add .cv-long to paper
|
||||
set lengthCheckbox's checked to true
|
||||
set menuLengthCheckbox's checked to true
|
||||
call localStorage.setItem('cv-length', 'long')
|
||||
end
|
||||
|
||||
if isLong is false
|
||||
remove .cv-long from paper
|
||||
add .cv-short to paper
|
||||
set lengthCheckbox's checked to false
|
||||
set menuLengthCheckbox's checked to false
|
||||
call localStorage.setItem('cv-length', 'short')
|
||||
end
|
||||
end
|
||||
|
||||
def toggleIcons(showIcons)
|
||||
set container to the first .cv-container
|
||||
set iconsCheckbox to the first #icons-toggle
|
||||
set menuIconsCheckbox to the first #menu-icons-toggle
|
||||
|
||||
-- Update DOM state
|
||||
if showIcons is true
|
||||
remove .hide-icons from container
|
||||
set iconsCheckbox's checked to true
|
||||
set menuIconsCheckbox's checked to true
|
||||
call localStorage.setItem('cv-icons', 'show')
|
||||
end
|
||||
|
||||
if showIcons is false
|
||||
add .hide-icons to container
|
||||
set iconsCheckbox's checked to false
|
||||
set menuIconsCheckbox's checked to false
|
||||
call localStorage.setItem('cv-icons', 'hide')
|
||||
end
|
||||
end
|
||||
|
||||
def toggleTheme(isClean)
|
||||
set container to the first .cv-container
|
||||
set themeCheckbox to the first #theme-toggle
|
||||
set menuThemeCheckbox to the first #menu-theme-toggle
|
||||
|
||||
-- Update DOM state
|
||||
if isClean is true
|
||||
add .theme-clean to container
|
||||
set themeCheckbox's checked to true
|
||||
set menuThemeCheckbox's checked to true
|
||||
call localStorage.setItem('cv-theme', 'clean')
|
||||
end
|
||||
|
||||
if isClean is false
|
||||
remove .theme-clean from container
|
||||
set themeCheckbox's checked to false
|
||||
set menuThemeCheckbox's checked to false
|
||||
call localStorage.setItem('cv-theme', 'default')
|
||||
end
|
||||
end
|
||||
|
||||
-- ==============================================================================
|
||||
-- HOVER SYNC FUNCTIONS
|
||||
-- ==============================================================================
|
||||
|
||||
def syncPdfHover(show)
|
||||
set pdfButtons to .pdf-download-button
|
||||
|
||||
if show is true
|
||||
for button in pdfButtons
|
||||
add .pdf-hover-sync to button
|
||||
end
|
||||
end
|
||||
|
||||
if show is false
|
||||
for button in pdfButtons
|
||||
remove .pdf-hover-sync from button
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def syncPrintHover(show)
|
||||
set printButtons to .print-button
|
||||
|
||||
if show is true
|
||||
for button in printButtons
|
||||
add .print-hover-sync to button
|
||||
end
|
||||
end
|
||||
|
||||
if show is false
|
||||
for button in printButtons
|
||||
remove .print-hover-sync from button
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def highlightZoomControl(show)
|
||||
set zoomWrapper to the first #zoom-wrapper
|
||||
|
||||
if show is true
|
||||
add .highlight to zoomWrapper
|
||||
end
|
||||
|
||||
if show is false
|
||||
remove .highlight from zoomWrapper
|
||||
end
|
||||
end
|
||||
|
||||
-- ==============================================================================
|
||||
-- KEYBOARD SHORTCUTS
|
||||
-- ==============================================================================
|
||||
|
||||
Reference in New Issue
Block a user