aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/twbs/bootstrap/site/assets/js/search.js
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/twbs/bootstrap/site/assets/js/search.js')
-rw-r--r--vendor/twbs/bootstrap/site/assets/js/search.js46
1 files changed, 20 insertions, 26 deletions
diff --git a/vendor/twbs/bootstrap/site/assets/js/search.js b/vendor/twbs/bootstrap/site/assets/js/search.js
index d88263d3f..9bad2749f 100644
--- a/vendor/twbs/bootstrap/site/assets/js/search.js
+++ b/vendor/twbs/bootstrap/site/assets/js/search.js
@@ -2,49 +2,43 @@
// IT'S ALL JUST JUNK FOR OUR DOCS!
// ++++++++++++++++++++++++++++++++++++++++++
-(function () {
+(() => {
'use strict'
- var inputElement = document.getElementById('search-input')
+ const searchElement = document.getElementById('docsearch')
- if (!window.docsearch || !inputElement) {
+ if (!window.docsearch || !searchElement) {
return
}
- var siteDocsVersion = inputElement.getAttribute('data-bd-docs-version')
-
- document.addEventListener('keydown', function (event) {
- if (event.ctrlKey && event.key === '/') {
- event.preventDefault()
- inputElement.focus()
- }
- })
+ const siteDocsVersion = searchElement.getAttribute('data-bd-docs-version')
window.docsearch({
- apiKey: '5990ad008512000bba2cf951ccf0332f',
+ apiKey: '3151f502c7b9e9dafd5e6372b691a24e',
indexName: 'bootstrap',
- inputSelector: '#search-input',
- algoliaOptions: {
- facetFilters: ['version:' + siteDocsVersion]
+ appId: 'AK7KMZKZHQ',
+ container: searchElement,
+ searchParameters: {
+ facetFilters: [`version:${siteDocsVersion}`]
},
- transformData: function (hits) {
- return hits.map(function (hit) {
- var liveUrl = 'https://getbootstrap.com/'
+ transformItems(items) {
+ return items.map(item => {
+ const liveUrl = 'https://getbootstrap.com/'
- hit.url = window.location.origin.startsWith(liveUrl) ?
+ item.url = window.location.origin.startsWith(liveUrl) ?
// On production, return the result as is
- hit.url :
- // On development or Netlify, replace `hit.url` with a trailing slash,
+ item.url :
+ // On development or Netlify, replace `item.url` with a trailing slash,
// so that the result link is relative to the server root
- hit.url.replace(liveUrl, '/')
+ item.url.replace(liveUrl, '/')
// Prevent jumping to first header
- if (hit.anchor === 'content') {
- hit.url = hit.url.replace(/#content$/, '')
- hit.anchor = null
+ if (item.anchor === 'content') {
+ item.url = item.url.replace(/#content$/, '')
+ item.anchor = null
}
- return hit
+ return item
})
},
// Set debug to `true` if you want to inspect the dropdown