Jump to content

MediaWiki:Common.js: Difference between revisions

From Impact Evaluation Foundation
No edit summary
No edit summary
Line 41: Line 41:
})();
})();


document.querySelector(".mw-logo-wordmark").textContent = "test";
document.querySelector(".mw-logo-wordmark").textContent = "Measure, Verify, Report, Repeat";

Revision as of 07:09, 7 January 2025


(function () {
    // Check if the notification was shown within the last 30 days
    const lastShown = localStorage.getItem('bookBannerLastShown');
    const now = new Date().getTime();
    const ONE_MONTH = 30 * 24 * 60 * 60 * 1000;

    if (lastShown && now - lastShown < ONE_MONTH) {
        return; // Do not show the banner
    }

    // Function to display the popup
    const showPopup = () => {
        // Create the popup element
        const bannerHTML = `
            <div id="book-banner-popup" class="book-banner-popup">
                <h3>Subscribe to our newsletter for a free eBook, Regenaissance: The Call to Heal by Sharon Gal-Or, and expert MRV insights delivered to your inbox!</h3>
                <div>
                    <a href="https://iefwiki.substack.com/embed/" target="_blank" class="book-banner-link" style="color: #121212;">Click to Subscribe</a>
                </div>
                <button id="book-banner-close" class="book-banner-close">×</button>
            </div>
        `;
        const container = document.createElement('div');
        container.innerHTML = bannerHTML;
        document.body.appendChild(container);

        // Set display to block to ensure the popup is visible
        const bannerPopup = document.getElementById('book-banner-popup');
        bannerPopup.style.display = 'block';

        // Add event listener for the close button
        document.getElementById('book-banner-close').addEventListener('click', function () {
            bannerPopup.style.display = 'none';
            localStorage.setItem('bookBannerLastShown', new Date().getTime());
        });
    };

    // Delay the popup display by 5 seconds
    setTimeout(showPopup, 5000);
})();

document.querySelector(".mw-logo-wordmark").textContent = "Measure, Verify, Report, Repeat";