(function () { // Prevent browser from restoring a scrolled position automatically. if (‘scrollRestoration’ in history) history.scrollRestoration = ‘manual’; // If some links still have #t4b-continue in href, strip it on click and add ?go=1 instead. const billing = sessionStorage.getItem(‘t4b-billing’) || ‘monthly’; document.addEventListener(‘click’, function (e) { const btn = e.target.closest(‘.t4b-btn’); if (!btn) return; // Work out the correct package URL (respects monthly/yearly buttons) const raw = (btn.dataset && (btn.dataset[billing] || btn.dataset.monthly || btn.dataset.yearly)) || btn.getAttribute(‘href’) || ”; if (!raw) return; e.preventDefault(); // Strip any #hash and append go=1 once const url = new URL(raw.replace(/#.*$/, ”), window.location.origin); url.searchParams.set(‘go’, ‘1’); // Navigate without any anchor to avoid initial jump window.location.href = url.toString(); }, true); // On load, if ?go=1 is present, do a controlled smooth scroll to the target, then clean the URL. window.addEventListener(‘DOMContentLoaded’, function () { const url = new URL(window.location.href); const go = url.searchParams.get(‘go’); // If page was previously linked with a #t4b-continue hash, remove it quietly if (window.location.hash === ‘#t4b-continue’) { history.replaceState(null, ”, url.pathname + url.search); } if (go === ‘1’) { const target = document.getElementById(‘t4b-continue’); if (target) { // Small delay to ensure layout is ready before scrolling setTimeout(function () { target.scrollIntoView({ behavior: ‘smooth’, block: ‘start’ }); }, 150); } // Clean the ?go=1 from the URL so refreshes don’t scroll again url.searchParams.delete(‘go’); history.replaceState(null, ”, url.pathname + (url.search ? ‘?’ + url.searchParams.toString() : ”) + ”); } }); })();