/**
 * Global features and function handle from this file
 */

/** JS code for loading support link */
(function () {
    const targetHref = 'admin.php?page=cookiemate-help-center';
    const newHref = 'https://brainywp.com/support/';

    function modifyLink() {
        const link = document.querySelector(`a[href="${targetHref}"]`);
        if (link) {
            link.href = newHref;
            link.target = '_blank';
        }
    }

    // Run initially
    modifyLink();

    // Watch for changes in the DOM
    const observer = new MutationObserver(() => {
        modifyLink();
    });

    observer.observe(document.body, {
        childList: true,
        subtree: true
    });
})();
