@@ -644,36 +644,38 @@ aria-label="Show hidden lines"></button>';
644
644
}
645
645
}
646
646
function showHelp ( ) {
647
- document . getElementById ( "help-overlay" ) . style . display = "block" ;
648
- let help = `<h2 id="help-title">Keyboard shortcuts</h2>` ;
649
- help += "<p>Press <kbd>←</kbd> or <kbd>→</kbd> to navigate between chapters</p>" ;
650
- help += "<p>Press <kbd>s</kbd> to search in the book</p>" ;
651
- help += "<p>Press <kbd>?</kbd> to show this help</p>" ;
652
- help += "<p>Press <kbd>Esc</kbd> to hide this help</p>" ;
653
-
654
- document . getElementById ( "help-overlay" ) . innerHTML = help ;
655
-
656
- document . addEventListener ( 'keydown' , function ( e ) {
657
- if ( e . altKey || e . ctrlKey || e . metaKey || e . shiftKey ) { return ; }
647
+ document . getElementById ( 'help-overlay' ) . style . display = 'block' ;
648
+ let help = '<h2 id="help-title">Keyboard shortcuts</h2>' ;
649
+ help += '<p>Press <kbd>←</kbd> or <kbd>→</kbd> to navigate between chapters</p>' ;
650
+ help += '<p>Press <kbd>s</kbd> to search in the book</p>' ;
651
+ help += '<p>Press <kbd>?</kbd> to show this help</p>' ;
652
+ help += '<p>Press <kbd>Esc</kbd> to hide this help</p>' ;
653
+
654
+ document . getElementById ( 'help-overlay' ) . innerHTML = help ;
655
+
656
+ document . addEventListener ( 'keydown' , function ( e ) {
657
+ if ( e . altKey || e . ctrlKey || e . metaKey || e . shiftKey ) {
658
+ return ;
659
+ }
658
660
659
661
switch ( e . key ) {
660
- case 'Escape' :
661
- e . preventDefault ( ) ;
662
- hideHelp ( ) ;
663
- break ;
662
+ case 'Escape' :
663
+ e . preventDefault ( ) ;
664
+ hideHelp ( ) ;
665
+ break ;
664
666
}
665
667
} ) ;
666
668
}
667
669
function hideHelp ( ) {
668
- document . getElementById ( " help-overlay" ) . style . display = " none" ;
670
+ document . getElementById ( ' help-overlay' ) . style . display = ' none' ;
669
671
}
670
672
671
673
// Usually needs the Shift key to be pressed
672
674
switch ( e . key ) {
673
- case '?' :
674
- e . preventDefault ( ) ;
675
- showHelp ( ) ;
676
- break ;
675
+ case '?' :
676
+ e . preventDefault ( ) ;
677
+ showHelp ( ) ;
678
+ break ;
677
679
}
678
680
679
681
// Rest of the keys are only active when the Shift key is not pressed
0 commit comments