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
2020-04-04 15:30:03 +02:00

20 lines
693 B
JavaScript

window.addEventListener("load", function() {
let select = document.querySelector("header .documentBranch select");
while (select.firstChild) {
select.removeChild(select.firstChild);
}
for (let branch of documentBranches) {
let option = document.createElement("option");
option.textContent = branch;
if (branch === documentBranch) {
option.setAttribute("selected", "");
}
select.prepend(option);
}
select.addEventListener("change", function() {
if (select.value !== documentBranch) {
location.assign(select.value + ".html");
select.value = documentBranch;
}
});
});