${getElement('calculator-output') ? getElement('calculator-output').outerHTML : ''}
${document.querySelector('.configuration-table') ? document.querySelector('.configuration-table').outerHTML : ''}
Generated by Aperture Calculator.
`; // 3. Trigger Print Dialog window.print(); // 4. Restore original styles and HTML content contentToPrint.innerHTML = originalHtml; originalDisplay.forEach(item => { item.el.style.display = item.display; }); toolContainer.style.maxWidth = originalToolWidth; toolContainer.style.padding = '20px'; // Restore original padding } // Attach event listeners and run initial calculation after DOM is fully loaded document.addEventListener('DOMContentLoaded', () => { // Initial calculation based on default values calculateAperture(); // Set up event listeners for manual input change const fNumberManualInput = getElement('fNumberManualInput'); if (fNumberManualInput) { fNumberManualInput.addEventListener('input', () => calculateAperture(true)); } // Set up event listeners for focal length change const focalLengthInput = getElement('focalLengthInput'); if (focalLengthInput) { focalLengthInput.addEventListener('input', () => calculateAperture()); } });