From b85730b7a093cab2e14651539b265062bef9656d Mon Sep 17 00:00:00 2001 From: Yang Shi Date: Thu, 18 Jun 2020 14:53:28 -0700 Subject: [PATCH] add version check on installation guide --- docs/static_site/src/assets/js/options.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/static_site/src/assets/js/options.js b/docs/static_site/src/assets/js/options.js index e495f167381e..e71e2833e5b1 100644 --- a/docs/static_site/src/assets/js/options.js +++ b/docs/static_site/src/assets/js/options.js @@ -22,6 +22,10 @@ */ $(document).ready(function () { + const dropdownVersions = $("#version-dropdown-container ul li") + .toArray() + .map((li) => li.innerText); + function label(lbl) { lbl = lbl.replace(/[ .]/g, '-').toLowerCase(); @@ -33,6 +37,9 @@ $(document).ready(function () { let searchParams = searchString.substring(1).split("&"); searchParams.forEach(function (element) { kvPair = element.split("="); + if (kvPair[0] === 'version' && dropdownVersions.indexOf(kvPair[1]) == -1) { + kvPair[1] = dropdownVersions[0]; + } searchDict.set(kvPair[0], kvPair[1]); }); return searchDict;