From 12532dc913bf55d840dbf3e2c70a98de6d979fb5 Mon Sep 17 00:00:00 2001 From: XhmikosR <xhmikosr@gmail.com> Date: Tue, 26 Mar 2019 12:49:45 +0200 Subject: [PATCH] Remove `http` from docs search. (#28557) We use only `https` for a few months now. --- site/docs/4.3/assets/js/src/search.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/site/docs/4.3/assets/js/src/search.js b/site/docs/4.3/assets/js/src/search.js index 459d412df9..dd2a90e587 100644 --- a/site/docs/4.3/assets/js/src/search.js +++ b/site/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 }) }()) -- GitLab