aboutsummaryrefslogtreecommitdiff
path: root/static/script.js
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2021-05-20 23:16:16 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2021-05-20 23:16:16 +0200
commitc4963751b38e762dd40da059bfd41c5b82bc5f06 (patch)
tree8a4f5847a349b949bfc479707fe2094d4c66c078 /static/script.js
parentAdd TODO about search formatting. (diff)
downloadcalp-c4963751b38e762dd40da059bfd41c5b82bc5f06.tar.gz
calp-c4963751b38e762dd40da059bfd41c5b82bc5f06.tar.xz
'/' focuses search in HTML.
Diffstat (limited to '')
-rw-r--r--static/script.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/static/script.js b/static/script.js
index 7d3d2c29..a0d58c27 100644
--- a/static/script.js
+++ b/static/script.js
@@ -404,5 +404,14 @@ window.onload = function () {
init_input_list();
+
+ document.addEventListener('keydown', function (event) {
+ if (event.key == '/') {
+ let searchbox = document.querySelector('.simplesearch [name=q]')
+ // focuses the input, and selects all the text in it
+ searchbox.select();
+ event.preventDefault();
+ }
+ });
}