File size: 2,282 Bytes
870a948
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a1cdeec
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
// Initialize slide editor functionality
document.addEventListener('DOMContentLoaded', () => {
    // Tooltip initialization
    const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
    tooltipTriggerList.map(function (tooltipTriggerEl) {
        return new bootstrap.Tooltip(tooltipTriggerEl);
    });

    // Load saved slides if any
    if(localStorage.getItem('currentSlide')) {
        try {
            const slideData = JSON.parse(localStorage.getItem('currentSlide'));
            // Implement slide loading logic here
        } catch(e) {
            console.error('Error loading saved slide:', e);
        }
    }
});

// Slide template selection
function selectTemplate(templateId) {
    fetch(`/api/templates/${templateId}`)
        .then(response => response.json())
        .then(data => {
            // Apply template to editor
            console.log('Template loaded:', data);
            // Implement template application logic here
        })
        .catch(error => console.error('Error loading template:', error));
}
// Analytics for template usage
function trackTemplateUsage(templateId) {
    if(typeof gtag !== 'undefined') {
        gtag('event', 'select_template', {
            'template_id': templateId
        });
    }
}

// Contact form submission
function submitContactForm() {
    const name = document.getElementById('name').value;
    const email = document.getElementById('email').value;
    const subject = document.getElementById('subject').value;
    const message = document.getElementById('message').value;
    
    if(name && email && message) {
        alert('Thank you for your message! We will get back to you soon.');
        document.querySelector('form').reset();
    } else {
        alert('Please fill in all required fields.');
    }
}

// Handle template loading from URL parameter
function loadTemplateFromURL() {
    const urlParams = new URLSearchParams(window.location.search);
    const template = urlParams.get('template');
    
    if(template) {
        selectTemplate(template);
        trackTemplateUsage(template);
    }
}

// Initialize page
document.addEventListener('DOMContentLoaded', () => {
    loadTemplateFromURL();
    
    // Existing initialization code...
});