@@ -25,16 +25,6 @@ export class Navigation {
2525 if ( this . parent . state . theme !== this . os_theme ( ) )
2626 $ . body . classList . add ( this . parent . state . theme )
2727
28- $ . searchButton = new DOM ( 'button' , {
29- id :'search' ,
30- className :'icon' ,
31- title :'Search (/)'
32- } ) . onclick ( this , ( ) => {
33- DOM . switchState ( $ . searchArea )
34- DOM . switchState ( $ . searchAreaBg )
35- $ . searchInput . focus ( )
36- $ . searchInput . $ . select ( )
37- } )
3828 $ . changeTheme = new DOM ( 'button' , {
3929 className : this . parent . state . theme === 'dark' ? 'icon on' : 'icon' ,
4030 id :'theme' ,
@@ -50,22 +40,10 @@ export class Navigation {
5040 }
5141 } )
5242
53- $ . searchAreaBg = new DOM ( 'div' , {
54- className :'search-area-bg'
55- } ) . onclick ( this , ( ) => {
56- DOM . switchState ( $ . searchArea )
57- DOM . switchState ( $ . searchAreaBg )
58- } )
59- $ . searchArea = new DOM ( DOM . get ( '.search-area' ) )
60- $ . searchForm = new DOM ( DOM . get ( 'form' , $ . searchArea ) )
61- $ . searchInput = new DOM ( DOM . get ( 'input' , $ . searchForm ) )
62- $ . searchForm . $ [ 'action' ] = DOM . get ( 'link[rel="search"]' ) . href
63- $ . body . append ( [ $ . searchAreaBg ] )
64-
6543 $ . preserve_scroll = { }
6644 $ . preserve_scroll [ 'sphinxsidebarwrapper' ] = new DOM ( DOM . get ( '.sphinxsidebarwrapper' ) )
6745
68- $ . rightHeader = new DOM ( DOM . get ( 'header #right span.reverse' ) ) . append ( [ $ . changeTheme , $ . searchButton ] )
46+ $ . rightHeader = new DOM ( DOM . get ( 'header #right span.reverse' ) ) . append ( [ $ . changeTheme ] )
6947
7048 $ . relatedNext = DOM . get ( '.related .next' )
7149 $ . relatedPrev = DOM . get ( '.related .prev' )
@@ -159,21 +137,6 @@ export class Navigation {
159137 }
160138 }
161139 }
162- /* Search shortcut */
163- search ( e ) {
164- if ( ( e . code === 'IntlRo' || e . code === 'Slash' )
165- && ! this . $ . searchArea . classList . contains ( 'on' ) ) {
166- DOM . switchState ( this . $ . searchArea )
167- DOM . switchState ( this . $ . searchAreaBg )
168- this . $ . searchInput . focus ( )
169- this . $ . searchInput . $ . select ( )
170- } else if ( e . code === 'Escape' ) {
171- if ( this . $ . searchArea . classList . contains ( 'on' ) ) {
172- DOM . switchState ( this . $ . searchArea )
173- DOM . switchState ( this . $ . searchAreaBg )
174- }
175- }
176- }
177140 /* Related shortcut */
178141 related ( e ) {
179142 if ( ! e . altKey || ! e . shiftKey )
@@ -200,7 +163,9 @@ export class Navigation {
200163 case 'IntlRo' :
201164 case 'Slash' :
202165 case 'Escape' :
203- this . search ( e )
166+ case 'KeyK' :
167+ if ( typeof this . parent . search !== "undefined" )
168+ this . parent . search . search ( e )
204169 break
205170 }
206171 }
@@ -212,7 +177,16 @@ export class Navigation {
212177 case 'ArrowRight' :
213178 case 'KeyA' :
214179 case 'KeyD' :
215- e . preventDefault ( )
180+ if ( e . altKey && e . shiftKey )
181+ e . preventDefault ( )
182+ return
183+ case 'IntlRo' :
184+ case 'Slash' :
185+ return
186+ case 'KeyK' :
187+ if ( e . ctrlKey && e . altKey )
188+ e . preventDefault ( )
189+ return
216190 }
217191 }
218192
0 commit comments