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

Escape template variables

This commit is contained in:
Unrud 2021-12-05 02:59:43 +01:00
parent 8ff15acd42
commit 43dc53d794
3 changed files with 30 additions and 19 deletions

View file

@ -1,19 +1,14 @@
window.addEventListener("load", function() {
let select = document.querySelector("header .documentBranch select");
while (select.firstChild) {
select.removeChild(select.firstChild);
while (select.length > 0) {
select.remove(0);
}
for (let branch of documentBranches) {
let option = document.createElement("option");
option.textContent = branch;
if (branch === documentBranch) {
option.setAttribute("selected", "");
}
select.prepend(option);
select.add(new Option(branch, branch, branch === documentBranch, branch === documentBranch), 0);
}
select.addEventListener("change", function() {
if (select.value !== documentBranch) {
location.assign(select.value + ".html");
location.assign(encodeURIComponent(select.value + ".html"));
select.value = documentBranch;
}
});