diff options
Diffstat (limited to 'book/theme')
-rw-r--r-- | book/theme/index.hbs | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/book/theme/index.hbs b/book/theme/index.hbs index ed27410f..0a0bc550 100644 --- a/book/theme/index.hbs +++ b/book/theme/index.hbs @@ -1,11 +1,11 @@ <!DOCTYPE HTML> -<html lang="{{ language }}" class="sidebar-visible no-js {{ default_theme }}"> +<html lang="{{ language }}" class="{{ default_theme }}" dir="{{ text_direction }}"> <head> <!-- Book generated using mdBook --> <meta charset="UTF-8"> <title>{{ title }}</title> {{#if is_print }} - <meta name="robots" content="noindex" /> + <meta name="robots" content="noindex"> {{/if}} {{#if base_url}} <base href="{{ base_url }}"> @@ -17,7 +17,7 @@ <meta name="description" content="{{ description }}"> <meta name="viewport" content="width=device-width, initial-scale=1"> - <meta name="theme-color" content="#ffffff" /> + <meta name="theme-color" content="#ffffff"> {{#if favicon_svg}} <link rel="icon" href="{{ path_to_root }}favicon.svg"> @@ -34,8 +34,6 @@ <!-- Fonts --> <link rel="stylesheet" href="{{ path_to_root }}FontAwesome/css/font-awesome.css"> - <link rel="preconnect" href="https://fonts.gstatic.com"> - <link href="https://fonts.googleapis.com/css2?family=Inter:wght@200;400;500;700&display=swap" rel="stylesheet"> {{#if copy_fonts}} <link rel="stylesheet" href="{{ path_to_root }}fonts/fonts.css"> {{/if}} @@ -55,7 +53,7 @@ <script async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> {{/if}} </head> - <body> + <body class="sidebar-visible no-js"> <div id="body-container"> <!-- Provide site root to javascript --> <script> @@ -85,24 +83,29 @@ try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { } if (theme === null || theme === undefined) { theme = default_theme; } var html = document.querySelector('html'); - html.classList.remove('no-js') html.classList.remove('{{ default_theme }}') html.classList.add(theme); - html.classList.add('js'); + var body = document.querySelector('body'); + body.classList.remove('no-js') + body.classList.add('js'); </script> + <input type="checkbox" id="sidebar-toggle-anchor" class="hidden"> + <!-- Hide / unhide sidebar before it is displayed --> <script> - var html = document.querySelector('html'); + var body = document.querySelector('body'); var sidebar = null; + var sidebar_toggle = document.getElementById("sidebar-toggle-anchor"); if (document.body.clientWidth >= 1080) { try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { } sidebar = sidebar || 'visible'; } else { sidebar = 'hidden'; } - html.classList.remove('sidebar-visible'); - html.classList.add("sidebar-" + sidebar); + sidebar_toggle.checked = sidebar === 'visible'; + body.classList.remove('sidebar-visible'); + body.classList.add("sidebar-" + sidebar); </script> <nav id="sidebar" class="sidebar" aria-label="Table of contents"> @@ -141,9 +144,9 @@ <div id="menu-bar-hover-placeholder"></div> <div id="menu-bar" class="menu-bar sticky"> <div class="left-buttons"> - <button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar"> + <label id="sidebar-toggle" class="icon-button" for="sidebar-toggle-anchor" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar"> <i class="fa fa-bars"></i> - </button> + </label> <button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list"> <i class="fa fa-paint-brush"></i> </button> @@ -220,7 +223,7 @@ {{/previous}} {{#next}} - <a rel="next" href="{{ path_to_root }}{{link}}" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right"> + <a rel="next prefetch" href="{{ path_to_root }}{{link}}" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right"> <i class="fa fa-angle-right"></i> </a> {{/next}} @@ -238,7 +241,7 @@ {{/previous}} {{#next}} - <a rel="next" href="{{ path_to_root }}{{link}}" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right"> + <a rel="next prefetch" href="{{ path_to_root }}{{link}}" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right"> <i class="fa fa-angle-right"></i> </a> {{/next}} |