]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
search.js: remove `window.location.origin` workaround
authorXhmikosR <xhmikosr@gmail.com>
Mon, 9 Nov 2020 06:48:37 +0000 (08:48 +0200)
committerXhmikosR <xhmikosr@gmail.com>
Sat, 14 Nov 2020 13:54:50 +0000 (15:54 +0200)
site/assets/js/search.js

index cce2bcd0d1141c4b73919657d49cdf6bfa725ecf..e198eddb32992f6da92785c67e8c1ce20b0508af 100644 (file)
     }
   })
 
-  function getOrigin() {
-    var location = window.location
-    var origin = location.origin
-
-    if (!origin) {
-      var port = location.port ? ':' + location.port : ''
-
-      origin = location.protocol + '//' + location.hostname + port
-    }
-
-    return origin
-  }
-
   window.docsearch({
     apiKey: '5990ad008512000bba2cf951ccf0332f',
     indexName: 'bootstrap',
     },
     transformData: function (hits) {
       return hits.map(function (hit) {
-        var currentUrl = getOrigin()
         var liveUrl = 'https://v5.getbootstrap.com/'
 
-        hit.url = currentUrl.startsWith(liveUrl) ?
+        hit.url = window.location.origin.startsWith(liveUrl) ?
           // On production, return the result as is
           hit.url :
           // On development or Netlify, replace `hit.url` with a trailing slash,