jQuery(document).ready(function($) {function disableCompletedTours() {
// Target the specific title class from your HTML
$('.tourmaster-tour-title a').each(function() {
var $link = $(this);
var titleText = $link.text();// Check if title contains [Completed]
if (titleText.indexOf('sold') !== -1) {
// 1. Remove the text "[Completed]" so users don't see it
var cleanTitle = titleText.replace('sold', '').trim();
$link.text(cleanTitle);// 2. Find the main card wrapper (based on your HTML)
var $card = $link.closest('.gdlr-core-item-list');// 3. Apply the disabled state
if ($card.length && !$card.hasClass('tm-disabled-card')) {
$card.addClass('tm-disabled-card');// 5. Inject the badge into the thumbnail area
var $thumb = $card.find('.tourmaster-tour-thumbnail');
if ($thumb.length) {
$thumb.css('position', 'relative');
if ($thumb.find('.tm-completed-overlay').length === 0) {
$thumb.append('
Completed
');
}
}
}
}
});
}// Run immediately
disableCompletedTours();// Run constantly (MutationObserver) to catch AJAX filters/Search
var observer = new MutationObserver(function(mutations) {
disableCompletedTours();
});// Observe the body for any changes
observer.observe(document.body, { childList: true, subtree: true });
});