mirror of
https://github.com/GTFOBins/GTFOBins.github.io
synced 2025-01-12 15:01:51 +01:00
Clear filter by pressing escape
This commit is contained in:
parent
a108890c1f
commit
4093161262
@ -66,12 +66,19 @@
|
||||
filter(query);
|
||||
});
|
||||
|
||||
// focus search box on keydown
|
||||
// handle shortcuts
|
||||
addEventListener('keydown', function (event) {
|
||||
// focus search box on valid keydown
|
||||
if (event.key.toLowerCase().match(/^[\/a-z]$/) &&
|
||||
!(event.ctrlKey || event.altKey || event.metaKey)) {
|
||||
searchBox.focus();
|
||||
}
|
||||
// clear filter on escape
|
||||
else if (event.key === 'Escape') {
|
||||
searchBox.value = '';
|
||||
searchBox.focus();
|
||||
filter('');
|
||||
}
|
||||
});
|
||||
|
||||
// filter on load according to the URL
|
||||
|
Loading…
Reference in New Issue
Block a user