This commit is contained in:
2023-09-05 21:03:18 +00:00
parent cbfc6be0e9
commit fe4c0bebfc
13 changed files with 346 additions and 310 deletions

33
frontend/logbook.ts Normal file
View File

@ -0,0 +1,33 @@
/*document.addEventListener('DOMContentLoaded', function() {
setDistance('.set-distance-js');
});
function setDistance(selector: string) {
const fields = document.querySelectorAll(selector);
if(fields) {
Array.prototype.forEach.call(fields, (field: HTMLInputElement) => {
if(field.dataset.relation){
const relatedField = <HTMLInputElement>document.getElementById(field.dataset.relation);
if(relatedField) {
field.addEventListener('input', (e) => {
e.preventDefault();
const dataList = <HTMLDataListElement>document.getElementById('destinations');
if(dataList) {
var option = Array.prototype.find.call(dataList.options, function(option) {
return option.value === field.value;
});
// Get distance
const distance = option.getAttribute('distance');
if(distance) relatedField.value = distance;
}
});
}
}
});
}
}
*/
export {}