Spaces:
Running

File size: 1,730 Bytes
a819f41
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// 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
}