Download script.js from theflowercat/pixelframe-videoforge: direct link, hf CLI and curl.
- Browser
- Download file 2.33 kB
-
https://huggingface.co/spaces/theflowercat/pixelframe-videoforge/resolve/main/script.js
- Command line
-
hf download hf://spaces/theflowercat/pixelframe-videoforge/script.js
-
curl -L -o script.js https://huggingface.co/spaces/theflowercat/pixelframe-videoforge/resolve/main/script.js
2.33 kB
| // Form submission handler | |
| document.getElementById('videoForm').addEventListener('submit', function(e) { | |
| e.preventDefault(); | |
| // Get form values | |
| const script = document.getElementById('videoText').value; | |
| const voice = document.getElementById('voiceSelect').value; | |
| const style = document.getElementById('styleSelect').value; | |
| const files = document.getElementById('file-upload').files; | |
| // Show loading state | |
| const submitBtn = e.target.querySelector('button[type="submit"]'); | |
| const originalText = submitBtn.innerHTML; | |
| submitBtn.innerHTML = '<i data-feather="loader" class="animate-spin mr-2"></i> Generating...'; | |
| submitBtn.disabled = true; | |
| // Simulate API call | |
| setTimeout(() => { | |
| // Reset button | |
| submitBtn.innerHTML = originalText; | |
| submitBtn.disabled = false; | |
| feather.replace(); | |
| // Show success message | |
| alert('Your video is being generated! You will be notified when it\'s ready.'); | |
| // In a real app, you would redirect to the video preview page | |
| // window.location.href = '/video-preview?id=123'; | |
| }, 2000); | |
| }); | |
| // Drag and drop functionality | |
| const dropArea = document.querySelector('.border-dashed'); | |
| ['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => { | |
| dropArea.addEventListener(eventName, preventDefaults, false); | |
| }); | |
| function preventDefaults(e) { | |
| e.preventDefault(); | |
| e.stopPropagation(); | |
| } | |
| ['dragenter', 'dragover'].forEach(eventName => { | |
| dropArea.addEventListener(eventName, highlight, false); | |
| }); | |
| ['dragleave', 'drop'].forEach(eventName => { | |
| dropArea.addEventListener(eventName, unhighlight, false); | |
| }); | |
| function highlight() { | |
| dropArea.classList.add('border-purple-500', 'bg-purple-50'); | |
| } | |
| function unhighlight() { | |
| dropArea.classList.remove('border-purple-500', 'bg-purple-50'); | |
| } | |
| dropArea.addEventListener('drop', handleDrop, false); | |
| function handleDrop(e) { | |
| const dt = e.dataTransfer; | |
| const files = dt.files; | |
| document.getElementById('file-upload').files = files; | |
| // Show file names | |
| const fileList = Array.from(files).map(file => file.name).join(', '); | |
| const infoText = dropArea.querySelector('p:last-child'); | |
| infoText.textContent = `${files.length} file(s) selected: ${fileList}`; | |
| } |