Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/assets
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@gmail.com>2018-03-14 20:44:32 +0300
committerXhmikosR <xhmikosr@gmail.com>2018-03-14 22:06:17 +0300
commitb9577a1cf7277b7e7854c3b4ea009e2fed6ea242 (patch)
tree59dc10a85c4f1af1d8e872d0c385f05db313d3e8 /assets
parent483e49e3c6784f4afbc9982c3498151f6f97ee30 (diff)
Alternative solution.
Rely on `site.url` which is different for production. In that case do nothing with the search result, otherwise when in development remove our url from it.
Diffstat (limited to 'assets')
-rw-r--r--assets/js/src/application.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/assets/js/src/application.js b/assets/js/src/application.js
index 2d8b08d1d4..a35202f1df 100644
--- a/assets/js/src/application.js
+++ b/assets/js/src/application.js
@@ -115,8 +115,13 @@
},
transformData: function (hits) {
return hits.map(function (hit) {
- var baseurl = document.getElementById('search-input').getAttribute('data-baseurl')
- hit.url = hit.url.replace('https://getbootstrap.com' + baseurl, baseurl)
+ // When in production, return the result as is,
+ // otherwise remove our url from it.
+ var siteurl = document.getElementById('search-input').getAttribute('data-siteurl')
+ var urlRE = /^https?:\/\/getbootstrap\.com/
+
+ hit.url = siteurl.match(urlRE) ? hit.url : hit.url.replace(urlRE, '')
+
return hit
})
},