1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00

updating page-loader.js

This commit is contained in:
Vikram Goyal
2019-05-17 15:04:58 +10:00
parent 7348dd503f
commit 8cc2a71645

View File

@@ -6,17 +6,28 @@ function versionSelector(list) {
// the new final link to load
newLink = "";
// the fileRequested
var fileRequested = "";
// spilt the current path
var pathArray = window.location.pathname.split( '/' );
// so we can get the current version
currentVersion = pathArray[2];
// the file path is just the version number + the end of the path
var fileRequested =
window.location.pathname.substring(
window.location.pathname.lastIndexOf(currentVersion) +
currentVersion.length);
// if switching major versions, just take the user to the main landing page
// as files change a lot between major versions.
if(currentVersion.charAt(0) === newVersion.charAt(0)) {
// the file path is just the version number + the end of the path
fileRequested =
window.location.pathname.substring(
window.location.pathname.lastIndexOf(currentVersion) +
currentVersion.length);
} else {
fileRequested = "/welcome/index.html";
}
// alert(fileRequested);