smon/static/js/datapoint_edit.mjs

20 lines
379 B
JavaScript
Raw Normal View History

2024-04-30 08:04:16 +02:00
export class UI {
constructor() {
document.addEventListener('keydown', evt=>this.keyHandler(evt))
document.querySelector('input[name="name"]').focus()
}
keyHandler(evt) {
if (!(evt.altKey && evt.shiftKey))
return
evt.preventDefault()
evt.stopPropagation()
switch (evt.key) {
case 'S':
document.getElementById('form-trigger').submit()
break
}
}
}