Add embedded video player, increase quality of all images and videos, add automatic compatibility config based on device spec/net speed. Index with xml sitemap for all links, add aroused.ai mod
6591de0 verified | 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 = `<?xml version="1.0" encoding="UTF-8"?> | |
| <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> | |
| ${links.map(link => ` | |
| <url> | |
| <loc>${link}</loc> | |
| <lastmod>${new Date().toISOString()}</lastmod> | |
| <changefreq>daily</changefreq> | |
| <priority>0.8</priority> | |
| </url>`).join('')} | |
| </urlset>`; | |
| // 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); | |
| }); |