diff --git a/static/hyperscript/functions._hs b/static/hyperscript/functions._hs index 946e5f8..ebf46eb 100644 --- a/static/hyperscript/functions._hs +++ b/static/hyperscript/functions._hs @@ -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 -- ==============================================================================