Skip to content

Commit ff84d3b

Browse files
authored
docs: rm docs version selector (#34078)
1 parent 209d760 commit ff84d3b

File tree

1 file changed

+0
-51
lines changed

1 file changed

+0
-51
lines changed

doc/user/layouts/partials/sidebar.html

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
<nav role="navigation" class="sidebar">
55
<ul>
66
<div id="docsearch"></div>
7-
<select id="version-select" class="version-dropdown" style="width: 100%; box-sizing: border-box;">
8-
</select>
9-
<br><br>
107

118
{{ range .Site.Menus.main.ByWeight }}
129
<li class="level-1 {{if .HasChildren }}has-children{{ else }}no-children{{ end }}">
@@ -66,51 +63,3 @@
6663
<svg xmlns="http://www.w3.org/2000/svg" class="ionicon" viewBox="0 0 512 512"><title>Close</title><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M368 368L144 144M368 144L144 368"/></svg>
6764
</button>
6865
</div>
69-
70-
<script>
71-
document.addEventListener('DOMContentLoaded', function () {
72-
const versionSelect = document.getElementById('version-select');
73-
const currentPath = window.location.pathname;
74-
75-
fetch('/docs/versions.json')
76-
.then( response => {
77-
if (!response.ok) {
78-
throw new Error('File not found');
79-
}
80-
return response.json();
81-
})
82-
.catch(() => {
83-
return fetch('{{ .Site.BaseURL }}versions.json')
84-
.then(response => {
85-
if (!response.ok) {
86-
throw new Error('Fallback file not found');
87-
}
88-
return response.json();
89-
});
90-
})
91-
.then(versions => {
92-
versions.forEach(version => {
93-
const option = document.createElement('option');
94-
option.value = version.base_url;
95-
option.textContent = version.name;
96-
versionSelect.appendChild(option);
97-
});
98-
99-
const currentVersion = versions.filter(version => currentPath.includes(version.base_url))?.at(-1)?.base_url;
100-
101-
if (currentVersion) {
102-
versionSelect.value = currentVersion;
103-
}
104-
105-
versionSelect.addEventListener('change', function () {
106-
const baseUrl = '{{ .Site.BaseURL }}';
107-
const strippedBaseUrl = baseUrl.endsWith(currentVersion) ? baseUrl.slice(0, -currentVersion.length) : baseUrl;
108-
const selectedBaseUrl = strippedBaseUrl + versionSelect.value;
109-
if (selectedBaseUrl) {
110-
window.location.href = selectedBaseUrl;
111-
}
112-
});
113-
})
114-
.catch(error => console.error('Error fetching versions:', error));
115-
});
116-
</script>

0 commit comments

Comments
 (0)