1
0
Fork 0
mirror of https://github.com/Kozea/Radicale.git synced 2025-06-26 16:45:52 +00:00
Radicale/beta/assets/document-branches.js

21 lines
696 B
JavaScript
Raw Normal View History

window.addEventListener("load", function() {
let select = document.querySelector("header select.documentBranch");
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.appendChild(option);
}
select.addEventListener("change", function() {
if (select.value !== documentBranch) {
location.assign(select.value + ".html");
select.value = documentBranch;
}
});
});