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.js21
1 files changed, 7 insertions, 14 deletions
diff --git a/vendor/twbs/bootstrap/site/assets/js/search.js b/vendor/twbs/bootstrap/site/assets/js/search.js
index 724c6aa33..d88263d3f 100644
--- a/vendor/twbs/bootstrap/site/assets/js/search.js
+++ b/vendor/twbs/bootstrap/site/assets/js/search.js
@@ -11,20 +11,14 @@
return
}
- var siteDocsVersion = inputElement.getAttribute('data-docs-version')
+ var siteDocsVersion = inputElement.getAttribute('data-bd-docs-version')
- function getOrigin() {
- var location = window.location
- var origin = location.origin
-
- if (!origin) {
- var port = location.port ? ':' + location.port : ''
-
- origin = location.protocol + '//' + location.hostname + port
+ document.addEventListener('keydown', function (event) {
+ if (event.ctrlKey && event.key === '/') {
+ event.preventDefault()
+ inputElement.focus()
}
-
- return origin
- }
+ })
window.docsearch({
apiKey: '5990ad008512000bba2cf951ccf0332f',
@@ -35,10 +29,9 @@
},
transformData: function (hits) {
return hits.map(function (hit) {
- var currentUrl = getOrigin()
var liveUrl = 'https://getbootstrap.com/'
- hit.url = currentUrl.lastIndexOf(liveUrl, 0) === 0 ?
+ hit.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,