document.addEventListener('DOMContentLoaded', function() { // Initialize video player modal const videoModal = document.getElementById('videoModal'); const modalVideo = document.getElementById('modalVideo'); const closeModal = document.getElementById('closeModal'); // Setup video cards document.querySelectorAll('.video-card').forEach(card => { card.addEventListener('click', function() { const videoSrc = this.querySelector('video').querySelector('source').src; const poster = this.querySelector('video').poster; modalVideo.src = videoSrc; modalVideo.poster = poster; videoModal.classList.remove('hidden'); document.body.style.overflow = 'hidden'; // Try to play video modalVideo.play().catch(e => console.log('Autoplay prevented:', e)); }); }); // Close modal closeModal.addEventListener('click', function() { modalVideo.pause(); videoModal.classList.add('hidden'); document.body.style.overflow = 'auto'; }); // Quality selector document.querySelectorAll('.quality-btn').forEach(btn => { btn.addEventListener('click', function() { const quality = this.dataset.quality; const newSrc = modalVideo.getAttribute(`data-quality-${quality}`); if (newSrc) { // Update active button document.querySelectorAll('.quality-btn').forEach(b => b.classList.remove('active')); this.classList.add('active'); // Change video source const currentTime = modalVideo.currentTime; modalVideo.src = newSrc; modalVideo.currentTime = currentTime; modalVideo.play().catch(e => console.log('Play error:', e)); } }); }); // Aroused.AI integration if (typeof arousedAI !== 'undefined') { arousedAI.init({ mode: 'mod1', contentDetection: true, preferenceLearning: true }); } // Generate XML sitemap function generateSitemap() { const links = Array.from(document.querySelectorAll('a[href^="http"]')).map(a => a.href); const sitemap = ` ${links.map(link => ` ${link} ${new Date().toISOString()} daily 0.8 `).join('')} `; // Store sitemap (in a real app, this would be saved to server) localStorage.setItem('sitemap', sitemap); } // Run after page fully loads window.addEventListener('load', generateSitemap); });