Fix search (#16522)

This commit is contained in:
Joakim Sørensen 2021-02-12 10:51:57 +01:00 committed by GitHub
parent bbc7312a7e
commit 99a444cdb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 10 deletions

View File

@ -14,3 +14,18 @@ body_id: not_found
<a href='#' class='search404-close'><i class="icon-remove-sign"></i></a>
</div>
</div>
<script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.js"></script>
<script type="text/javascript">
docsearch({
apiKey: '{{ site.algolia.api_key }}',
indexName: 'home-assistant',
inputSelector: '#search404',
debug: false // Set debug to true if you want to inspect the dropdown
});
document.querySelector('.search404-close').addEventListener('click', function(ev) {
ev.preventDefault();
document.querySelector('#search404').value = "";
});
</script>

View File

@ -16,17 +16,7 @@ docsearch({
inputSelector: '#search',
debug: false // Set debug to true if you want to inspect the dropdown
});
docsearch({
apiKey: '{{ site.algolia.api_key }}',
indexName: 'home-assistant',
inputSelector: '#search404',
debug: false // Set debug to true if you want to inspect the dropdown
});
document.querySelector('.search404-close').addEventListener('click', function(ev) {
ev.preventDefault();
document.querySelector('#search404').value = "";
});
document.querySelector('.search .close').addEventListener('click', function(ev) {
ev.preventDefault();
document.querySelector('.search-container').style.display = 'none';