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

21 lines
693 B
JavaScript
Raw Normal View History

window.addEventListener("load", function() {
2020-04-04 15:30:03 +02:00
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", "");
}
2020-02-27 14:18:57 +01:00
select.prepend(option);
}
select.addEventListener("change", function() {
if (select.value !== documentBranch) {
2020-02-27 14:55:03 +01:00
location.assign(select.value + ".html");
select.value = documentBranch;
}
});
});