Skip to main content

Automatically skips the "Next" confirmation button for a faster UI

See it in action here: https://share.1776.cloud/v/cacc6a0a365322e3.gif

This will help with faster "One-Click" Instant Booking feel.

/**
 * Fluent Booking: One-Click Instant Booking
 * Automatically skips the "Next" confirmation button for a faster UI.
 */
add_action('wp_footer', function() {
    ?>
    <script type="text/javascript">
    (function() {
        if (!document.querySelector('.fluent_booking_app')) return;

        document.addEventListener('click', function(e) {
            const timeTrigger = e.target.closest('.fcal_spot_name');
            if (!timeTrigger) return;

            setTimeout(() => {
                const parentSlot = timeTrigger.closest('.fcal_spot');
                const confirmBtn = parentSlot ? parentSlot.querySelector('.fcal_spot_confirm') : null;

                if (confirmBtn) {
                    confirmBtn.click();
                }
            }, 30); // 30ms is the "sweet spot" for most browsers and mobile devices
        }, true);
    })();
    </script>
    <?php
}, 99);

1.00