]> gitweb.factorcode.org Git - factor.git/blob - extra/webapps/help/search.js
help.html: implement "/" for making search box active.
[factor.git] / extra / webapps / help / search.js
1 window.onload = function() {
2     var radios = document.getElementsByClassName("radiotab");
3     if (radios.length > 0) {
4         radios[0].checked = true;
5     }
6 }
7
8 document.addEventListener('keydown', function (event) {
9     if (event.code == 'Slash') {
10         let input = document.getElementById('search');
11         if (input !== document.activeElement) {
12             setTimeout(function() {
13                 input.focus().select()
14             }, 0);
15         }
16     }
17 });