Skip to main content

hide subteasers in related content UNLESS it has a specific title

<script>
document.addEventListener("DOMContentLoaded", function() {
    const secondArticle = document.querySelector("#page-content > div > div > div > div > div.col-md-3 > section > div > div > article:nth-child(2)");

    if (secondArticle) {
        // Traverse upward to look for the nearest preceding h3
        let current = secondArticle;
        let foundHeading = null;

        while (current && current !== document) {
            const previous = current.previousElementSibling;
            if (previous && previous.tagName === "H3") {
                foundHeading = previous;
                break;
            }
            current = current.parentElement;
        }

        // Hide thumbnails UNLESS the heading is "Meet the Team"
        const isMeetTheTeam = foundHeading && foundHeading.textContent.trim().toLowerCase() === "meet the team";

        if (!isMeetTheTeam) {
            const thumbnails = secondArticle.querySelectorAll(".subteaser-thumbnails");
            thumbnails.forEach(thumb => {
                thumb.style.display = "none";
            });
        }
    }
});
</script>