//test //end Skip to main content

CLA leaving website warning

//leave site warning CLA
<script>
document.addEventListener("DOMContentLoaded", function () {

    // USE THIS TO CONFIGURE LINK OPENING BEHAVIOR.
    // true = load in new tab
    // false = load in same tab
    // There is an issue where when set to true, browsers will consider it a pop-up if you let it count down
    const OPEN_IN_NEW_TAB = true;

    function handleExternalLink(event) {
        event.preventDefault(); // Prevent default link behavior

        let externalUrl = this.dataset.externalHref; // Get the stored URL

        let existingModal = document.getElementById("exit-warning-modal");
        if (existingModal) existingModal.remove();

        let truncatedUrl = externalUrl.length > 30 ? externalUrl.substring(0, 30) + "..." : externalUrl;

        let modal = document.createElement("div");
        modal.id = "exit-warning-modal";
        modal.setAttribute("role", "dialog");
        modal.setAttribute("aria-labelledby", "modal-heading");
        modal.setAttribute("aria-describedby", "modal-message");
        modal.setAttribute("aria-modal", "true");
        modal.style = `
            position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0, 0, 0, 0.5); display: flex; align-items: center;
            justify-content: center; z-index: 9999;
        `;

        modal.innerHTML = `
            <div style="background: white; max-width: 500px; padding: 20px;
                border-radius: 5px; text-align: center; box-shadow: 0 4px 10px rgba(0,0,0,0.2);
                position: relative;">
                <h2 id="modal-heading" style="margin-bottom: 10px;">Leaving Site:
You Are Now Leaving Our Website</h2>
                <p id="modal-message" style="font-size: 16px;">
                  Links to external, or third-party websites, are provided solely for visitors’ convenience. Following links to other sites is done so at your own risk and the owners of this website accept no liability for any linked sites or their content. <br> Any link from our site to an external website does not imply that we endorse or accept any responsibility for its use. It is important for users to take necessary precautions, especially to ensure appropriate safety from viruses, worms, trojans, and other potentially destructive items. Users should review the privacy policies of external websites and other terms of use to learn more about what, why, and how they collect and use any personally identifiable information. <br><strong>
Thank you for visiting and please come again.</strong>
                </p>
                <p id="url-preview" style="font-size: 16px; font-style: italic; color: #595959;"
                    title="${externalUrl}" aria-label="External URL preview: ${externalUrl}">
                    (${truncatedUrl})
                </p>
                <p style="font-size: 16px; font-weight: bold;">You will be redirected in <span id="countdown">10</span> seconds...</p>
                <button id="cancel-exit" style="margin-right: 10px; padding: 8px 12px; background: #ccc; color: black; border: none; cursor: pointer; border-radius: 3px;">Cancel</button>
                <button id="proceed-exit" style="padding: 8px 12px; background: #0056B3; color: white; font-weight: bold; border: none; cursor: pointer; border-radius: 3px;">Proceed</button>
            </div>
        `;

        document.body.appendChild(modal);

        modal.querySelector("#proceed-exit").focus();

        let countdown = 10;
        let countdownInterval = setInterval(function () {
            countdown--;
            document.getElementById("countdown").textContent = countdown;
            if (countdown <= 0) {
                clearInterval(countdownInterval);
                if (OPEN_IN_NEW_TAB) {
                    window.open(externalUrl, "_blank");
                } else {
                    window.location.href = externalUrl;
                }
            }
        }, 1000);

        document.getElementById("cancel-exit").addEventListener("click", function () {
            clearInterval(countdownInterval);
            modal.remove();
        });

        document.getElementById("proceed-exit").addEventListener("click", function () {
            clearInterval(countdownInterval);
            if (OPEN_IN_NEW_TAB) {
                window.open(externalUrl, "_blank");
            } else {
                window.location.href = externalUrl;
            }
        });

        window.addEventListener("focus", function () {
            if (document.visibilityState === "hidden") {
                modal.remove();
                clearInterval(countdownInterval);
            }
        });

        document.addEventListener("keydown", function (e) {
            if (e.key === "Escape") {
                modal.remove();
                clearInterval(countdownInterval);
            }
        }, { once: true });
    }

    function modifyExternalLinks() {
        let links = document.querySelectorAll("a[href]");

        links.forEach(link => {
            let href = link.getAttribute("href");

            if (
                /^https?:\/\//.test(href) &&
                !href.startsWith(window.location.origin) &&
                !link.closest(".cke_dialog") &&
                !/^javascript:/i.test(href)
            ) {
                link.dataset.externalHref = href;
                link.removeAttribute("href"); 
                link.style.cursor = "pointer"; 
                link.addEventListener("click", handleExternalLink);
            }
        });
    }
    modifyExternalLinks();
    const observer = new MutationObserver(modifyExternalLinks);
    observer.observe(document.body, { childList: true, subtree: true });
});
</script>

Join our mailing list
//kill engage //kill engage end //catalog search test begin //catalog search test end