Spaces:
Running

voltwizard-pro / script.js
devarlendfs's picture
⚙️ PROMPT GERAL — VERSÃO ALTERNATIVA DO ELETROLAB
a819f41 verified
Raw History Blame Contribute Delete
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
}