Showing 85–93 of 93 results

' ).replace( /__\/ais-highlight__/g, '' ); } for ( var key in hit._snippetResult ) { /* We do not deal with arrays. */ if ( typeof hit._snippetResult[ key ].value !== 'string' ) { continue; } hit._snippetResult[ key ].value = _.escape( hit._snippetResult[ key ].value ); hit._snippetResult[ key ].value = hit._snippetResult[ key ].value.replace( /__ais-highlight__/g, '' ).replace( /__\/ais-highlight__/g, '' ); } return suggestion_template( hit ); } } } ); } ); /* Setup dropdown menus */ document.querySelectorAll( algolia.autocomplete.input_selector ).forEach( function( element ) { var config = { debug: algolia.debug, hint: false, openOnFocus: true, appendTo: 'body', templates: { empty: wp.template( 'autocomplete-empty' ) } }; if ( algolia.powered_by_enabled ) { config.templates.footer = wp.template( 'autocomplete-footer' ); } /* Instantiate autocomplete.js */ var autocomplete = algoliaAutocomplete( element, config, sources ) .on( 'autocomplete:selected', function ( e, suggestion ) { /* Redirect the user when we detect a suggestion selection. */ window.location.href = suggestion.permalink ?? suggestion.posts_url; // Users use the `posts_url` property instead of `permalink`. } ); /* Force the dropdown to be re-drawn on scroll to handle fixed containers. */ window.addEventListener( 'scroll', function() { if ( autocomplete.autocomplete.getWrapper().style.display === "block" ) { autocomplete.autocomplete.close(); autocomplete.autocomplete.open(); } } ); } ); var algoliaPoweredLink = document.querySelector( '.algolia-powered-by-link' ); if ( algoliaPoweredLink ) { algoliaPoweredLink.addEventListener( 'click', function( e ) { e.preventDefault(); window.location = "https://www.algolia.com/?utm_source=WordPress&utm_medium=extension&utm_content=" + window.location.hostname + "&utm_campaign=poweredby"; } ); } });