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

16 lines
573 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");
2021-12-05 02:59:43 +01:00
while (select.length > 0) {
select.remove(0);
}
for (let branch of documentBranches) {
2021-12-05 02:59:43 +01:00
select.add(new Option(branch, branch, branch === documentBranch, branch === documentBranch), 0);
}
select.addEventListener("change", function() {
if (select.value !== documentBranch) {
2021-12-05 02:59:43 +01:00
location.assign(encodeURIComponent(select.value + ".html"));
select.value = documentBranch;
}
});
});