Spaces:
Running
Running
Download script.js from alexmtan/scriptcraft-launchpad: direct link, hf CLI and curl.
- Browser
- Download file 1.64 kB
-
https://huggingface.co/spaces/alexmtan/scriptcraft-launchpad/resolve/main/script.js
- Command line
-
hf download hf://spaces/alexmtan/scriptcraft-launchpad/script.js
-
curl -L -o script.js https://huggingface.co/spaces/alexmtan/scriptcraft-launchpad/resolve/main/script.js
1.64 kB
| // Shared functionality across pages | |
| document.addEventListener('DOMContentLoaded', function() { | |
| // Initialize tooltips | |
| const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')); | |
| tooltipTriggerList.map(function (tooltipTriggerEl) { | |
| return new bootstrap.Tooltip(tooltipTriggerEl); | |
| }); | |
| // Smooth scrolling for anchor links | |
| document.querySelectorAll('a[href^="#"]').forEach(anchor => { | |
| anchor.addEventListener('click', function (e) { | |
| e.preventDefault(); | |
| document.querySelector(this.getAttribute('href')).scrollIntoView({ | |
| behavior: 'smooth' | |
| }); | |
| }); | |
| }); | |
| // Theme switcher functionality | |
| const themeSwitcher = document.getElementById('theme-switcher'); | |
| if (themeSwitcher) { | |
| themeSwitcher.addEventListener('click', function() { | |
| document.documentElement.classList.toggle('dark'); | |
| localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); | |
| }); | |
| } | |
| }); | |
| // API functions for script generation | |
| async function generateScript(prompt, scriptType) { | |
| try { | |
| // In a real implementation, this would call your backend API | |
| console.log(`Generating ${scriptType} script with prompt: ${prompt}`); | |
| // Simulate API delay | |
| await new Promise(resolve => setTimeout(resolve, 1500)); | |
| // Return mock data for demonstration | |
| return { | |
| success: true, | |
| script: `INT. ${scriptType.toUpperCase()} SETTING - DAY\n\n${prompt}\n\n(Generated ${ |