Skip to content

Commit

Permalink
Additional fixes around versioning.
Browse files Browse the repository at this point in the history
  • Loading branch information
MayaKirova committed Nov 10, 2023
1 parent 2efafea commit 801d2a8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/assets/js/src/versioning/tag-versions.req.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(function () {
const versionsJson = $('body').data('api-versions-json');
const defaultUrl = $('body').data('default-url');
const defaultUrl = $('body').attr('default-url');
$.ajax({
url: versionsJson,
type: "get",
Expand All @@ -14,18 +14,19 @@

folders = folders.reverse();
folders.forEach(function (f) {
const versionUrl = defaultUrl.replace("typescript/latest'", f + "/typescript")
const versionUrl = defaultUrl.replace("typescript/latest", f + "/typescript");
select.append($('<option>', {
value: versionUrl,
text: f
}));
});

const version = folders.filter(function(v){ return window.location.href.indexOf(v) >= 0;})[0];
const version = folders.filter(function(v){ return window.location.href.indexOf(v) >= 0;})[0] || folders[0];
const currentVersionUrl = defaultUrl.replace("typescript/latest", version + "/typescript");
if (version) {
select.val(versionUrl);
select.val(currentVersionUrl);
} else {
select.val(versionUrl);
select.val(currentVersionUrl);
}
});

Expand Down

0 comments on commit 801d2a8

Please sign in to comment.