Add JS to focus search box on '/'

このコミットが含まれているのは:
Samantaz Fox 2022-01-13 22:20:10 +01:00
コミット 8aed1e11c3
この署名に対応する既知のキーがデータベースに存在しません
GPGキーID: F42821059186176E
1個のファイルの変更12行の追加0行の削除

ファイルの表示

@ -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();
}
});
})();