ctrl alt shift keys filter
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
ale 2024-09-21 22:44:41 +02:00
parent 3f77fbd93d
commit e83f796413

View File

@ -6,18 +6,28 @@ document.addEventListener('DOMContentLoaded', function () {
ac = undefined,
last = undefined
document.getElementById('instance').addEventListener('keydown', function (event) {
if (event.key && ((event.key.length === 1 && /[a-z0-9.\-*:]/i.test(event.key)) || (event.key === 'Backspace' && event.target.value !== ''))) {
last = event.target.value
} else if (event.key === 'Backspace' && event.target.value === '') {
last = ''
if (event.key && !event.ctrlKey && !event.altKey && !event.shiftKey) {
if ((event.key.length === 1 && /[a-z0-9.\-*:]/i.test(event.key)) || (event.key === 'Backspace' && event.target.value !== '')) {
last = event.target.value
} else if (event.key === 'Backspace' && event.target.value === '') {
last = ''
} else {
event.preventDefault()
event.stopPropagation()
}
} else {
event.preventDefault()
event.stopPropagation()
}
})
document.getElementById('instance').addEventListener('keyup', function (event) {
if (event.key && ((event.key.length === 1 && /[a-z0-9.\-*:]/i.test(event.key)) || (event.key === 'Backspace' && last !== ''))) {
keypress(event, event.target.value)
if (event.key && !event.ctrlKey && !event.altKey && !event.shiftKey) {
if ((event.key.length === 1 && /[a-z0-9.\-*:]/i.test(event.key)) || (event.key === 'Backspace' && event.target.value !== '')) {
keypress(event, event.target.value)
} else {
event.preventDefault()
event.stopPropagation()
}
} else {
event.preventDefault()
event.stopPropagation()