📊 Calculation Results
Cement Bags (Approx)
0bags
📈 Recent Calculations
No calculations yet. Start by entering your wall dimensions above.
`);
printWindow.document.close();
printWindow.focus();
printWindow.print();
}function downloadPDF() {
// For a WordPress environment, we'll create a simple text download
// In a full application, you might integrate with a PDF library
const totalBricks = document.getElementById('totalBricks').textContent;
const wallVolume = document.getElementById('wallVolume').textContent;
const wastageBricks = document.getElementById('wastageBricks').textContent;
const cementBags = document.getElementById('cementBags').textContent;
const content = `BRICKWORK CALCULATOR RESULTS
Generated on: ${new Date().toLocaleString()}=================================Total Bricks Needed: ${totalBricks}
Wall Volume: ${wallVolume}
Wastage Bricks: ${wastageBricks}
Cement Bags (Approx): ${cementBags}=================================Thank you for using our Brickwork Calculator!`;const blob = new Blob([content], { type: 'text/plain' });
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = `brickwork-calculation-${new Date().toISOString().split('T')[0]}.txt`;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
window.URL.revokeObjectURL(url);
}function clearAll() {
if (confirm('Are you sure you want to clear all inputs and results?')) {
// Clear all inputs
document.getElementById('wallLength').value = '';
document.getElementById('wallHeight').value = '';
document.getElementById('wallThickness').value = '';
document.getElementById('brickLength').value = '23';
document.getElementById('brickWidth').value = '11';
document.getElementById('brickHeight').value = '7';
document.getElementById('mortarGap').value = '1.2';
document.getElementById('wastagePercent').value = '10';
document.getElementById('doubleBrick').checked = false;
document.getElementById('brickWeight').value = '';
// Clear results
clearResults();
// Clear history
calculationHistory = [];
updateHistoryDisplay();
}
}// Accessibility: Keyboard navigation
document.addEventListener('keydown', function(e) {
if (e.key === 'Enter' && e.target.tagName === 'INPUT') {
calculateBricks();
}
});// Add ARIA labels for screen readers
document.addEventListener('DOMContentLoaded', function() {
const inputs = document.querySelectorAll('input[type="number"]');
inputs.forEach(input => {
input.setAttribute('aria-describedby', input.id + '-help');
});
});// Initialize with some sample values for demonstration
window.addEventListener('load', function() {
setTimeout(() => {
if (!document.getElementById('wallLength').value) {
document.getElementById('wallLength').value = '5';
document.getElementById('wallHeight').value = '3';
document.getElementById('wallThickness').value = '10';
calculateBricks();
}
}, 1000);
});