diff options
author | XhmikosR <xhmikosr@gmail.com> | 2020-11-09 09:48:37 +0300 |
---|---|---|
committer | XhmikosR <xhmikosr@gmail.com> | 2020-11-14 16:54:50 +0300 |
commit | 12f510861bea74a9c865b5a87b27ce958ee38187 (patch) | |
tree | f8a8a9663d96ca24f9ba4a67085e9b7a65edb227 /site/assets | |
parent | eaf616c6538847561cbfd60ce7fc54cea16d8a1b (diff) |
search.js: remove `window.location.origin` workaround
Diffstat (limited to 'site/assets')
-rw-r--r-- | site/assets/js/search.js | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/site/assets/js/search.js b/site/assets/js/search.js index cce2bcd0d1..e198eddb32 100644 --- a/site/assets/js/search.js +++ b/site/assets/js/search.js @@ -20,19 +20,6 @@ } }) - 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', @@ -42,10 +29,9 @@ }, 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, |