facetwp updated facetwp-template visible

<?php
/** update check for facets in url for use with direct links with vars in url
 ** https://facetwp.com/how-to-hide-the-template-until-facets-are-selected/
 **/
add_action( 'wp_footer', function() { ?>
    <script>
        (function($) {
            $(document).on('facetwp-loaded', function() {
                if ( !FWP.loaded && '' != FWP.build_query_string() ) {
                    $('.facetwp-template').addClass('visible');
                } 
            });
        })(jQuery);
    </script>
<?php }, 10, 2 );