mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Set focus tp Global Search form if user presses Ctrl-F (#14947)
This commit is contained in:
@@ -760,4 +760,22 @@
|
||||
});
|
||||
}
|
||||
@endif
|
||||
|
||||
$(document).ready(function(){
|
||||
// Function to focus Global Search on Ctrl-F
|
||||
window.addEventListener("keydown",function (e) {
|
||||
if (e.keyCode === 114 || (e.ctrlKey && e.keyCode === 70)){
|
||||
if($('#gsearch').is(":focus")) {
|
||||
//allow normal Ctrl-F on a 2nd Hit
|
||||
return true;
|
||||
} else {
|
||||
//set Focus on Global Search and ignore Browsers defaults
|
||||
e.preventDefault();
|
||||
$('#gsearch').focus();
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user