Spaces:
Running
Running
Download script.js from devarlendfs/voltwizard-pro: direct link, hf CLI and curl.
- Browser
- Download file 1.73 kB
-
https://huggingface.co/spaces/devarlendfs/voltwizard-pro/resolve/main/script.js
- Command line
-
hf download hf://spaces/devarlendfs/voltwizard-pro/script.js
-
curl -L -o script.js https://huggingface.co/spaces/devarlendfs/voltwizard-pro/resolve/main/script.js
1.73 kB
| // Initialize tooltips | |
| document.addEventListener('DOMContentLoaded', function() { | |
| // Initialize all tooltips | |
| const tooltipElements = document.querySelectorAll('[data-tooltip]'); | |
| tooltipElements.forEach(el => { | |
| const tooltipText = el.getAttribute('data-tooltip'); | |
| const tooltip = document.createElement('div'); | |
| tooltip.className = 'tooltip hidden absolute z-50 bg-gray-800 text-white text-sm px-3 py-1 rounded-md shadow-lg'; | |
| tooltip.textContent = tooltipText; | |
| el.appendChild(tooltip); | |
| el.addEventListener('mouseenter', () => { | |
| tooltip.classList.remove('hidden'); | |
| }); | |
| el.addEventListener('mouseleave', () => { | |
| tooltip.classList.add('hidden'); | |
| }); | |
| }); | |
| // Calculator functions | |
| const ohmLawCalculator = document.querySelector('#ohm-law-calc'); | |
| if (ohmLawCalculator) { | |
| ohmLawCalculator.addEventListener('submit', function(e) { | |
| e.preventDefault(); | |
| // Ohm's Law calculation logic | |
| }); | |
| } | |
| // Responsive adjustments | |
| function handleResize() { | |
| // Responsive adjustments if needed | |
| } | |
| window.addEventListener('resize', handleResize); | |
| handleResize(); | |
| }); | |
| // Form validation helper | |
| function validateInput(input) { | |
| if (!input.value) { | |
| input.classList.add('border-red-500'); | |
| return false; | |
| } | |
| input.classList.remove('border-red-500'); | |
| return true; | |
| } | |
| // PDF generation function | |
| function generatePDF(content, filename = 'orcamento.pdf') { | |
| // PDF generation logic would go here | |
| console.log(`Generating PDF: ${filename}`); | |
| // In a real implementation, this would use a library like jsPDF | |
| } |