Skip to content

Commit

Permalink
Merge pull request openshift#14898 from vikram-redhat/enterprise-4.1
Browse files Browse the repository at this point in the history
[enterprise-4.1] updating page-loader.js
  • Loading branch information
vikram-redhat authored May 17, 2019
2 parents a387cb3 + 8cc2a71 commit 2139ecf
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions _javascripts/page-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 2139ecf

Please sign in to comment.