slidewiz-magicdeck / script.js
paulgz's picture
enable all the buttons
a1cdeec verified
Raw History Blame Contribute Delete
2.28 kB
// 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...
});