// TrendBlitz Privacy Policy - Interactive Features document.addEventListener('DOMContentLoaded', function() { // Set current date const currentDateEl = document.getElementById('currentDate'); if (currentDateEl) { const now = new Date(); const options = { year: 'numeric', month: 'long', day: 'numeric' }; currentDateEl.textContent = now.toLocaleDateString('en-US', options); } // Set footer year const footerYearEl = document.getElementById('footerYear'); if (footerYearEl) { footerYearEl.textContent = new Date().getFullYear(); } // Theme toggle functionality const themeToggle = document.getElementById('themeToggle'); const body = document.body; const html = document.documentElement; // Check for saved theme preference or default to 'light' const currentTheme = localStorage.getItem('theme') || 'light'; if (currentTheme === 'dark') { html.classList.add('dark'); body.classList.remove('bg-slate-50', 'text-slate-800'); body.classList.add('bg-slate-900', 'text-slate-100'); updateThemeIcon('dark'); } themeToggle.addEventListener('click', function() { const isDark = html.classList.contains('dark'); if (isDark) { // Switch to light html.classList.remove('dark'); body.classList.remove('bg-slate-900', 'text-slate-100'); body.classList.add('bg-slate-50', 'text-slate-800'); localStorage.setItem('theme', 'light'); updateThemeIcon('light'); } else { // Switch to dark html.classList.add('dark'); body.classList.remove('bg-slate-50', 'text-slate-800'); body.classList.add('bg-slate-900', 'text-slate-100'); localStorage.setItem('theme', 'dark'); updateThemeIcon('dark'); } // Re-initialize Feather icons after theme change if (typeof feather !== 'undefined') { feather.replace(); } }); function updateThemeIcon(theme) { const icon = themeToggle.querySelector('i'); if (theme === 'dark') { icon.setAttribute('data-feather', 'sun'); } else { icon.setAttribute('data-feather', 'moon'); } } // Smooth scroll for anchor links with offset for fixed header document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function(e) { e.preventDefault(); const targetId = this.getAttribute('href'); if (targetId === '#') return; const targetElement = document.querySelector(targetId); if (targetElement) { const headerOffset = 100; const elementPosition = targetElement.getBoundingClientRect().top; const offsetPosition = elementPosition + window.pageYOffset - headerOffset; window.scrollTo({ top: offsetPosition, behavior: 'smooth' }); } }); }); // Highlight active section in navigation const sections = document.querySelectorAll('section[id]'); const navLinks = document.querySelectorAll('nav a[href^="#"]'); function highlightActiveSection() { const scrollPos = window.scrollY + 150; sections.forEach(section => { const sectionTop = section.offsetTop; const sectionHeight = section.offsetHeight; const sectionId = section.getAttribute('id'); if (scrollPos >= sectionTop && scrollPos < sectionTop + sectionHeight) { navLinks.forEach(link => { link.classList.remove('bg-primary-100', 'text-primary-700'); if (link.getAttribute('href') === `#${sectionId}`) { link.classList.add('bg-primary-100', 'text-primary-700'); } }); } }); } window.addEventListener('scroll', highlightActiveSection); // Intersection Observer for fade-in animations const observerOptions = { root: null, rootMargin: '0px', threshold: 0.1 }; const fadeInObserver = new IntersectionObserver((entries) => { entries.forEach(entry => { if (entry.isIntersecting) { entry.target.classList.add('opacity-100', 'translate-y-0'); entry.target.classList.remove('opacity-0', 'translate-y-4'); } }); }, observerOptions); // Observe all sections for fade-in effect document.querySelectorAll('section').forEach((section, index) => { section.classList.add('transition-all', 'duration-500', 'opacity-0', 'translate-y-4'); section.style.transitionDelay = `${index * 50}ms`; fadeInObserver.observe(section); }); // Copy email to clipboard functionality const emailLink = document.querySelector('a[href^="mailto:hello@moneyed28.com"]'); if (emailLink) { emailLink.addEventListener('click', function(e) { // Don't prevent default, just add a subtle feedback const originalText = this.innerHTML; this.innerHTML = ` Email copied!`; feather.replace(); setTimeout(() => { this.innerHTML = originalText; feather.replace(); }, 2000); }); } // Keyboard navigation enhancement document.addEventListener('keydown', function(e) { // Press 'T' to toggle theme if (e.key === 't' && !e.ctrlKey && !e.metaKey && !e.altKey) { if (document.activeElement.tagName !== 'INPUT' && document.activeElement.tagName !== 'TEXTAREA') { themeToggle.click(); } } }); // Console easter egg console.log('%c🔒 TrendBlitz Privacy Policy', 'font-size: 20px; font-weight: bold; color: #6366f1;'); console.log('%cYour privacy matters to us. Read our full policy at https://trendblitz.app/privacy', 'font-size: 12px; color: #64748b;'); });