Trade-In

here
${portalHTML} `; }; // --- LOADER --- // This function injects the launch button into the host page. const loadPortalLauncher = () => { // Add fonts to the host page for the button style. if (!document.querySelector('link[href*="fonts.googleapis.com/css2?family=Inter"]')) { const fontLink = document.createElement('link'); fontLink.href = 'https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap'; fontLink.rel = 'stylesheet'; document.head.appendChild(fontLink); } // Add the button HTML to the page const tempDiv = document.createElement('div'); tempDiv.innerHTML = launchButtonHTML; const launchButton = tempDiv.firstChild; document.body.appendChild(launchButton); // Add event listener to open the new window launchButton.addEventListener('click', () => { const portalWindow = window.open('', 'TradeInPortal', 'width=1200,height=800,scrollbars=yes,resizable=yes'); if (portalWindow) { portalWindow.document.write(generatePopupWindowContent()); portalWindow.document.close(); // Important for some browsers. } else { alert('Popup blocked! Please allow popups for this site to use the trade-in portal.'); } }); }; // --- INITIALIZATION TRIGGER --- if (document.readyState === 'complete') { loadPortalLauncher(); } else { window.addEventListener('load', loadPortalLauncher); } })();