]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Remove `http` from docs search. (#28557)
authorXhmikosR <xhmikosr@gmail.com>
Tue, 26 Mar 2019 10:49:45 +0000 (12:49 +0200)
committerXhmikosR <xhmikosr@gmail.com>
Wed, 27 Mar 2019 19:02:22 +0000 (21:02 +0200)
We use only `https` for a few months now.

docs/assets/js/src/search.js

index 72b1ec71a4ebd4a594dfa7bce3fce9bcb1f7a974..1a3a1691fc39204d63c2aaf5def4c77cc858f630 100644 (file)
     inputSelector: '#search-input',
     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') {
@@ -46,6 +49,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
   })
 }())