document.addEventListener('DOMContentLoaded', function () {
function blockPopupOnSpecificProductPages() {
var currentUrl = window.location.href;
var popup = document.querySelector('[data-elementor-type="popup"]'); // Target elements with the specified attribute
// List of URLs where popups should be blocked
var blockedUrls = [
'https://texascourtclasses.com/product/anger-management-retake/',
'https://texascourtclasses.com/product/decision-making-class-retake/',
'https://texascourtclasses.com/product/pet-owner-responsibility-class-retake/',
'https://texascourtclasses.com/product/substance-abuse-drug-awareness-class-retake/',
'https://texascourtclasses.com/product/anti-theft-shoplifting-class-retake/',
'https://texascourtclasses.com/product/gun-safety-course-retake/',
'https://texascourtclasses.com/product/alcohol-awareness-class-retake/',
'https://staging.texascourtclasses.com/product/gun-safety-course-retake/'
];
// Check if the current URL is in the blocked URLs list
if (blockedUrls.includes(currentUrl)) {
if (popup) {
popup.style.display = 'none';
}
}
}
blockPopupOnSpecificProductPages(); // Run the function to check and block popup
// Optional: Re-check if navigation within the site happens without full page reloads (e.g., AJAX)
document.addEventListener('pjax:end', blockPopupOnSpecificProductPages); // For sites using PJAX or similar technologies
// Optional: Add an event listener for AJAX complete for more robustness
document.addEventListener('ajaxComplete', blockPopupOnSpecificProductPages); // For sites using AJAX
});