window.pdUserSession = {"provider":"bigcommerce","token":"","hint":[],"source":"client"}; pdLog('pdUserSession error:', ["token_missing"]); //************************************************ //********** GLOBAL PD/ONE VARIABLES ************* //************************************************ //************************************************ //************ JS/CSS FILE ROUTINES ************* //************************************************ function pdLoadJsCssFile(filename, filetype){ if (filetype=="js") { var fileref=document.createElement('script'); fileref.setAttribute("type","text/javascript"); fileref.setAttribute("async",true); fileref.setAttribute("src", filename); } else if (filetype=="css") { var fileref=document.createElement("link"); fileref.setAttribute("rel", "stylesheet"); fileref.setAttribute("type", "text/css"); fileref.setAttribute("href", filename); } if (typeof fileref!="undefined") document.getElementsByTagName("head")[0].appendChild(fileref); } function pdLog() { if (window.pdDebug && window.console && console.log) { console.log.apply(console, arguments); } } function pdDebugLog() { if (window.console && console.log) { console.log.apply(console, arguments); } } // Some storefront scripts assume event.target.closest(...) exists, but click targets can be text nodes. if (typeof window !== 'undefined' && window.Node && window.Element && !window.Node.prototype.closest) { window.Node.prototype.closest = function(selector) { if (!selector) return null; if (this.nodeType === 1 && window.Element.prototype.closest) { return window.Element.prototype.closest.call(this, selector); } var parent = this.parentElement || this.parentNode; if (!parent) return null; if (parent.nodeType === 1 && window.Element.prototype.closest) { return window.Element.prototype.closest.call(parent, selector); } return null; }; } //************************************************ //*** UTILITY TO EXECUTE SCRIPTS IN A CONTAINER *** //************************************************ function pdRunScriptsIn(element) { if (!element) return; var targetDocument = element.ownerDocument || document; var targetWindow = targetDocument.defaultView || window; if (!targetWindow.__pdExecutedScriptsSet) targetWindow.__pdExecutedScriptsSet = new Set(); var scripts = element.querySelectorAll('script'); pdLog('pdRunScriptsIn: found', scripts.length, 'script tag(s) inside injected content.'); scripts.forEach(function(originalScript, idx) { var signature = originalScript.src ? 'src:' + originalScript.src : 'inline:' + (originalScript.textContent || '').trim(); if (targetWindow.__pdExecutedScriptsSet.has(signature)) { pdLog('pdRunScriptsIn: skipping already executed script #' + (idx + 1)); originalScript.remove(); return; } // Skip known inline definitions if the global already exists (prevents duplicate var errors) if (!originalScript.src && originalScript.textContent && originalScript.textContent.indexOf('EmailInputManager') !== -1 && typeof targetWindow.EmailInputManager !== 'undefined') { pdLog('pdRunScriptsIn: skipping inline EmailInputManager because it already exists.'); originalScript.remove(); return; } var newScript = targetDocument.createElement('script'); // Preserve external vs inline scripts if (originalScript.src) { newScript.src = originalScript.src; newScript.async = originalScript.async; newScript.defer = originalScript.defer; } else { newScript.textContent = originalScript.textContent; } // Move over type/attrs in case module/type is used if (originalScript.type) newScript.type = originalScript.type; // Append to head to ensure execution in most browsers targetWindow.__pdExecutedScriptsSet.add(signature); (targetDocument.head || targetDocument.documentElement).appendChild(newScript); pdLog('pdRunScriptsIn: executed script #' + (idx + 1) + (originalScript.src ? ' src=' + originalScript.src : ' (inline)')); originalScript.remove(); }); } //************************************************ //*** UTILITY TO NORMALIZE MODULE NAMES ********** //************************************************ function pdNormalizeModuleName(raw) { if (!raw) return ''; var name = String(raw); if (name.indexOf('?') !== -1) name = name.split('?')[0]; if (name.indexOf('&') !== -1) name = name.split('&')[0]; if (name.indexOf('#') !== -1) name = name.split('#')[0]; if (name.indexOf('/') !== -1) { var parts = name.split('/').filter(function(p){ return p; }); var lastMod = parts.find(function(p){ return p.indexOf('mod_') === 0; }); if (lastMod) name = lastMod; else name = parts[parts.length - 1] || name; } return name.trim(); } //************************************************ //*** UTILITY TO PULL MODULE NAME FROM A URL ***** //************************************************ function pdGetModuleFromUrl(url) { try { var parsed = new URL(url, window.location.origin); return pdNormalizeModuleName(parsed.searchParams.get('module') || ''); } catch (e) { return ''; } } //************************************************ //****** PD/ONE FEATURE SPECIFIC CSS/JS ********* //************************************************ pdLoadJsCssFile("https://cdn.practicaldatacore.com/rockbottomgolf/mod_bigcommerce/pdCompiledScript.js?cb=1972324", "js"); pdLoadJsCssFile("https://cdn.practicaldatacore.com/rockbottomgolf/mod_pdOneStyleEditor/pdPublicStyle.css?cb=493081", "css"); //*** CATEGORY ID:**** //*** PRODUCT ID:**** //*** PRODUCT ID LIST CSV:**** var pdPublicUrl = 'https://myaccount.rockbottomgolf.com/'; var pdUseLegacyRewardsPage = true; var pdRewardsUseShadowDom = true; function pdShouldUseRewards2025() { return !pdUseLegacyRewardsPage; } function insertDivUnderH1(divClass = "inserted-under-h1") { var pageName = window.location.pathname.split("/").pop(); if (pageName !== "login.php" && pageName !== "cart.php" && pageName !== "checkout") return; var params = new URLSearchParams(window.location.search || ""); var action = params.get("action") || "login"; if (pageName === "login.php" && action === "reset_password") return; var bannerHtml = ""; var bannerTemplateData = {"rewardsPercentageBack":2,"pointsAwardedForNewSignUp":"100"}; if (!bannerHtml) return; if (pageName === "login.php" && action === "login" && !true) return; if (pageName === "login.php" && action === "create_account" && !true) return; if (pageName === "cart.php" && !true) return; if (pageName === "checkout" && !true) return; function pdRenderBannerTemplate(template, data) { if (!template || !data) return template || ''; template = template.replace(/\{\{#if\s+(\w+)\}\}([\s\S]*?)\{\{\/if\}\}/g, function(_, key, inner) { var val = data[key]; if (val === undefined || val === null) return ''; if (typeof val === 'number' && val === 0) return ''; if (typeof val === 'string' && val.trim() === '') return ''; return inner; }); template = template.replace(/\{\{(\w+)\}\}/g, function(_, key) { var val = data[key]; return (val === undefined || val === null) ? '' : String(val); }); return template; } bannerHtml = pdRenderBannerTemplate(bannerHtml, bannerTemplateData); var div = document.createElement("div"); div.className = divClass; div.innerHTML = bannerHtml; if (pageName === "checkout") { var checkoutPrimary = document.querySelector(".layout.optimizedCheckout-contentPrimary"); if (checkoutPrimary) { checkoutPrimary.insertAdjacentElement("afterbegin", div); return; } } var h1 = document.querySelector("h1.page-heading"); if (!h1) return; if (pageName === "cart.php") { h1.insertAdjacentElement("afterend", div); return; } if (action === "login") { var loginRow = document.querySelector(".login-row"); if (loginRow) { loginRow.insertAdjacentElement("afterbegin", div); return; } } if (action === "create_account") { var accountBody = document.querySelector(".account-body"); if (accountBody) { accountBody.insertAdjacentElement("afterbegin", div); return; } } h1.insertAdjacentElement("afterend", div); } function pdShouldInspectAccountUi() { try { var path = (window.location && window.location.pathname) ? window.location.pathname : ''; if (path === '/account.php' || path === '/wishlist.php') return true; if (/^\/(buy-again|address-book|create-quote|quote-detail|quote|quote-edit|quote-list|quotes-list|dashboard|order-detail|quick-order-pad|shopping-list|shopping-lists|user-management|invoices|invoice-payment|invoice-details|invoice-payment-receipt)\/?$/i.test(path)) return true; if (typeof pdIsBigCommerceB2BAccountRoute === 'function' && pdIsBigCommerceB2BAccountRoute()) return true; } catch (e) {} return false; } function pdGetAccountIntegrationModel() { if (!pdShouldInspectAccountUi()) return 'classic'; var navRoot = (typeof pdGetAccountNavRoot === 'function') ? pdGetAccountNavRoot() : null; if (navRoot && navRoot.ownerDocument && navRoot.ownerDocument !== document) return 'b2b'; if (navRoot && navRoot.querySelector && navRoot.querySelector('.MuiListItemButton-root, .MuiTypography-root')) return 'b2b'; if (document.querySelector('#bundle-container iframe.active-frame')) return 'b2b'; return 'classic'; } function pdGetAccountContentContainer() { var model = pdGetAccountIntegrationModel(); if (model === 'b2b') { var navRoot = (typeof pdGetAccountNavRoot === 'function') ? pdGetAccountNavRoot() : null; var doc = navRoot && navRoot.ownerDocument ? navRoot.ownerDocument : document; var main = doc.querySelector('#app-mainPage-layout main') || doc.querySelector('#app-mainPage-layout [role="main"]') || doc.querySelector('main.MuiBox-root') || doc.querySelector('main'); if (!main) return null; var host = main.querySelector('#pdB2BAccountContentHost'); if (!host) { host = doc.createElement('div'); host.id = 'pdB2BAccountContentHost'; host.style.display = 'none'; host.setAttribute('data-pd-b2b-host', 'true'); main.appendChild(host); } return host; } return document.querySelector('.account-content'); } function pdGetB2BAccountMainContainer(doc) { doc = doc || document; return doc.querySelector('#app-mainPage-layout main') || doc.querySelector('#app-mainPage-layout [role="main"]') || doc.querySelector('main.MuiBox-root') || doc.querySelector('main'); } function pdActivateB2BAccountContent(title) { var navRoot = (typeof pdGetAccountNavRoot === 'function') ? pdGetAccountNavRoot() : null; var doc = navRoot && navRoot.ownerDocument ? navRoot.ownerDocument : document; var main = pdGetB2BAccountMainContainer(doc); var host = pdGetAccountContentContainer(); var heading = pdGetAccountPageHeading(); if (!main || !host) return host; if (heading && title) { if (!heading.getAttribute('data-pd-original-heading')) { heading.setAttribute('data-pd-original-heading', heading.textContent || ''); } heading.textContent = title; } for (var i = 0; i < main.children.length; i++) { var child = main.children[i]; if (child === host) continue; if (!child.hasAttribute('data-pd-prev-display')) { child.setAttribute('data-pd-prev-display', child.style.display || ''); } child.style.display = 'none'; child.setAttribute('data-pd-b2b-hidden', 'true'); } host.style.display = ''; host.setAttribute('data-pd-active', 'true'); return host; } function pdRestoreB2BAccountContent(doc) { doc = doc || document; var main = pdGetB2BAccountMainContainer(doc); if (!main) return; try { pdResetB2BRewardsState(doc); } catch (e) {} var host = main.querySelector('#pdB2BAccountContentHost'); if (host) { host.style.display = 'none'; host.removeAttribute('data-pd-active'); } for (var i = 0; i < main.children.length; i++) { var child = main.children[i]; if (child === host) continue; if (child.hasAttribute('data-pd-b2b-hidden')) { child.style.display = child.getAttribute('data-pd-prev-display') || ''; child.removeAttribute('data-pd-prev-display'); child.removeAttribute('data-pd-b2b-hidden'); } } var heading = doc.querySelector('h3') || doc.querySelector('h1, h2, h4'); if (heading && heading.hasAttribute('data-pd-original-heading')) { heading.textContent = heading.getAttribute('data-pd-original-heading') || heading.textContent; heading.removeAttribute('data-pd-original-heading'); } var navRoot = doc.querySelector('nav.MuiList-root, nav[aria-labelledby="nested-list-subheader"]'); if (navRoot) { var injectedTabs = navRoot.querySelectorAll('#pdContent_mod_myRewards, #pdContent_mod_orderHistory, #pdContent_mod_bigcommerce'); for (var j = 0; j < injectedTabs.length; j++) { var item = injectedTabs[j]; if (item.classList) { item.classList.remove('is-active'); item.classList.remove('active'); item.classList.remove('Mui-selected'); } item.removeAttribute('aria-current'); item.removeAttribute('aria-selected'); var interactive = item.querySelector('.MuiListItemButton-root, [role="button"], button'); if (interactive && interactive.classList) { interactive.classList.remove('Mui-selected'); interactive.removeAttribute('aria-selected'); } } } } function pdResetB2BRewardsState(doc) { doc = doc || document; var win = doc.defaultView || window; var host = doc.querySelector('#pdB2BAccountContentHost'); if (host) { host.innerHTML = ''; } try { win.pdRewardsShadowRoot = null; } catch (e) {} try { pdRewardsForceLegacy = false; } catch (e) {} try { doc.querySelectorAll('script[data-pd-rewards-ajax="true"]').forEach(function(script) { if (script.parentNode) script.parentNode.removeChild(script); }); } catch (e) {} try { if (win.__pdExecutedScriptsSet && typeof win.__pdExecutedScriptsSet.forEach === 'function') { var rewardsScriptSignatures = []; win.__pdExecutedScriptsSet.forEach(function(signature) { if ( /mod_myRewards/i.test(signature) || /RewardsManager/i.test(signature) || /pdRewards/i.test(signature) || /rewardTabs/i.test(signature) ) { rewardsScriptSignatures.push(signature); } }); for (var i = 0; i < rewardsScriptSignatures.length; i++) { win.__pdExecutedScriptsSet.delete(rewardsScriptSignatures[i]); } } } catch (e) {} } function pdBindB2BNativeNavRestore() { var docs = (typeof pdGetAccountSearchDocuments === 'function') ? pdGetAccountSearchDocuments() : [document]; for (var i = 0; i < docs.length; i++) { var doc = docs[i]; if (!doc || doc === document || !doc.body || doc.body.getAttribute('data-pd-b2b-nav-restore-bound') === 'true') continue; doc.body.setAttribute('data-pd-b2b-nav-restore-bound', 'true'); doc.addEventListener('click', function(e) { if (!e.target || typeof e.target.closest !== 'function') return; var navRoot = this.querySelector('nav.MuiList-root, nav[aria-labelledby="nested-list-subheader"]'); if (!navRoot) return; var clickedItem = e.target.closest('li, .MuiListItemButton-root, [role="button"], button, a'); if (!clickedItem || !navRoot.contains(clickedItem)) return; if (clickedItem.closest('#pdContent_mod_myRewards, #pdContent_mod_orderHistory, #pdContent_mod_bigcommerce')) return; pdRestoreB2BAccountContent(this); }, true); } } var __pdAccountLinkInjectionSchedulerActive = false; var __pdAccountUrlWatcherBound = false; var __pdLastObservedAccountHref = ''; var __pdAccountUrlWatcherTimer = null; function pdCanRunAccountLinkInjectionForCurrentUrl() { if (!pdShouldRunAccountLinkInjection()) return false; if (!pdIsBigCommerceB2BAccountRoute()) return true; try { if (document.getElementById('bundle-container')) return true; if (document.getElementById('b2b_loading_overlay')) return true; if (document.querySelector('#bundle-container iframe.active-frame, #bundle-container iframe')) return true; } catch (e) {} return false; } function pdOnAccountUrlChanged(reason) { var href = window.location ? window.location.href : ''; if (href === __pdLastObservedAccountHref) return; __pdLastObservedAccountHref = href; pdDebugLog('pdAccountLinks: observed url change', reason || '', href); if (__pdAccountUrlWatcherTimer) clearTimeout(__pdAccountUrlWatcherTimer); var attempts = 0; var waitForReadyState = function() { if (href !== (window.location ? window.location.href : '')) { __pdAccountUrlWatcherTimer = null; return; } if (pdCanRunAccountLinkInjectionForCurrentUrl()) { __pdAccountUrlWatcherTimer = null; pdScheduleAccountLinkInjection(); return; } if (pdIsBigCommerceB2BAccountRoute() && attempts < 12) { attempts++; __pdAccountUrlWatcherTimer = setTimeout(waitForReadyState, 150); return; } __pdAccountUrlWatcherTimer = null; }; __pdAccountUrlWatcherTimer = setTimeout(waitForReadyState, 120); } function pdBindAccountUrlWatcher() { if (__pdAccountUrlWatcherBound) return; __pdAccountUrlWatcherBound = true; __pdLastObservedAccountHref = window.location ? window.location.href : ''; var wrapHistoryMethod = function(method) { var original = history[method]; if (!original || original.__pdWrapped) return; var wrapped = function() { var result = original.apply(this, arguments); pdOnAccountUrlChanged(method); return result; }; wrapped.__pdWrapped = true; history[method] = wrapped; }; try { wrapHistoryMethod('pushState'); wrapHistoryMethod('replaceState'); } catch (e) {} window.addEventListener('hashchange', function() { pdOnAccountUrlChanged('hashchange'); }); window.addEventListener('popstate', function() { pdOnAccountUrlChanged('popstate'); }); } function pdGetAccountPageHeading() { var model = pdGetAccountIntegrationModel(); if (model === 'b2b') { var navRoot = (typeof pdGetAccountNavRoot === 'function') ? pdGetAccountNavRoot() : null; var doc = navRoot && navRoot.ownerDocument ? navRoot.ownerDocument : document; return doc.querySelector('h3') || doc.querySelector('h1, h2, h4'); } return document.querySelector('.page-heading'); } function pdCleanupB2BInjectedHeading(accountContent) { if (!accountContent || pdGetAccountIntegrationModel() !== 'b2b') return; var heading = accountContent.querySelector('.page-heading, h1, h2, h3, h4'); if (!heading) return; var parent = heading.parentElement; if (!parent) return; if (heading === accountContent.firstElementChild) { heading.remove(); return; } if ( parent === accountContent && heading.previousElementSibling === null && heading.textContent && heading.textContent.replace(/\s+/g, ' ').trim() !== '' ) { heading.remove(); } } function pdOpenAccountModule(module, title, subNav) { subNav = subNav || ''; var model = pdGetAccountIntegrationModel(); if (model === 'b2b') { if (module === 'mod_myRewards') { try { var navRoot = (typeof pdGetAccountNavRoot === 'function') ? pdGetAccountNavRoot() : null; var doc = navRoot && navRoot.ownerDocument ? navRoot.ownerDocument : document; pdResetB2BRewardsState(doc); } catch (e) {} } pdActivateB2BAccountContent(title); var url = pdPublicUrl + '/' + module + '/' + (subNav ? (subNav + '.php') : 'index.php') + '?module=' + encodeURIComponent(module); if (module === 'mod_myRewards') { pdLoadRewardsLegacyFallback({ method: 'GET', queryString: 'module=' + encodeURIComponent(module) }); } else { pdOneAjaxLinkHandler(url); } return false; } window.top.location.href = pdPublicUrl + '/' + module + '/' + (subNav ? (subNav + '.php') : 'index.php') + '?module=' + encodeURIComponent(module); return false; } function pdInitAccountModuleContent(){ if (pdGetAccountIntegrationModel() !== 'classic') { pdLog('pdPageScript2025: skipping classic account init for B2B model'); insertDivUnderH1(); return; } pdLog('pdPageScript2025: DOMContentLoaded fired'); const urlParams = new URLSearchParams(location.search); var navSection = pdGetAccountNavSection(); var activeNavItem = navSection ? navSection.querySelector('.is-active') : document.querySelector('.navBar-section .is-active'); var prevLinkElem = activeNavItem ? activeNavItem.dataset.pdLinkElem : null; var prevLinkTarget = activeNavItem ? activeNavItem.dataset.pdLinkElemTarget : null; if (prevLinkElem && prevLinkTarget) { var prevTargetElem = document.querySelector(prevLinkTarget); if (prevTargetElem) { prevTargetElem.innerHTML = prevLinkElem; } delete activeNavItem.dataset.pdLinkElem; delete activeNavItem.dataset.pdLinkElemTarget; } if (urlParams.has('pd_module_content')){ pdLog('pdPageScript2025: pd_module_content detected:', urlParams.get('pd_module_content')); pdLog('pdPageScript2025: pd_module_subNav:', urlParams.get('pd_module_subNav')); var module = urlParams.get('pd_module_content'); var subNav = urlParams.get('pd_module_subNav'); var moduleLink = document.querySelector('#pdContent_'+module+' a'); var moduleTitle = moduleLink ? moduleLink.innerHTML : ''; var currentUrl = window.location.href; var currentUrlNoQuery = currentUrl.substring(0, currentUrl.indexOf('?')); pdLog(currentUrlNoQuery); navSection = pdGetAccountNavSection(); activeNavItem = navSection ? navSection.querySelector('.is-active') : document.querySelector('.navBar-section .is-active'); var currentTab = activeNavItem ? activeNavItem.innerHTML : ''; if (activeNavItem && activeNavItem.classList.contains('pdLinkEvent') == false){ if(activeNavItem.querySelector('.navBar-action')){ } else { activeNavItem.innerHTML = ''+currentTab+''; } } if (activeNavItem) { activeNavItem.dataset.pdLinkElemTarget = '#pdContent_'+module; var moduleItem = document.querySelector('#pdContent_'+module); activeNavItem.dataset.pdLinkElem = moduleItem ? moduleItem.innerHTML : ''; } var moduleItem = document.querySelector('#pdContent_'+module); if (moduleItem) { moduleItem.innerHTML = moduleLink ? moduleLink.textContent : ''; } if (activeNavItem) { activeNavItem.classList.remove('is-active'); } if (moduleItem) { moduleItem.classList.add('is-active'); } var pageHeading = document.querySelector('.page-heading'); if (pageHeading) { pageHeading.innerHTML = moduleTitle; } if (subNav !== '' && subNav !== null){ url = pdPublicUrl+'/'+module+'/'+subNav+'.php?module='+module; } else { url = pdPublicUrl+'/'+module+'/index.php?module='+module; } pdLog('pdPageScript2025: calling pdOneAjaxLinkHandler with URL:', url); pdOneAjaxLinkHandler(url); } insertDivUnderH1(); } var __pdAccountNavSection = null; function pdGetAccountNavSection() { if (__pdAccountNavSection && document.contains(__pdAccountNavSection)) { return __pdAccountNavSection; } __pdAccountNavSection = document.querySelector('.navBar-section'); return __pdAccountNavSection; } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', pdInitAccountModuleContent); document.addEventListener('DOMContentLoaded', pdBindAccountUrlWatcher); } else { pdInitAccountModuleContent(); pdBindAccountUrlWatcher(); } document.addEventListener('submit', function(e) { if (!e.target || typeof e.target.closest !== 'function') { return; } var form = e.target.closest('.pdModal form'); if (!form) { return; } e.preventDefault(); e.stopImmediatePropagation(); pdOneAjaxFormHandler(form); }, true); document.addEventListener('submit', function(e) { if (!e.target || typeof e.target.closest !== 'function') { return; } var form = e.target.closest('#pdModuleContent form'); if (!form) { return; } e.preventDefault(); e.stopImmediatePropagation(); pdOneAjaxFormHandler(form); }, true); document.addEventListener('click', function(e) { if (!e.target || typeof e.target.closest !== 'function') { return; } var link = e.target.closest('.pdLinkEvent'); if (!link) { return; } var currentUrl = window.location.href; var navSection = pdGetAccountNavSection(); activeNavItem = navSection ? navSection.querySelector('.is-active') : document.querySelector('.navBar-section .is-active'); var activeNavAction = activeNavItem ? activeNavItem.querySelector('.navBar-action') : null; var currentTab = activeNavAction ? activeNavAction.innerHTML : (activeNavItem ? activeNavItem.innerHTML : ''); pdLog(link.innerHTML); if (activeNavItem && activeNavItem.classList.contains('pdLinkEvent') == false){ activeNavItem.innerHTML = ''+currentTab+''; } if (activeNavItem) { activeNavItem.classList.remove('is-active'); } if (link.parentElement) { link.parentElement.classList.add('is-active'); } var pageHeading = document.querySelector('.page-heading'); if (pageHeading) { var linkText = (link.textContent || '').trim(); pageHeading.textContent = linkText || pageHeading.textContent; } var url = link.getAttribute('href'); e.preventDefault(); e.stopImmediatePropagation(); pdOneAjaxLinkHandler(url); }); document.addEventListener('click', function(e) { if (!e.target || typeof e.target.closest !== 'function') { return; } var link = e.target.closest('a[href*="pd_module_content=mod_myRewards"]'); if (!link) { return; } var pageHeading = document.querySelector('.page-heading'); if (!pageHeading) { return; } var linkText = (link.textContent || '').trim(); if (!linkText) { var rewardsCached = pdNavCacheGet('pdNavRewards:v5'); if (rewardsCached && rewardsCached.title) linkText = rewardsCached.title; } pageHeading.textContent = linkText || pageHeading.textContent; }); document.addEventListener('click', function(e) { if (!e.target || typeof e.target.closest !== 'function') { return; } var link = e.target.closest('#pdModuleContent a'); if (!link) { return; } var url = link.getAttribute('href'); link.setAttribute("href", "#"); e.preventDefault(); pdOneAjaxLinkHandler(url); }); function pdShowRewardsLoadError(message){ var accountContent = pdGetAccountContentContainer(); if (!accountContent) { return; } var safeMessage = message || 'Rewards could not be loaded.'; accountContent.innerHTML = '