Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'book/theme/index.hbs')
-rw-r--r--book/theme/index.hbs127
1 files changed, 55 insertions, 72 deletions
diff --git a/book/theme/index.hbs b/book/theme/index.hbs
index 0a46ac64..6e0cce0a 100644
--- a/book/theme/index.hbs
+++ b/book/theme/index.hbs
@@ -1,11 +1,11 @@
<!DOCTYPE HTML>
-<html lang="{{ language }}" class="{{ default_theme }} sidebar-visible" dir="{{ text_direction }}">
+<html lang="{{ language }}" class="sidebar-visible no-js {{ default_theme }}">
<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 }}">
@@ -15,9 +15,10 @@
<!-- Custom HTML head -->
{{> head}}
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<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,6 +35,8 @@
<!-- 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}}
@@ -50,21 +53,18 @@
{{#if mathjax_support}}
<!-- MathJax -->
- <script async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+ <script async type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
{{/if}}
-
+ </head>
+ <body>
<!-- Provide site root to javascript -->
- <script>
+ <script type="text/javascript">
var path_to_root = "{{ path_to_root }}";
var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "{{ preferred_dark_theme }}" : "{{ default_theme }}";
</script>
- <!-- Start loading toc.js asap -->
- <script src="{{ path_to_root }}toc.js"></script>
- </head>
- <body>
- <div id="body-container">
+
<!-- Work around some values being stored in localStorage wrapped in quotes -->
- <script>
+ <script type="text/javascript">
try {
var theme = localStorage.getItem('mdbook-theme');
var sidebar = localStorage.getItem('mdbook-sidebar');
@@ -80,42 +80,34 @@
</script>
<!-- Set the theme before any content is loaded, prevents flash -->
- <script>
+ <script type="text/javascript">
var theme;
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
if (theme === null || theme === undefined) { theme = default_theme; }
- const html = document.documentElement;
+ var html = document.querySelector('html');
+ html.classList.remove('no-js')
html.classList.remove('{{ default_theme }}')
html.classList.add(theme);
- html.classList.add("js");
+ html.classList.add('js');
</script>
- <input type="checkbox" id="sidebar-toggle-anchor" class="hidden">
-
<!-- Hide / unhide sidebar before it is displayed -->
- <script>
- var sidebar = null;
- var sidebar_toggle = document.getElementById("sidebar-toggle-anchor");
+ <script type="text/javascript">
+ var html = document.querySelector('html');
+ var sidebar = 'hidden';
if (document.body.clientWidth >= 1080) {
try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
sidebar = sidebar || 'visible';
- } else {
- sidebar = 'hidden';
}
- sidebar_toggle.checked = sidebar === 'visible';
html.classList.remove('sidebar-visible');
html.classList.add("sidebar-" + sidebar);
</script>
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
- <!-- populated by js -->
- <mdbook-sidebar-scrollbox class="sidebar-scrollbox"></mdbook-sidebar-scrollbox>
- <noscript>
- <iframe class="sidebar-iframe-outer" src="{{ path_to_root }}toc.html"></iframe>
- </noscript>
- <div id="sidebar-resize-handle" class="sidebar-resize-handle">
- <div class="sidebar-resize-indicator"></div>
+ <div class="sidebar-scrollbox">
+ {{#toc}}{{/toc}}
</div>
+ <div id="sidebar-resize-handle" class="sidebar-resize-handle"></div>
</nav>
<div id="page-wrapper" class="page-wrapper">
@@ -123,21 +115,21 @@
<div class="page">
{{> header}}
<div id="menu-bar-hover-placeholder"></div>
- <div id="menu-bar" class="menu-bar sticky">
+ <div id="menu-bar" class="menu-bar sticky bordered">
<div class="left-buttons">
- <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">
+ <button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
<i class="fa fa-bars"></i>
- </label>
+ </button>
<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>
<ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
- <li role="none"><button role="menuitem" class="theme" id="light">Light</button></li>
- <li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
- <li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
- <li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
- <li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
- <li role="none"><button role="menuitem" class="theme" id="colibri">Colibri</button></li>
+ <li role="none"><button role="menuitem" class="theme" id="light">{{ theme_option "Light" }}</button></li>
+ <li role="none"><button role="menuitem" class="theme" id="rust">{{ theme_option "Rust" }}</button></li>
+ <li role="none"><button role="menuitem" class="theme" id="coal">{{ theme_option "Coal" }}</button></li>
+ <li role="none"><button role="menuitem" class="theme" id="navy">{{ theme_option "Navy" }}</button></li>
+ <li role="none"><button role="menuitem" class="theme" id="ayu">{{ theme_option "Ayu" }}</button></li>
+ <li role="none"><button role="menuitem" class="theme" id="colibri">{{ theme_option "Colibri" }}</button></li>
</ul>
{{#if search_enabled}}
<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">
@@ -159,19 +151,13 @@
<i id="git-repository-button" class="fa {{git_repository_icon}}"></i>
</a>
{{/if}}
- {{#if git_repository_edit_url}}
- <a href="{{git_repository_edit_url}}" title="Suggest an edit" aria-label="Suggest an edit">
- <i id="git-edit-button" class="fa fa-edit"></i>
- </a>
- {{/if}}
-
</div>
</div>
{{#if search_enabled}}
<div id="search-wrapper" class="hidden">
<form id="searchbar-outer" class="searchbar-outer">
- <input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
+ <input type="search" name="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
</form>
<div id="searchresults-outer" class="searchresults-outer hidden">
<div id="searchresults-header" class="searchresults-header"></div>
@@ -182,7 +168,7 @@
{{/if}}
<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
- <script>
+ <script type="text/javascript">
document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
@@ -204,7 +190,7 @@
{{/previous}}
{{#next}}
- <a rel="next prefetch" href="{{ path_to_root }}{{link}}" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
+ <a rel="next" 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}}
@@ -222,7 +208,7 @@
{{/previous}}
{{#next}}
- <a rel="next prefetch" href="{{ path_to_root }}{{link}}" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
+ <a rel="next" 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}}
@@ -230,12 +216,10 @@
</div>
- {{#if live_reload_endpoint}}
+ {{#if livereload}}
<!-- Livereload script (if served using the cli tool) -->
- <script>
- const wsProtocol = location.protocol === 'https:' ? 'wss:' : 'ws:';
- const wsAddress = wsProtocol + "//" + location.host + "/" + "{{{live_reload_endpoint}}}";
- const socket = new WebSocket(wsAddress);
+ <script type="text/javascript">
+ var socket = new WebSocket("{{{livereload}}}");
socket.onmessage = function (event) {
if (event.data === "reload") {
socket.close();
@@ -251,7 +235,7 @@
{{#if google_analytics}}
<!-- Google Analytics Tag -->
- <script>
+ <script type="text/javascript">
var localAddrs = ["localhost", "127.0.0.1", ""];
// make sure we don't activate google analytics if the developer is
@@ -269,43 +253,43 @@
{{/if}}
{{#if playground_line_numbers}}
- <script>
+ <script type="text/javascript">
window.playground_line_numbers = true;
</script>
{{/if}}
{{#if playground_copyable}}
- <script>
+ <script type="text/javascript">
window.playground_copyable = true;
</script>
{{/if}}
{{#if playground_js}}
- <script src="{{ path_to_root }}ace.js"></script>
- <script src="{{ path_to_root }}editor.js"></script>
- <script src="{{ path_to_root }}mode-rust.js"></script>
- <script src="{{ path_to_root }}theme-dawn.js"></script>
- <script src="{{ path_to_root }}theme-tomorrow_night.js"></script>
+ <script src="{{ path_to_root }}ace.js" type="text/javascript" charset="utf-8"></script>
+ <script src="{{ path_to_root }}editor.js" type="text/javascript" charset="utf-8"></script>
+ <script src="{{ path_to_root }}mode-rust.js" type="text/javascript" charset="utf-8"></script>
+ <script src="{{ path_to_root }}theme-dawn.js" type="text/javascript" charset="utf-8"></script>
+ <script src="{{ path_to_root }}theme-tomorrow_night.js" type="text/javascript" charset="utf-8"></script>
{{/if}}
{{#if search_js}}
- <script src="{{ path_to_root }}elasticlunr.min.js"></script>
- <script src="{{ path_to_root }}mark.min.js"></script>
- <script src="{{ path_to_root }}searcher.js"></script>
+ <script src="{{ path_to_root }}elasticlunr.min.js" type="text/javascript" charset="utf-8"></script>
+ <script src="{{ path_to_root }}mark.min.js" type="text/javascript" charset="utf-8"></script>
+ <script src="{{ path_to_root }}searcher.js" type="text/javascript" charset="utf-8"></script>
{{/if}}
- <script src="{{ path_to_root }}clipboard.min.js"></script>
- <script src="{{ path_to_root }}highlight.js"></script>
- <script src="{{ path_to_root }}book.js"></script>
+ <script src="{{ path_to_root }}clipboard.min.js" type="text/javascript" charset="utf-8"></script>
+ <script src="{{ path_to_root }}highlight.js" type="text/javascript" charset="utf-8"></script>
+ <script src="{{ path_to_root }}book.js" type="text/javascript" charset="utf-8"></script>
<!-- Custom JS scripts -->
{{#each additional_js}}
- <script src="{{ ../path_to_root }}{{this}}"></script>
+ <script type="text/javascript" src="{{ ../path_to_root }}{{this}}"></script>
{{/each}}
{{#if is_print}}
{{#if mathjax_support}}
- <script>
+ <script type="text/javascript">
window.addEventListener('load', function() {
MathJax.Hub.Register.StartupHook('End', function() {
window.setTimeout(window.print, 100);
@@ -313,7 +297,7 @@
});
</script>
{{else}}
- <script>
+ <script type="text/javascript">
window.addEventListener('load', function() {
window.setTimeout(window.print, 100);
});
@@ -321,6 +305,5 @@
{{/if}}
{{/if}}
- </div>
</body>
</html>