diff options
| author | Mark Otto <[email protected]> | 2019-02-11 11:15:34 -0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2019-02-11 11:15:34 -0800 |
| commit | 1ded0d6a4eefb7daca62c44e4e735aec200f0b6f (patch) | |
| tree | e0036e5068cfb8e2c17971c4e892bd6b502dda9a /site/docs/4.3/assets/js/src/search.js | |
| parent | 3aa0770b711f69c4dcf5858b8913794e81b32d80 (diff) | |
| download | bootstrap-4.3.0.tar.xz bootstrap-4.3.0.zip | |
Release v4.3.0 (#28228)v4.3.0
* Prep for v4.3.0
* More updates for v4.3.0.
* rerun to build docs source map
Diffstat (limited to 'site/docs/4.3/assets/js/src/search.js')
| -rw-r--r-- | site/docs/4.3/assets/js/src/search.js | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/site/docs/4.3/assets/js/src/search.js b/site/docs/4.3/assets/js/src/search.js new file mode 100644 index 000000000..459d412df --- /dev/null +++ b/site/docs/4.3/assets/js/src/search.js @@ -0,0 +1,55 @@ +// NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT +// IT'S ALL JUST JUNK FOR OUR DOCS! +// ++++++++++++++++++++++++++++++++++++++++++ + +(function () { + 'use strict' + + if (!window.docsearch) { + return + } + + var inputElement = document.getElementById('search-input') + var siteDocsVersion = inputElement.getAttribute('data-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 + } + + return origin + } + + window.docsearch({ + apiKey: '5990ad008512000bba2cf951ccf0332f', + indexName: 'bootstrap', + inputSelector: '#search-input', + algoliaOptions: { + facetFilters: ['version:' + siteDocsVersion] + }, + transformData: function (hits) { + return hits.map(function (hit) { + var siteurl = getOrigin() + var urlRE = /^https?:\/\/getbootstrap\.com/ + + // When in production, return the result as is, + // otherwise remove our url from it. + hit.url = siteurl.match(urlRE) ? hit.url : hit.url.replace(urlRE, '') + + // Prevent jumping to first header + if (hit.anchor === 'content') { + hit.url = hit.url.replace(/#content$/, '') + hit.anchor = null + } + + return hit + }) + }, + debug: false // Set debug to true if you want to inspect the dropdown + }) +}()) |
