|
25 | 25 | <link rel="stylesheet" href="fonts/fonts.css"> |
26 | 26 |
|
27 | 27 | <!-- Highlight.js Stylesheets --> |
28 | | - <link rel="stylesheet" href="highlight.css"> |
29 | | - <link rel="stylesheet" href="tomorrow-night.css"> |
30 | | - <link rel="stylesheet" href="ayu-highlight.css"> |
| 28 | + <link rel="stylesheet" id="highlight-css" href="highlight.css"> |
| 29 | + <link rel="stylesheet" id="tomorrow-night-css" href="tomorrow-night.css"> |
| 30 | + <link rel="stylesheet" id="ayu-highlight-css" href="ayu-highlight.css"> |
31 | 31 |
|
32 | 32 | <!-- Custom theme stylesheets --> |
33 | 33 |
|
34 | 34 | <!-- MathJax --> |
35 | 35 | <script async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> |
36 | 36 |
|
37 | | - <!-- Provide site root to javascript --> |
| 37 | + <!-- Provide site root and default themes to javascript --> |
38 | 38 | <script> |
39 | | - var path_to_root = ""; |
40 | | - var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "ayu" : "ayu"; |
| 39 | + const path_to_root = ""; |
| 40 | + const default_light_theme = "ayu"; |
| 41 | + const default_dark_theme = "ayu"; |
41 | 42 | </script> |
42 | 43 | <!-- Start loading toc.js asap --> |
43 | 44 | <script src="toc.js"></script> |
44 | 45 | </head> |
45 | 46 | <body> |
| 47 | + <div id="mdbook-help-container"> |
| 48 | + <div id="mdbook-help-popup"> |
| 49 | + <h2 class="mdbook-help-title">Keyboard shortcuts</h2> |
| 50 | + <div> |
| 51 | + <p>Press <kbd>←</kbd> or <kbd>→</kbd> to navigate between chapters</p> |
| 52 | + <p>Press <kbd>S</kbd> or <kbd>/</kbd> to search in the book</p> |
| 53 | + <p>Press <kbd>?</kbd> to show this help</p> |
| 54 | + <p>Press <kbd>Esc</kbd> to hide this help</p> |
| 55 | + </div> |
| 56 | + </div> |
| 57 | + </div> |
46 | 58 | <div id="body-container"> |
47 | 59 | <!-- Work around some values being stored in localStorage wrapped in quotes --> |
48 | 60 | <script> |
49 | 61 | try { |
50 | | - var theme = localStorage.getItem('mdbook-theme'); |
51 | | - var sidebar = localStorage.getItem('mdbook-sidebar'); |
| 62 | + let theme = localStorage.getItem('mdbook-theme'); |
| 63 | + let sidebar = localStorage.getItem('mdbook-sidebar'); |
52 | 64 |
|
53 | 65 | if (theme.startsWith('"') && theme.endsWith('"')) { |
54 | 66 | localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1)); |
|
62 | 74 |
|
63 | 75 | <!-- Set the theme before any content is loaded, prevents flash --> |
64 | 76 | <script> |
65 | | - var theme; |
| 77 | + const default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? default_dark_theme : default_light_theme; |
| 78 | + let theme; |
66 | 79 | try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { } |
67 | 80 | if (theme === null || theme === undefined) { theme = default_theme; } |
68 | 81 | const html = document.documentElement; |
|
75 | 88 |
|
76 | 89 | <!-- Hide / unhide sidebar before it is displayed --> |
77 | 90 | <script> |
78 | | - var sidebar = null; |
79 | | - var sidebar_toggle = document.getElementById("sidebar-toggle-anchor"); |
| 91 | + let sidebar = null; |
| 92 | + const sidebar_toggle = document.getElementById("sidebar-toggle-anchor"); |
80 | 93 | if (document.body.clientWidth >= 1080) { |
81 | 94 | try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { } |
82 | 95 | sidebar = sidebar || 'visible'; |
|
112 | 125 | <i class="fa fa-paint-brush"></i> |
113 | 126 | </button> |
114 | 127 | <ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu"> |
| 128 | + <li role="none"><button role="menuitem" class="theme" id="default_theme">Auto</button></li> |
115 | 129 | <li role="none"><button role="menuitem" class="theme" id="light">Light</button></li> |
116 | 130 | <li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li> |
117 | 131 | <li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li> |
118 | 132 | <li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li> |
119 | 133 | <li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li> |
120 | 134 | </ul> |
121 | | - <button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar"> |
| 135 | + <button id="search-toggle" class="icon-button" type="button" title="Search (`/`)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="/ s" aria-controls="searchbar"> |
122 | 136 | <i class="fa fa-search"></i> |
123 | 137 | </button> |
124 | 138 | </div> |
@@ -189,8 +203,8 @@ <h1 id="document-not-found-404"><a class="header" href="#document-not-found-404" |
189 | 203 | </script> |
190 | 204 |
|
191 | 205 | <script src="ace.js"></script> |
192 | | - <script src="editor.js"></script> |
193 | 206 | <script src="mode-rust.js"></script> |
| 207 | + <script src="editor.js"></script> |
194 | 208 | <script src="theme-dawn.js"></script> |
195 | 209 | <script src="theme-tomorrow_night.js"></script> |
196 | 210 |
|
|
0 commit comments