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

17 lines
553 B
JavaScript
Raw Normal View History

2022-07-28 16:20:55 +02:00
window.addEventListener("DOMContentLoaded", function() {
function resetSelect(select) {
for (let option of select.options) {
option.selected = option.defaultSelected;
}
}
let select = document.querySelector("header .documentBranch select");
resetSelect(select);
select.addEventListener("change", function() {
let option = select.selectedOptions.item(0);
if (option && !option.defaultSelected) {
location.assign(option.value);
}
resetSelect(select);
});
});