Spaces:
Running
Running
Download script.js from paulgz/slidewiz-magicdeck: direct link, hf CLI and curl.
- Browser
- Download file 2.28 kB
-
https://huggingface.co/spaces/paulgz/slidewiz-magicdeck/resolve/main/script.js
- Command line
-
hf download hf://spaces/paulgz/slidewiz-magicdeck/script.js
-
curl -L -o script.js https://huggingface.co/spaces/paulgz/slidewiz-magicdeck/resolve/main/script.js
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... | |
| }); | |