algolia.js 825 B

12345678910111213141516171819202122232425262728
  1. (function() {
  2. var doc_version = document.querySelector('meta[name="doc_version"]').getAttribute('content');
  3. // If the current page uses tabs, we will need this small patch
  4. if (typeof(docsearch) == 'undefined') {
  5. docsearch = exports['docsearch'];
  6. }
  7. // Initialize the Algolia search widget
  8. docsearch({
  9. apiKey: 'c39cb614363a2a156811478bc2d0573b',
  10. indexName: 'godotengine',
  11. inputSelector: '#rtd-search-form input[type=text]',
  12. algoliaOptions: {
  13. facetFilters: ["version:" + (doc_version || 'stable')]
  14. },
  15. });
  16. window.addEventListener('keydown', function(event) {
  17. if (event.key === '/') {
  18. document.querySelector('#rtd-search-form input[type=text]').focus();
  19. event.preventDefault();
  20. }
  21. })
  22. })();