facetwp auto click link when only one result

(function($) {
    $(document).on('facetwp-loaded', function() {
        if (1 === FWP.settings.pager.total_rows ) {
            $('.facetwp-template a:first')[0].click();
        }
    });
})(jQuery);