diff options
| author | XhmikosR <[email protected]> | 2018-11-22 21:13:15 +0200 |
|---|---|---|
| committer | XhmikosR <[email protected]> | 2018-12-10 11:08:34 +0200 |
| commit | dd23bb5c1207123d581794323311f6d1e369b97d (patch) | |
| tree | b29d9233edfe748a5c125ace42c1fb61bbedf8bc | |
| parent | 9edba6123e8689dba1c159eaa16f0455b3beddb2 (diff) | |
| download | bootstrap-dd23bb5c1207123d581794323311f6d1e369b97d.tar.xz bootstrap-dd23bb5c1207123d581794323311f6d1e369b97d.zip | |
Backport search.js changes from v4-dev.
| -rw-r--r-- | docs/assets/js/src/search.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/docs/assets/js/src/search.js b/docs/assets/js/src/search.js index 53fec2a70..72b1ec71a 100644 --- a/docs/assets/js/src/search.js +++ b/docs/assets/js/src/search.js @@ -28,12 +28,6 @@ apiKey: 'c8948afa20e6437a6e829f7e87b9ac11', indexName: 'bootstrap-v3', inputSelector: '#search-input', - handleSelected: function (input, event, suggestion) { - var url = suggestion.url - url = suggestion.isLvl1 ? url.split('#')[0] : url - // If it's a title we remove the anchor so it does not jump. - window.location.href = url - }, transformData: function (hits) { return hits.map(function (hit) { var siteurl = getOrigin() @@ -43,6 +37,12 @@ // 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 }) }, |
