facetwp auto enable filtering button on map

<?php
/**
 ** enable filtering on load of map
 **/
add_action( 'wp_footer', function() {
	?>
    <script>
        (function($) {
            $(document).on('facetwp-loaded', function() {
                var filterButton = $( ".facetwp-map-filtering" );
                if ( !filterButton.hasClass('enabled') && 'undefined' == typeof FWP_MAP.enableFiltering ) {
                    filterButton.text(FWP_JSON['map']['resetText']);
                    FWP_MAP.is_filtering = true;
                    filterButton.addClass('enabled');
                    FWP_MAP.enableFiltering = true;
                }
            });
        })(jQuery);
    </script>
	<?php
}, 100 );