Overview
The Dev Showcase portfolio uses a modular JavaScript architecture with dedicated modules for specific functionality. All JavaScript files are located inwwwroot/js/.
Core Modules
main.js
Handles navigation menu toggling and responsive sidebar behavior. Location:wwwroot/js/main.js
Functions
toggleMenu()
Toggles the sidebar navigation menu, hamburger icon, overlay, and body scroll.Event Listeners
- Menu Toggle Click: Opens/closes sidebar menu
- Menu Overlay Click: Closes menu when clicking outside
- Navigation Button Click: Closes menu on mobile (≤1024px) after navigation
- Window Resize: Auto-closes menu when viewport exceeds 1024px
DOM Elements
#menuToggle: Hamburger menu button#sidebar: Navigation sidebar#menuOverlay: Dark overlay for mobile menu.nav-button: Navigation buttons
carousel.js
Manages infinite carousel functionality with touch support for project galleries. Location:wwwroot/js/carousel.js
Class: InfiniteCarousel
Creates an infinite looping carousel with clones for seamless scrolling.Constructor Parameters
Key Methods
getVisibleSlides(): Returns number of visible slides based on viewport- Returns
2.1for viewports > 1200px - Returns
1.1otherwise
animate: boolean - whether to animate the transition
Touch/Mouse Support
Touch Events:touchstart/mousedown: Initiates dragtouchmove/mousemove: Tracks drag movementtouchend/mouseup: Completes drag and snaps to nearest slide
Card Click Handling
Clicking a carousel card:- Prevents action if user was dragging
- Retrieves
data-projectattribute - Activates corresponding
.project-info-card - Scrolls to info section after 450ms delay
Responsive Behavior
- ResizeObserver: Monitors track dimension changes
- Debounced Resize: Updates dimensions after 100ms delay
- Recalculates slide width based on card width + gap
Usage Example
charts-manager.js
Manages Chart.js integration for vocational skills radar and bar charts. Location:wwwroot/js/charts-manager.js
Chart Types
- Radar Chart: RIASEC vocational interests (6 dimensions)
- Cognitive Radar Chart: Cognitive abilities comparison
- Bar Charts: Skills, interests, careers, and occupational values
Global Variables
Color Schemes
RIASEC Colors
Cognitive Colors
Bar Chart Colors
Key Functions
buildRadarData()
Builds radar chart data from translation system.buildCognitiveData()
Builds cognitive radar chart with two datasets (personal vs average).buildBarData()
Builds all bar chart datasets:topSkills,topInterests,topCareerslowSkills,lowInterests,lowCareersvaloresOcupacionales
createRadar() / destroyRadar()
Creates/destroys the main RIASEC radar chart.createCognitiveChart() / destroyCognitiveChart()
Creates/destroys the cognitive abilities radar chart.createBarCharts() / destroyBarCharts()
Creates/destroys bar charts based on active section.window.refreshVocationalCharts()
Global function to refresh all charts after language change.Chart Lifecycle
Charts are created/destroyed based on:- Section visibility (MutationObserver on
#vocational-stats-content) - Active subsection (profile, aptitudes, proyecto)
- Language changes (via
refreshVocationalCharts())
Section-Specific Charts
modal-manager.js
Handles modal dialogs for certificates and project images. Location:wwwroot/js/modal-manager.js
Modal Types
- Certificate Modal: Displays certificate images with title and date
- Image Modal: Displays project images in fullscreen
Functions
openModal(modal)
Opens a modal and prevents body scrolling.closeModal(modal)
Closes a modal and restores body scrolling.Event Listeners
Certificate Cards
Clicking.certificate-card elements:
- Extracts image, title, and date from card
- Populates modal with certificate details
- Opens certificate modal
Project Images
Clicking.left-pnl.img-pnl img elements:
- Extracts image source and alt text
- Populates image modal
- Opens fullscreen image modal
Close Triggers
- Close Button: Click
.certificateModalCloseBtnor.modalCloseBtn - Background Click: Click modal background overlay
- Escape Key: Press
Escapekey to close any active modal
DOM Elements
Certificate Modal:#certificateModal: Modal container#certificateModalImage: Certificate image#certificateModalTitle: Certificate title#certificateModalDate: Issue date#certificateModalCloseBtn: Close button
#imageModal: Modal container#modalImage: Project image#modalCloseBtn: Close button
glow-panels.js
Creates animated glow effects that follow mouse movement on panels. Location:wwwroot/js/glow-panels.js
Functionality
Applies dynamic gradient rotation based on mouse position relative to panel center.Event Handlers
mousemove
Calculates angle from panel center to cursor position:mouseleave
Resets angle to 0deg when mouse leaves panel:CSS Integration
Sets CSS custom property--angle that controls gradient rotation in CSS:
Target Elements
Applies to all elements with.glow-panel class.
icon.js
Manages dynamic favicon updates based on page visibility. Location:wwwroot/js/icon.js
Functionality
Inverts favicon colors when page is visible (active tab) to create a white icon on dark backgrounds.Event Handler
visibilitychange
Canvas Manipulation
- Creates 32x32 canvas
- Draws original favicon image
- If page visible, inverts RGB channels (255 - value)
- Maintains alpha transparency
- Converts canvas to data URL
- Updates favicon href
DOM Manipulation Patterns
Class Toggle Pattern
Used extensively for showing/hiding elements:Query Selectors
Event Delegation
Used in carousel for card clicks:Data Attributes
Used for storing configuration:Initialization Pattern
All modules use DOMContentLoaded event:Additional Modules
translation.js
Complete multilingual translation system with language detection and content updates. Location:wwwroot/js/translation.js
Key Functions
resolveInitialLanguage()
Language detection priority:- URL path prefix (
/es/or/en/) - localStorage (
preferredLanguage) - Browser language (
navigator.language) - Default fallback (
es)
translation.js:4-15
loadTranslations(language)
Async translation loading with caching and fallback:translation.js:19-34
updateContent(translations)
Updates all elements withdata-translate attributes:
translation.js:44-72
changeLanguage(language)
Master function that orchestrates language switching:- Loads translations
- Updates DOM content
- Applies progress bars
- Updates URL
- Syncs with server
- Triggers typewriter and charts refresh
Global Exports
window.changeLanguage(language)- Switch languagewindow.updateCVLink()- Update CV download link based on language and profile
typewriter.js
Animated typewriter effect for the header text. Location:wwwroot/js/typewriter.js
TypewriterEffect Class
typewriter.js:1-54
Configuration Options
typingSpeed: Milliseconds per character when typing (default: 100)deletingSpeed: Milliseconds per character when deleting (default: 50)pauseAfterTyping: Pause before starting to delete (default: 2000)pauseAfterDeleting: Pause before next phrase (default: 500)loop: Whether to loop through phrases (default: true)
Global Exports
window.TypewriterEffect- Class constructorwindow.initTypewriter(language)- Initialize typewriter with language-specific phrases
navigation.js
Section switching and tab management for portfolio sections. Location:wwwroot/js/navigation.js
Main Functions
switchSection(targetId)
Switches between main content sections (introduction, skills, projects, education):navigation.js:12-51
Event Listeners
- Navigation buttons: Switch between main sections
- Skill filter buttons: Toggle between technical/soft skills
- Project filter buttons: Toggle between work/personal projects
- Education buttons: Toggle between preparation/certificates
Section Management
Automatically activates default subsections when entering a section:- Skills: Activates “hard skills” tab by default
- Projects: Activates “professional work” tab by default
- Education: Activates “preparation” tab by default
stats-animation.js
Animated progress bar filling with intersection observer. Location:wwwroot/js/stats-animation.js
animateStatBars(container)
Animates all progress bars within a container:stats-animation.js:2-14
Intersection Observer
Uses IntersectionObserver to trigger animations when sections become visible:stats-animation.js:20-31
Global Exports
window.animateStatBars(container)- Manually trigger bar animations
Performance
Uses doublerequestAnimationFrame for smooth animation timing and prevents layout thrashing.