File size: 2,912 Bytes
6591de0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
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);
});