File size: 3,094 Bytes
812f3ab
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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

// Main application script
document.addEventListener('DOMContentLoaded', function() {
    // Inject Google AdSense for free members
    const isPaidMember = false; // Would be set based on auth status
    
    if (!isPaidMember) {
        const adScript = document.createElement('script');
        adScript.src = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-XXXXXXXXXXXXXXXX';
        adScript.async = true;
        adScript.crossOrigin = 'anonymous';
        document.head.appendChild(adScript);
        
        // Show ad placeholder divs
        const adDivs = document.querySelectorAll('.ad-unit');
        adDivs.forEach(div => div.style.display = 'block');
    }
// Initialize file upload display
    const configFileInput = document.getElementById('configFile');
    if (configFileInput) {
        configFileInput.addEventListener('change', function(e) {
            const fileNameDisplay = document.getElementById('fileName');
            if (this.files.length > 0) {
                fileNameDisplay.textContent = this.files[0].name;
            } else {
                fileNameDisplay.textContent = 'No file chosen';
            }
        });
    }
    
    // Simulate content generation
    const generateBtn = document.querySelector('button[data-generate]');
    if (generateBtn) {
        generateBtn.addEventListener('click', function() {
            const resultSection = document.getElementById('resultSection');
            if (resultSection) {
                resultSection.classList.remove('hidden');
                resultSection.classList.add('fade-in');
                
                // Scroll to results
                setTimeout(() => {
                    resultSection.scrollIntoView({ behavior: 'smooth' });
                }, 300);
            }
        });
    }
    
    // Tab functionality for config builder
    const tabs = document.querySelectorAll('[data-tab]');
    if (tabs.length > 0) {
        tabs.forEach(tab => {
            tab.addEventListener('click', function() {
                const tabName = this.getAttribute('data-tab');
                const tabContents = document.querySelectorAll('.tab-content');
                
                // Hide all tab contents
                tabContents.forEach(content => {
                    content.classList.add('hidden');
                });
                
                // Show selected tab content
                const activeContent = document.getElementById(tabName);
                if (activeContent) {
                    activeContent.classList.remove('hidden');
                }
                
                // Update active tab styling
                tabs.forEach(t => {
                    t.classList.remove('border-primary', 'text-primary');
                    t.classList.add('border-transparent', 'text-gray-500');
                });
                
                this.classList.remove('border-transparent', 'text-gray-500');
                this.classList.add('border-primary', 'text-primary');
            });
        });
    }
});