1
0
Fork 0
mirror of https://github.com/Kozea/Radicale.git synced 2025-06-26 16:45:52 +00:00
Radicale/assets/document-branches.js
2021-12-05 02:59:43 +01:00

15 lines
573 B
JavaScript

window.addEventListener("load", function() {
let select = document.querySelector("header .documentBranch select");
while (select.length > 0) {
select.remove(0);
}
for (let branch of documentBranches) {
select.add(new Option(branch, branch, branch === documentBranch, branch === documentBranch), 0);
}
select.addEventListener("change", function() {
if (select.value !== documentBranch) {
location.assign(encodeURIComponent(select.value + ".html"));
select.value = documentBranch;
}
});
});