|
|
|
|
|
|
|
|
|
|
|
document.addEventListener('DOMContentLoaded', function() { |
|
|
console.log('JCode Evolution Tracker loaded'); |
|
|
|
|
|
|
|
|
const cards = document.querySelectorAll('.bg-white\\/10'); |
|
|
cards.forEach((card, index) => { |
|
|
card.style.animationDelay = `${index * 0.1}s`; |
|
|
card.classList.add('fade-in-up'); |
|
|
}); |
|
|
|
|
|
|
|
|
const currentPath = window.location.pathname; |
|
|
const navLinks = document.querySelectorAll('a[href]'); |
|
|
|
|
|
navLinks.forEach(link => { |
|
|
if (link.getAttribute('href') === currentPath) { |
|
|
link.classList.add('active'); |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
const utils = { |
|
|
|
|
|
formatDate: (dateString) => { |
|
|
const options = { year: 'numeric', month: 'long', day: 'numeric' }; |
|
|
return new Date(dateString).toLocaleDateString(undefined, options); |
|
|
}, |
|
|
|
|
|
|
|
|
truncateText: (text, maxLength = 100) => { |
|
|
if (text.length <= maxLength) return text; |
|
|
return text.substring(0, maxLength) + '...'; |
|
|
}, |
|
|
|
|
|
|
|
|
debounce: (func, wait) => { |
|
|
let timeout; |
|
|
return function executedFunction(...args) { |
|
|
const later = () => { |
|
|
clearTimeout(timeout); |
|
|
func(...args); |
|
|
}; |
|
|
clearTimeout(timeout); |
|
|
timeout = setTimeout(later, wait); |
|
|
}; |
|
|
}, |
|
|
|
|
|
|
|
|
randomColor: () => { |
|
|
const colors = ['#667eea', '#764ba2', '#f093fb', '#f5576c', '#4facfe', '#00f2fe']; |
|
|
return colors[Math.floor(Math.random() * colors.length)]; |
|
|
} |
|
|
}; |
|
|
|
|
|
|
|
|
if (typeof module !== 'undefined' && module.exports) { |
|
|
module.exports = { utils }; |
|
|
} |