document.addEventListener('DOMContentLoaded', function() { // Initialize form validation for contribute page const contributionForm = document.querySelector('form'); if (contributionForm) { contributionForm.addEventListener('submit', function(e) { e.preventDefault(); // In a real app, this would submit to a backend alert('Thank you for your contribution! Our team will review it shortly.'); this.reset(); }); } // Search functionality const searchBtn = document.getElementById('searchBtn'); const searchInput = document.getElementById('searchInput'); const resultsSection = document.getElementById('resultsSection'); const resultsContainer = document.getElementById('resultsContainer'); const popularSection = document.getElementById('popularSection'); searchBtn.addEventListener('click', performSearch); searchInput.addEventListener('keypress', function(e) { if (e.key === 'Enter') { performSearch(); } }); function performSearch() { const query = searchInput.value.trim(); if (query) { // In a real app, this would fetch from an API simulateSearch(query); } } function simulateSearch(query) { // Show loading state resultsContainer.innerHTML = '
Searching...
'; resultsSection.classList.remove('hidden'); popularSection.classList.add('hidden'); // Simulate API delay setTimeout(() => { if (query.toLowerCase() === 'no results') { resultsContainer.innerHTML = `

No movies found

Try a different search term

`; } else { // Mock results resultsContainer.innerHTML = ''; const mockResults = [ { title: 'Pulp Fiction', status: 'warning', description: 'Brief v*mit scene (non-graphic)', image: 'http://static.photos/movie/640x360/5' }, { title: 'The Matrix', status: 'safe', description: 'No reported triggers', image: 'http://static.photos/movie/640x360/6' }, { title: 'Forrest Gump', status: 'caution', description: 'Multiple v*mit references', image: 'http://static.photos/movie/640x360/7' } ]; mockResults.forEach((movie, index) => { const statusColor = movie.status === 'safe' ? 'green' : movie.status === 'warning' ? 'red' : 'yellow'; const statusText = movie.status === 'safe' ? 'Safe' : movie.status === 'warning' ? 'Warning' : 'Caution'; const card = document.createElement('div'); card.className = 'movie-card bg-gray-800 rounded-lg overflow-hidden shadow-lg'; card.style.animationDelay = `${index * 0.1}s`; card.innerHTML = `
${movie.title}
${statusText}

${movie.title}

${movie.description}

`; resultsContainer.appendChild(card); }); } feather.replace(); }, 800); } });