Success!
(540) 349-2800 email@mcmichaelsequipment.com
McMICHAEL'SEQUIPMENT
Home About Tractors & Equipment

Tractors & Equipment(Loading...)

{{#each filteredInventory}}
{{/each}}

Request Pricing

Request Pricing

// FORCED GREEN EXPORT BUTTON – works 100 % of the time in Admin Mode (function() { function createButton() { // Remove any old button first const old = document.getElementById('FORCE-export-views'); if (old) old.remove(); // Check ALL possible admin flags you’ve ever used const isAdmin = localStorage.getItem('mcmichaelsAdmin') === 'true' || localStorage.getItem('adminMode') === 'true' || sessionStorage.getItem('mcmichaelsAdmin') === 'true' || document.body.classList.contains('admin-mode'); if (!isAdmin) return; const btn = document.createElement('button'); btn.id = 'FORCE-export-views'; btn.innerHTML = 'Export Product Views'; btn.style.cssText = ` position:fixed !important; bottom:110px !important; right:20px !important; background:#22c55e !important; color:white !important; padding:16px 24px !important; border:none !important; border-radius:12px !important; font-weight:bold !important; font-size:16px !important; z-index:999999 !important; cursor:pointer !important; box-shadow:0 8px 25px rgba(34,197,94,0.5) !important; `; btn.onclick = () => { const views = JSON.parse(localStorage.getItem('productViews') || '[]'); if (views.length === 0) { alert('No views recorded yet'); return; } let csv = 'Date,Time,Product,Brand,Price,Stock,URL\n'; views.forEach(v => { const date = new Date(v.timestamp); csv += `${date.toLocaleDateString()},${date.toLocaleTimeString()}, "${v.title}", "${v.brand}", ${v.price}, "${v.stockNumber || ''}", "${v.pageUrl}"\n`; }); const blob = new Blob([csv], {type: 'text/csv'}); const a = document.createElement('a'); a.href = URL.createObjectURL(blob); a.download = `McMichaels-Views-${new Date().toISOString().slice(0,10)}.csv`; a.click(); }; document.body.appendChild(btn); } // Run now + every 1 second for 10 seconds (guarantees it appears) createButton(); let count = 0; const interval = setInterval(() => { createButton(); if (++count > 10) clearInterval(interval); }, 1000); // Also run when you toggle admin mode window.addEventListener('storage', createButton); })();