We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 96be946 commit c0a4553Copy full SHA for c0a4553
1 file changed
docs/assets/js/scripts.js
@@ -1,6 +1,8 @@
1
document.addEventListener("DOMContentLoaded", function() {
2
- const base_url = window.location.pathname.split('/')[1];
3
- const json_url = '/' + base_url + "/versions.json";
+ const path = window.location.pathname;
+ const match = path.match(/(.*\/)(?:v?\d+\.\d+|latest)\//);
4
+ const base_path = match ? match[1] : path.substring(0, path.lastIndexOf('/') + 1);
5
+ const json_url = `${base_path}versions.json`;
6
const stargazers_element = document.querySelector('header div div:nth-child(3) a');
7
8
if (!stargazers_element) {
0 commit comments