mirror of
https://github.com/GTFOBins/GTFOBins.github.io
synced 2025-08-23 09:34:56 +02:00
Clear filter by pressing escape
This commit is contained in:
@@ -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
|
||||||
|
Reference in New Issue
Block a user