Skip to content

Commit 78dfe34

Browse files
committed
Combine latest and 5.0 entries in the switcher
1 parent 2003936 commit 78dfe34

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

docs/js/custom.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
let jquery = jQuery;
33

44
$(document).ready(function() {
5+
const latestVersionNumber = '5.0';
6+
57
// replace edit url
68
let branchName = 'master';
79
const branchNameRegexp = /\/en\/([a-z0-9-_.]*)\//g.exec(document.location.href);
@@ -63,6 +65,14 @@ $(document).ready(function() {
6365
$(this).detach().prependTo(vl);
6466
});
6567
}
68+
69+
// Merge "X.Y" and "latest" entries into "X.Y (latest)"
70+
const latestVersion = allVersions.find(v => v.textContent.trim() === 'latest');
71+
const versionXY = allVersions.find(v => v.textContent.trim() === latestVersionNumber);
72+
73+
const versionXYLink = versionXY.querySelector('a');
74+
versionXYLink.textContent = `${latestVersionNumber} (latest)`;
75+
latestVersion.remove();
6676
}
6777
}, 300);
6878
setTimeout(function() {

0 commit comments

Comments
 (0)