From: XhmikosR Date: Tue, 26 Mar 2019 10:49:45 +0000 (+0200) Subject: Remove `http` from docs search. (#28557) X-Git-Tag: v5.0.0-alpha1~1168 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6672aea5a9f8c21d9419757a782d414c3ac460e4;p=thirdparty%2Fbootstrap.git Remove `http` from docs search. (#28557) We use only `https` for a few months now. --- diff --git a/site/static/docs/4.3/assets/js/src/search.js b/site/static/docs/4.3/assets/js/src/search.js index dc222508d6..fcff6f6371 100644 --- a/site/static/docs/4.3/assets/js/src/search.js +++ b/site/static/docs/4.3/assets/js/src/search.js @@ -34,12 +34,15 @@ }, transformData: function (hits) { return hits.map(function (hit) { - var siteurl = getOrigin() - var urlRE = /^https?:\/\/getbootstrap\.com/ + var currentUrl = getOrigin() + var liveUrl = '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, '') + // eslint-disable-next-line no-negated-condition + hit.url = currentUrl.indexOf(liveUrl) !== -1 ? + hit.url : + hit.url.replace(liveUrl, '') // Prevent jumping to first header if (hit.anchor === 'content') { @@ -50,6 +53,7 @@ return hit }) }, - debug: false // Set debug to true if you want to inspect the dropdown + // Set debug to `true` if you want to inspect the dropdown + debug: false }) })()