(function () { 'use strict'; const TOOLS = [ { id: 'concrete-yardage-calculator', icon: '🚜', label: 'Concrete Yardage' }, { id: 'roofing-material-estimator', icon: '🏠', label: 'Roofing Material' }, { id: 'drywall-mud-calculator', icon: '🧱', label: 'Drywall & Mud' }, { id: 'hvac-btu-sizer', icon: '❄️', label: 'HVAC BTU Sizer' }, { id: 'fence-material-calculator', icon: '🚧', label: 'Fence Material' }, { id: 'deck-board-estimator', icon: '🪥', label: 'Deck Board' }, { id: 'flooring-calculator', icon: '📏', label: 'Flooring SqFt' }, { id: 'retaining-wall-calculator', icon: '🧱', label: 'Retaining Wall' }, { id: 'mulch-topsoil-estimator', icon: '🌱', label: 'Mulch & Topsoil' }, { id: 'paint-gallon-calculator', icon: '🎨', label: 'Paint Gallons' } ]; const path = window.location.pathname; const currentFile = path.split('/').pop().replace('.html', ''); const isHome = currentFile === 'index' || currentFile === ''; const dropdownLinks = TOOLS.map(t => ` ${t.icon} ${t.label} ` ).join(''); const navHTML = ` `; const half = Math.ceil(TOOLS.length / 2); const footerHTML = ` `; document.addEventListener('DOMContentLoaded', () => { // --- COOKIE CONSENT BANNER --- const cookieBannerHTML = `
`; document.body.insertAdjacentHTML('beforeend', cookieBannerHTML); if(!localStorage.getItem('cookieConsentAccepted')) { document.getElementById('cookie-banner').style.display = 'flex'; } window.acceptCookies = function() { localStorage.setItem('cookieConsentAccepted', 'true'); document.getElementById('cookie-banner').style.display = 'none'; }; const navEl = document.getElementById('nav-placeholder'); const ftrEl = document.getElementById('footer-placeholder'); if (navEl) navEl.innerHTML = navHTML; if (ftrEl) ftrEl.innerHTML = footerHTML; // Dropdown Logic const toolsBtn = document.getElementById('tools-btn'); const dropdown = document.getElementById('nav-dropdown'); if (toolsBtn && dropdown) { toolsBtn.addEventListener('click', e => { e.stopPropagation(); dropdown.classList.toggle('open'); }); document.addEventListener('click', () => dropdown.classList.remove('open')); dropdown.addEventListener('click', e => e.stopPropagation()); } // Scroll Fade const observer = new IntersectionObserver(entries => { entries.forEach(e => { if (e.isIntersecting) { e.target.classList.add('visible'); }}); }, { threshold: 0.1 }); document.querySelectorAll('.fade-in').forEach(el => observer.observe(el)); }); window.showResults = function() { document.getElementById('calc-form').style.display = 'none'; document.getElementById('results').style.display = 'block'; document.getElementById('results').scrollIntoView({ behavior: 'smooth' }); }; window.resetCalc = function() { document.getElementById('results').style.display = 'none'; document.getElementById('calc-form').style.display = 'block'; window.scrollTo({ top: 0, behavior: 'smooth' }); document.getElementById('calc-form').reset(); }; window.fmtMoney = function(n) { return '$' + Math.round(n).toLocaleString(); }; })();