File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change 76
76
< script src ="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/4.3.0/anchor.min.js "> </ script >
77
77
< script src ="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.7.2/highlight.min.js "> </ script >
78
78
< script src ="/assets/js/app.js "> </ script >
79
+ < script src ="/assets/js/search.js "> </ script >
79
80
</ body >
80
81
</ html >
Original file line number Diff line number Diff line change
1
+ $ ( ( ) => {
2
+ const searchForm = document . getElementById ( "search-form" )
3
+
4
+ addEventListener ( "keydown" , ( e ) => {
5
+ switch ( e . key ) {
6
+ case '/' :
7
+ if ( document . activeElement === searchForm ) break
8
+
9
+ e . preventDefault ( )
10
+ searchForm . focus ( )
11
+ break
12
+ case 'Escape' :
13
+ if ( document . activeElement === searchForm ) {
14
+ searchForm . blur ( )
15
+ }
16
+ break
17
+ }
18
+ } )
19
+ } ) ;
You can’t perform that action at this time.
0 commit comments