Spaces:
Running
Running
| showModal('<p class="small">Draft loaded successfully β </p>'); | |
| } catch (error) { | |
| showModal('<p class="small">Error loading draft: ' + error.message + '</p>'); | |
| } | |
| } | |
| function resetForm() { | |
| if (confirm('Are you sure you want to reset the form? All data will be lost.')) { | |
| document.querySelectorAll('.form-control').forEach(el => { | |
| if (el.type === 'checkbox') { | |
| el.checked = false; | |
| } else { | |
| el.value = ''; | |
| } | |
| }); | |
| sunoBlockOut.textContent = 'Suno block will appear here...'; | |
| warningsDisplay.textContent = ''; | |
| document.getElementById('songPrompt').value = ''; | |
| document.getElementById('artPrompt').value = ''; | |
| document.getElementById('videoPrompt').value = ''; | |
| imgGrid.innerHTML = ''; | |
| videoPreview.innerHTML = ''; | |
| videoOut.textContent = 'Video status...'; | |
| removeSongFile(); | |
| clearClips(); | |
| showModal('<p class="small">Form reset successfully β </p>'); | |
| } | |
| } | |
| function randomizeForm() { | |
| const adjectives = ['Happy', 'Romantic', 'Exciting', 'Melancholic', 'Energetic']; | |
| const genres = ['Pop', 'Rock', 'Jazz', 'Hip Hop', 'Classical']; | |
| const relationships = ['Mother', 'Father', 'Friend', 'Partner', 'Sibling']; | |
| const occasions = ['Birthday', 'Anniversary', 'Graduation', 'Wedding', 'Retirement']; | |
| document.getElementById('songTitle').value = `Song for ${getRandom(occasions)}`; | |
| document.getElementById('occasion').value = getRandom(occasions); | |
| document.getElementById('buyerName').value = 'John Doe'; | |
| document.getElementById('recipientName').value = 'Jane Smith'; | |
| document.getElementById('relationship').value = getRandom(relationships); | |
| document.getElementById('tone').value = getRandom(adjectives); | |
| document.getElementById('mainGenre').value = getRandom(genres); | |
| document.getElementById('secondaryGenres').value = getRandom(genres); | |
| document.getElementById('tempo').value = getRandom(['Fast', 'Medium', 'Slow']); | |
| document.getElementById('vocalStyle').value = getRandom(['Male', 'Female', 'Duet']); | |
| document.getElementById('instrumentationNotes').value = 'Piano, guitar, soft drums'; | |
| document.getElementById('keyFacts').value = 'Loves music\nEnjoys traveling\nKind-hearted'; | |
| document.getElementById('stories').value = 'First met in college\nTravel to Paris together'; | |
| document.getElementById('mainMessage').value = 'Thank you for being you'; | |
| document.getElementById('namesPlaces').value = 'Jane\nParis\nCollege'; | |
| document.getElementById('visualStyle').value = 'Cartoon'; | |
| document.getElementById('visualMood').value = 'Bright'; | |
| document.getElementById('visualPlacesThemes').value = 'Beach\nMountains\nCity'; | |
| document.getElementById('visualText').value = 'Happy Birthday!'; | |
| showModal('<p class="small">Form randomized successfully β </p>'); | |
| } | |
| function getRandom(array) { | |
| return array[Math.floor(Math.random() * array.length)]; | |
| } | |
| function runDiagnostics() { | |
| const diagnostics = []; | |
| const formData = getFormData(); | |
| // Check API key | |
| diagnostics.push(`API Key: ${apiKey ? 'β Present' : 'β Missing'}`); | |
| // Check required fields | |
| diagnostics.push(`Buyer Name: ${formData.buyerName ? 'β Present' : 'β Missing'}`); | |
| diagnostics.push(`Recipient Name: ${formData.recipientName ? 'β Present' : 'β Missing'}`); | |
| // Check song file | |
| diagnostics.push(`Song File: ${songFile ? 'β Uploaded' : 'β Not uploaded'}`); | |
| // Check video clips | |
| diagnostics.push(`Video Clips: ${videoClips.length > 0 ? 'β Uploaded' : 'β Not uploaded'}`); | |
| // Check prompts | |
| diagnostics.push(`Song Prompt: ${formData.mainMessage ? 'β Present' : 'β Missing'}`); | |
| diagnostics.push(`Art Prompt: ${formData.visualStyle ? 'β Present' : 'β Missing'}`); | |
| diagnostics.push(`Video Prompt: ${formData.visualMood ? 'β Present' : 'β Missing'}`); | |
| diagOut.innerHTML = diagnostics.join('<br>'); | |
| diagOut.style.display = 'block'; | |
| } | |
| // Initialize the app | |
| init(); | |
| </script> | |
| </body> | |
| </html> |