20 lines
379 B
JavaScript
20 lines
379 B
JavaScript
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
|
|
}
|
|
}
|
|
}
|