Files

74 lines
2.8 KiB
Plaintext
Raw Permalink Normal View History

-- ==============================================================================
-- CV Site - Toggle Functions
-- ==============================================================================
-- Toggle functions for CV customization (length, icons, theme)
-- Migrated from JavaScript (cv-functions.js) after confirming no def limit
-- ==============================================================================
-- CV LENGTH TOGGLE
-- ==============================================================================
def toggleCVLength(isLong)
set paper to the first .cv-paper
set actionBarToggle to #lengthToggle
set menuToggle to #lengthToggleMenu
if isLong is true
remove .cv-short from paper
add .cv-long to paper
call localStorage.setItem('cv-length', 'long')
if actionBarToggle exists then set actionBarToggle's checked to true end
if menuToggle exists then set menuToggle's checked to true end
else
remove .cv-long from paper
add .cv-short to paper
call localStorage.setItem('cv-length', 'short')
if actionBarToggle exists then set actionBarToggle's checked to false end
if menuToggle exists then set menuToggle's checked to false end
end
end
-- ==============================================================================
-- ICONS TOGGLE
-- ==============================================================================
def toggleIcons(showIcons)
set paper to the first .cv-paper
set actionBarToggle to #iconToggle
set menuToggle to #iconToggleMenu
if showIcons is true
add .show-icons to paper
call localStorage.setItem('cv-icons', 'show')
if actionBarToggle exists then set actionBarToggle's checked to true end
if menuToggle exists then set menuToggle's checked to true end
else
remove .show-icons from paper
call localStorage.setItem('cv-icons', 'hide')
if actionBarToggle exists then set actionBarToggle's checked to false end
if menuToggle exists then set menuToggle's checked to false end
end
end
-- ==============================================================================
-- THEME TOGGLE
-- ==============================================================================
def toggleTheme(isClean)
set container to the first .cv-container
set actionBarToggle to #themeToggle
set menuToggle to #themeToggleMenu
if isClean is true
add .theme-clean to container
call localStorage.setItem('cv-theme', 'clean')
if actionBarToggle exists then set actionBarToggle's checked to true end
if menuToggle exists then set menuToggle's checked to true end
else
remove .theme-clean from container
call localStorage.setItem('cv-theme', 'default')
if actionBarToggle exists then set actionBarToggle's checked to false end
if menuToggle exists then set menuToggle's checked to false end
end
end