in frontend/src/route.js [61:93]
export function monitorOptions(currentData) {
// Monitor input & select changes
const fields = document.querySelectorAll("input, select, a.scroll");
for (const field of fields) {
if (field.classList.contains("scroll")) {
// On a scroll event, update display without any data loading
field.onclick = async (evt) => {
evt.preventDefault();
updateRouteImmediate(evt.target.hash, currentData);
};
} else if (field.type === "text") {
// React on enter
field.onkeydown = async (evt) => {
if (evt.keyCode === 13) {
const params = {};
params[evt.target.name] = evt.target.value;
updateRoute(params);
}
};
} else {
// React on change
field.onchange = async (evt) => {
let value = evt.target.value;
if (evt.target.type === "checkbox") {
value = evt.target.checked ? "on" : "off";
}
const params = {};
params[evt.target.name] = value;
updateRoute(params);
};
}
}
}