Spaces:
Running
Running
File size: 1,631 Bytes
42ab03e 0f0f876 42ab03e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | // DOM Content Loaded Event
document.addEventListener('DOMContentLoaded', function() {
// Initialize feather icons
feather.replace();
// Add animation to cards on page load
const cards = document.querySelectorAll('.border');
cards.forEach((card, index) => {
setTimeout(() => {
card.classList.add('opacity-100');
}, 100 * index);
});
// Button click effects
const buttons = document.querySelectorAll('button');
buttons.forEach(button => {
button.addEventListener('click', function() {
this.classList.add('scale-95');
setTimeout(() => {
this.classList.remove('scale-95');
}, 100);
});
});
});
// AI Chat toggle functionality
document.addEventListener('toggleAIChat', function() {
const aiAgent = document.querySelector('ai-agent');
if (aiAgent) {
aiAgent.shadowRoot.querySelector('#agentButton').click();
}
});
// Theme toggle functionality
function toggleTheme() {
const html = document.documentElement;
const currentTheme = html.classList.contains('dark') ? 'dark' : 'light';
if (currentTheme === 'light') {
html.classList.add('dark');
localStorage.setItem('theme', 'dark');
} else {
html.classList.remove('dark');
localStorage.setItem('theme', 'light');
}
}
// Check for saved theme preference
document.addEventListener('DOMContentLoaded', function() {
const savedTheme = localStorage.getItem('theme');
if (savedTheme === 'dark') {
document.documentElement.classList.add('dark');
}
}); |