mirror of
https://github.com/vale981/ray
synced 2025-03-09 12:56:46 -04:00
29 lines
899 B
JavaScript
29 lines
899 B
JavaScript
docsearch({
|
|
apiKey: '6c42f30d9669d8e42f6fc92f44028596',
|
|
indexName: 'docs-ray',
|
|
appId: 'LBHF0PABBL',
|
|
inputSelector: '#search-input',
|
|
debug: false,
|
|
algoliaOptions: {
|
|
hitsPerPage: 10,
|
|
},
|
|
handleSelected: function (input, event, suggestion, datasetNumber, context) {
|
|
if (context.selectionMethod === 'click') {
|
|
input.setVal('');
|
|
const windowReference = window.open(suggestion.url, "_self");
|
|
windowReference.focus();
|
|
}
|
|
}
|
|
});
|
|
|
|
const searchInput = document.getElementById("search-input");
|
|
searchInput.addEventListener("keydown", function (e) {
|
|
if (e.code === "Enter") {
|
|
var searchForm = document.getElementsByClassName("bd-search")[0];
|
|
|
|
const text = searchInput.value;
|
|
searchForm.action = "https://docs.ray.io/en/latest/search.html?q=" + text;
|
|
|
|
searchForm.submit();
|
|
}
|
|
});
|