mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-08-14.git
synced 2024-08-15 00:53:20 +00:00
Add JS to focus search box on '/'
This commit is contained in:
parent
6cf6c56dd1
commit
8aed1e11c3
1 changed files with 12 additions and 0 deletions
|
@ -142,4 +142,16 @@
|
|||
var csrf_token = target.parentNode.querySelector('input[name="csrf_token"]').value;
|
||||
xhr.send('csrf_token=' + csrf_token);
|
||||
}
|
||||
|
||||
// Handle keypresses
|
||||
window.addEventListener('keydown', (event) => {
|
||||
// Ignore modifier keys
|
||||
if (event.ctrlKey || event.metaKey) { return; }
|
||||
|
||||
// Focus search bar on '/'
|
||||
if (event.key == "/") {
|
||||
document.getElementById('searchbox').focus();
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
|
Loading…
Reference in a new issue