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