Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
1.8 kB
3
Indexable
Never
document.addEventListener('DOMContentLoaded', function () {
    console.log('Document is ready');

    // Set delay time in milliseconds (1 minute = 60000 ms)
    var delay = 60000; // 1 minute delay
    var retryInterval = 3000; // Retry every 3 seconds if Elementor Pro is not yet loaded

    // Function to check if Elementor Pro and the popup module are loaded
    function checkAndTriggerPopup() {
        console.log('Checking if Elementor Pro is loaded...');
        if (typeof elementorPro !== 'undefined') {
            console.log('Elementor Pro is loaded.');
            if (typeof elementorPro.modules !== 'undefined' && typeof elementorPro.modules.popup !== 'undefined') {
                console.log('Elementor popup module is loaded.');
                console.log('Triggering Elementor popup with ID 56539...');
                try {
                    elementorPro.modules.popup.showPopup({ id: 56539 }); // Updated Popup ID
                } catch (e) {
                    console.error('Error showing popup:', e);
                }
            } else {
                console.log('Elementor popup module not loaded yet. Retrying...');
                setTimeout(checkAndTriggerPopup, retryInterval);
            }
        } else {
            console.log('Elementor Pro is not loaded yet. Retrying...');
            setTimeout(checkAndTriggerPopup, retryInterval);
        }
    }

    // Function to start checking for Elementor Pro after a delay
    function startChecking() {
        console.log('Starting the check for Elementor Pro...');
        setTimeout(function () {
            console.log('1-minute delay reached. Checking for Elementor...');
            checkAndTriggerPopup();
        }, delay);
    }

    startChecking();
});
Leave a Comment