Skip Navigation Website Accessibility
/* ========================================================== Gwinnett Discount Music Store Policies + Privacy Policy Page JavaScript ========================================================== */ (function () { "use strict"; function initializePolicyPages() { /* ---------------------------------------------- PRIVACY POLICY PAGE ---------------------------------------------- */ var privacyPage = document.querySelector(".gdm-privacy-page"); if (privacyPage) { privacyPage.classList.add("gdm-policy-ready"); var privacySections = privacyPage.querySelectorAll(".gdm-privacy-section"); privacySections.forEach(function (section) { section.setAttribute("role", "region"); var heading = section.querySelector("h2"); if (heading) { if (!heading.id) { heading.id = createPolicyId(heading.textContent); } section.setAttribute( "aria-labelledby", heading.id ); } }); } /* ---------------------------------------------- STORE POLICIES PAGE ---------------------------------------------- */ var storePolicyPage = document.querySelector(".gdm-policy-page"); /* * Fallback: * If the class was not added manually, locate the * Store Policies heading and apply the class to its * nearest containing div. */ if (!storePolicyPage) { var pageHeadings = document.querySelectorAll("h1"); pageHeadings.forEach(function (heading) { var headingText = heading.textContent.trim().toLowerCase(); if (headingText === "store policies") { var wrapper = heading.closest("div"); if (wrapper) { wrapper.classList.add("gdm-policy-page"); storePolicyPage = wrapper; } } }); } if (storePolicyPage) { storePolicyPage.classList.add("gdm-policy-ready"); var storeTitle = storePolicyPage.querySelector("h1"); if (storeTitle) { storeTitle.classList.add("gdm-policy-title"); } var storeSections = storePolicyPage.querySelectorAll("section"); storeSections.forEach(function (section) { section.classList.add("gdm-policy-section"); section.setAttribute("role", "region"); var heading = section.querySelector("h2"); if (heading) { if (!heading.id) { heading.id = createPolicyId( heading.textContent ); } section.setAttribute( "aria-labelledby", heading.id ); } }); } /* ---------------------------------------------- EMAIL AND PHONE LINKS ---------------------------------------------- */ var policyPages = document.querySelectorAll( ".gdm-policy-page, .gdm-privacy-page" ); policyPages.forEach(function (page) { /* * Prevent theme scripts from forcing policy * links to open in a new tab. */ var contactLinks = page.querySelectorAll( 'a[href^="mailto:"], a[href^="tel:"]' ); contactLinks.forEach(function (link) { link.removeAttribute("target"); }); /* * Adds safe attributes to external links that * are intentionally set to open in a new tab. */ var externalLinks = page.querySelectorAll( 'a[target="_blank"]' ); externalLinks.forEach(function (link) { link.setAttribute( "rel", "noopener noreferrer" ); }); }); } /* * Creates a clean ID for accessibility labels. */ function createPolicyId(text) { var cleanText = String(text || "") .toLowerCase() .trim() .replace(/[^a-z0-9s-]/g, "") .replace(/s+/g, "-") .replace(/-+/g, "-"); return "gdm-policy-" + cleanText; } /* * Run after the initial document loads. */ if (document.readyState === "loading") { document.addEventListener( "DOMContentLoaded", initializePolicyPages ); } else { initializePolicyPages(); } /* * MusicShop360 may finish inserting page-module * content after DOMContentLoaded. This second run * catches delayed content without changing the page. */ window.setTimeout(initializePolicyPages, 400); })();