Add menu-bar links

This commit is contained in:
Unisko PENG, 2023-03-29 10:23:35 +08:00
parent 46fcc478d0
commit 9e2ab10221
2 changed files with 246 additions and 231 deletions

View File

@ -1,151 +1,168 @@
<!DOCTYPE HTML>
<html lang="zh_CN" class="sidebar-visible no-js light">
<head>
<!-- Book generated using mdBook -->
<meta charset="UTF-8">
<title>序和前言 - Yet another Chinese rust-lang book.</title>
<head>
<!-- Book generated using mdBook -->
<meta charset="UTF-8">
<title>序和前言 - Yet another Chinese rust-lang book.</title>
<!-- Custom HTML head -->
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#ffffff" />
<!-- Custom HTML head -->
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#ffffff" />
<link rel="icon" href="favicon.svg">
<link rel="shortcut icon" href="favicon.png">
<link rel="stylesheet" href="css/variables.css">
<link rel="stylesheet" href="css/general.css">
<link rel="stylesheet" href="css/chrome.css">
<link rel="stylesheet" href="css/print.css" media="print">
<link rel="icon" href="favicon.svg">
<link rel="shortcut icon" href="favicon.png">
<link rel="stylesheet" href="css/variables.css">
<link rel="stylesheet" href="css/general.css">
<link rel="stylesheet" href="css/chrome.css">
<link rel="stylesheet" href="css/print.css" media="print">
<!-- Fonts -->
<link rel="stylesheet" href="FontAwesome/css/font-awesome.css">
<link rel="stylesheet" href="fonts/fonts.css">
<!-- Fonts -->
<link rel="stylesheet" href="FontAwesome/css/font-awesome.css">
<link rel="stylesheet" href="fonts/fonts.css">
<!-- Highlight.js Stylesheets -->
<link rel="stylesheet" href="highlight.css">
<link rel="stylesheet" href="tomorrow-night.css">
<link rel="stylesheet" href="ayu-highlight.css">
<!-- Highlight.js Stylesheets -->
<link rel="stylesheet" href="highlight.css">
<link rel="stylesheet" href="tomorrow-night.css">
<link rel="stylesheet" href="ayu-highlight.css">
<!-- Custom theme stylesheets -->
<link rel="stylesheet" href="theme/pagetoc.css">
<!-- Custom theme stylesheets -->
<link rel="stylesheet" href="theme/pagetoc.css">
</head>
<body>
</head>
<body>
<div id="body-container">
<!-- Provide site root to javascript -->
<script>
var path_to_root = "";
var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light";
</script>
<!-- Provide site root to javascript -->
<script>
var path_to_root = "";
var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light";
</script>
<!-- Work around some values being stored in localStorage wrapped in quotes -->
<script>
try {
var theme = localStorage.getItem('mdbook-theme');
var sidebar = localStorage.getItem('mdbook-sidebar');
<!-- Work around some values being stored in localStorage wrapped in quotes -->
<script>
try {
var theme = localStorage.getItem('mdbook-theme');
var sidebar = localStorage.getItem('mdbook-sidebar');
if (theme.startsWith('"') && theme.endsWith('"')) {
localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
}
if (theme.startsWith('"') && theme.endsWith('"')) {
localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
}
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
}
} catch (e) { }
</script>
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
}
} catch (e) { }
</script>
<!-- Set the theme before any content is loaded, prevents flash -->
<script>
var theme;
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('light')
html.classList.add(theme);
html.classList.add('js');
</script>
<!-- Set the theme before any content is loaded, prevents flash -->
<script>
var theme;
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('light')
html.classList.add(theme);
html.classList.add('js');
</script>
<!-- Hide / unhide sidebar before it is displayed -->
<script>
var html = document.querySelector('html');
var sidebar = null;
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);
</script>
<!-- Hide / unhide sidebar before it is displayed -->
<script>
var html = document.querySelector('html');
var sidebar = null;
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);
</script>
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
<div class="sidebar-scrollbox">
<ol class="chapter"><li class="chapter-item expanded affix "><a href="../index.html" class="active">序和前言</a></li><li class="chapter-item expanded "><a href="Ch01_Getting_Started.html"><strong aria-hidden="true">1.</strong> 入门</a></li><li class="chapter-item expanded "><a href="Ch02_Programming_a_Guessing_Game.html"><strong aria-hidden="true">2.</strong> 编写一个猜数游戏</a></li><li class="chapter-item expanded "><a href="Ch03_Common_Programming_Concepts.html"><strong aria-hidden="true">3.</strong> 常见编程概念</a></li><li class="spacer"></li><li class="chapter-item expanded affix "><li class="part-title">进阶</li><li class="chapter-item expanded "><a href="Ch04_Understanding_Ownership.html"><strong aria-hidden="true">4.</strong> “掌握” 所有权</a></li><li class="chapter-item expanded "><a href="Ch05_Using_Structs_to_Structure_Related_Data.html"><strong aria-hidden="true">5.</strong> 使用结构体来对相关数据进行架构</a></li><li class="chapter-item expanded "><a href="Ch06_Enums_and_Pattern_Matching.html"><strong aria-hidden="true">6.</strong> 枚举与模式匹配</a></li><li class="chapter-item expanded "><a href="Ch07_Managing_Growing_Projects_with_Packages_Crates_and_Modules.html"><strong aria-hidden="true">7.</strong> 使用包、代码箱与模组对日趋增长的项目进行管理</a></li><li class="chapter-item expanded "><a href="Ch08_Common_Collections.html"><strong aria-hidden="true">8.</strong> 常用集合数据结构</a></li><li class="chapter-item expanded "><a href="Ch09_Error_Handling.html"><strong aria-hidden="true">9.</strong> 错误的处理</a></li><li class="spacer"></li><li class="chapter-item expanded affix "><li class="part-title">深入掌握</li><li class="chapter-item expanded "><a href="Ch10_Generic_Types_Traits_and_Lifetimes.html"><strong aria-hidden="true">10.</strong> 泛型、特质与生命周期</a></li><li class="chapter-item expanded "><a href="Ch11_Writing_Automated_Tests.html"><strong aria-hidden="true">11.</strong> 编写自动化测试</a></li><li class="spacer"></li><li class="chapter-item expanded affix "><li class="part-title">上篇总结 - 实操</li><li class="chapter-item expanded "><a href="Ch12_An_IO_Project_Building_a_Command_Line_Program.html"><strong aria-hidden="true">12.</strong> 一个文件系统 I/O 项目:构建一个命令行程序</a></li><li class="spacer"></li><li class="chapter-item expanded affix "><li class="part-title">下篇</li><li class="chapter-item expanded "><a href="Ch13_Functional_Language_Features_Iterators_and_Closures.html"><strong aria-hidden="true">13.</strong> 函数式编程语言特性:迭代器与闭包</a></li><li class="chapter-item expanded "><a href="Ch14_More_about_Cargo_and_Crates-io.html"><strong aria-hidden="true">14.</strong> Cargo 的其他方面及 Crates.io</a></li><li class="chapter-item expanded "><a href="Ch15_Smart_Pointers.html"><strong aria-hidden="true">15.</strong> 灵巧指针</a></li><li class="chapter-item expanded "><a href="Ch16_Fearless_Concurrency.html"><strong aria-hidden="true">16.</strong> 无惧并发</a></li><li class="chapter-item expanded "><a href="Ch17_Object_Oriented_Programming_Features_of_Rust.html"><strong aria-hidden="true">17.</strong> Rust 的面向对象编程特性</a></li><li class="chapter-item expanded "><a href="Ch18_Patterns_and_Matching.html"><strong aria-hidden="true">18.</strong> 模式与匹配</a></li><li class="chapter-item expanded "><a href="Ch19_Advanced_Features.html"><strong aria-hidden="true">19.</strong> 先进特性</a></li><li class="chapter-item expanded "><a href="Ch20_Final_Project_Building_a_Multithreaded_Web_Server.html"><strong aria-hidden="true">20.</strong> 最后项目:构建一个多线程的 Web 服务器</a></li></ol>
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
<div class="sidebar-scrollbox">
<ol class="chapter"><li class="chapter-item expanded affix "><a href="../index.html" class="active">序和前言</a></li><li class="chapter-item expanded "><a href="Ch01_Getting_Started.html"><strong aria-hidden="true">1.</strong> 入门</a></li><li class="chapter-item expanded "><a href="Ch02_Programming_a_Guessing_Game.html"><strong aria-hidden="true">2.</strong> 编写一个猜数游戏</a></li><li class="chapter-item expanded "><a href="Ch03_Common_Programming_Concepts.html"><strong aria-hidden="true">3.</strong> 常见编程概念</a></li><li class="spacer"></li><li class="chapter-item expanded affix "><li class="part-title">进阶</li><li class="chapter-item expanded "><a href="Ch04_Understanding_Ownership.html"><strong aria-hidden="true">4.</strong> “掌握” 所有权</a></li><li class="chapter-item expanded "><a href="Ch05_Using_Structs_to_Structure_Related_Data.html"><strong aria-hidden="true">5.</strong> 使用结构体来对相关数据进行架构</a></li><li class="chapter-item expanded "><a href="Ch06_Enums_and_Pattern_Matching.html"><strong aria-hidden="true">6.</strong> 枚举与模式匹配</a></li><li class="chapter-item expanded "><a href="Ch07_Managing_Growing_Projects_with_Packages_Crates_and_Modules.html"><strong aria-hidden="true">7.</strong> 使用包、代码箱与模组对日趋增长的项目进行管理</a></li><li class="chapter-item expanded "><a href="Ch08_Common_Collections.html"><strong aria-hidden="true">8.</strong> 常用集合数据结构</a></li><li class="chapter-item expanded "><a href="Ch09_Error_Handling.html"><strong aria-hidden="true">9.</strong> 错误的处理</a></li><li class="spacer"></li><li class="chapter-item expanded affix "><li class="part-title">深入掌握</li><li class="chapter-item expanded "><a href="Ch10_Generic_Types_Traits_and_Lifetimes.html"><strong aria-hidden="true">10.</strong> 泛型、特质与生命周期</a></li><li class="chapter-item expanded "><a href="Ch11_Writing_Automated_Tests.html"><strong aria-hidden="true">11.</strong> 编写自动化测试</a></li><li class="spacer"></li><li class="chapter-item expanded affix "><li class="part-title">上篇总结 - 实操</li><li class="chapter-item expanded "><a href="Ch12_An_IO_Project_Building_a_Command_Line_Program.html"><strong aria-hidden="true">12.</strong> 一个文件系统 I/O 项目:构建一个命令行程序</a></li><li class="spacer"></li><li class="chapter-item expanded affix "><li class="part-title">下篇</li><li class="chapter-item expanded "><a href="Ch13_Functional_Language_Features_Iterators_and_Closures.html"><strong aria-hidden="true">13.</strong> 函数式编程语言特性:迭代器与闭包</a></li><li class="chapter-item expanded "><a href="Ch14_More_about_Cargo_and_Crates-io.html"><strong aria-hidden="true">14.</strong> Cargo 的其他方面及 Crates.io</a></li><li class="chapter-item expanded "><a href="Ch15_Smart_Pointers.html"><strong aria-hidden="true">15.</strong> 灵巧指针</a></li><li class="chapter-item expanded "><a href="Ch16_Fearless_Concurrency.html"><strong aria-hidden="true">16.</strong> 无惧并发</a></li><li class="chapter-item expanded "><a href="Ch17_Object_Oriented_Programming_Features_of_Rust.html"><strong aria-hidden="true">17.</strong> Rust 的面向对象编程特性</a></li><li class="chapter-item expanded "><a href="Ch18_Patterns_and_Matching.html"><strong aria-hidden="true">18.</strong> 模式与匹配</a></li><li class="chapter-item expanded "><a href="Ch19_Advanced_Features.html"><strong aria-hidden="true">19.</strong> 先进特性</a></li><li class="chapter-item expanded "><a href="Ch20_Final_Project_Building_a_Multithreaded_Web_Server.html"><strong aria-hidden="true">20.</strong> 最后项目:构建一个多线程的 Web 服务器</a></li></ol>
</div>
<div id="sidebar-resize-handle" class="sidebar-resize-handle"></div>
</nav>
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar-hover-placeholder"></div>
<div id="menu-bar" class="menu-bar sticky bordered">
<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">
<i class="fa fa-bars"></i>
</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>
</ul>
<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">
<i class="fa fa-search"></i>
</button>
</div>
<div id="sidebar-resize-handle" class="sidebar-resize-handle"></div>
</nav>
<div id="page-wrapper" class="page-wrapper">
<h3 class="menu-title">Yet another Chinese rust-lang book.</h3>
<div class="page">
<div id="menu-bar-hover-placeholder"></div>
<div id="menu-bar" class="menu-bar sticky bordered">
<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">
<i class="fa fa-bars"></i>
</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>
</ul>
<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">
<i class="fa fa-search"></i>
</button>
</div>
<div class="right-buttons">
<a href="https://java.xfoss.com" title="Head First Java 中文版" aria-label="Head First Java 中文版">
☕·Head First Java 中文
</a>
<a href="https://ccna60d.xfoss.com" title="CCNA in 60 days" aria-label="CCNA 60 天">
🖧·60 天通过 CCNA
</a>
<a href="https://snippets.xfoss.com" title="代码片段与技术笔记code snippets and tech notes"
aria-label="代码片段与技术笔记code snippets and tech notes">
✨·代码片段与技术笔记
</a>
<a href="https://ts.xfoss.com" title="TypeScript 教程" aria-label="TypeScript 教程">
📜·TypeScript 教程
</a>
<a href="https://books.xfoss.com" title="捐赠donation" aria-label="捐赠donation">
🎁·捐赠donation
</a>
<h1 class="menu-title">Yet another Chinese rust-lang book.</h1>
<a href="print.html" title="Print this book" aria-label="Print this book">
<i id="print-button" class="fa fa-print"></i>
</a>
<div class="right-buttons">
<a href="print.html" title="Print this book" aria-label="Print this book">
<i id="print-button" class="fa fa-print"></i>
</a>
</div>
</div>
</div>
</div>
<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">
</form>
<div id="searchresults-outer" class="searchresults-outer hidden">
<div id="searchresults-header" class="searchresults-header"></div>
<ul id="searchresults">
</ul>
</div>
</div>
<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">
</form>
<div id="searchresults-outer" class="searchresults-outer hidden">
<div id="searchresults-header" class="searchresults-header"></div>
<ul id="searchresults">
</ul>
</div>
</div>
<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
<script>
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) {
link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
});
</script>
<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
<script>
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) {
link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
});
</script>
<div id="content" class="content">
<main><div class="sidetoc"><nav class="pagetoc"></nav></div>
<h1 id="rust-编程语言"><a class="header" href="#rust-编程语言">Rust 编程语言</a></h1>
<div id="content" class="content">
<main><div class="sidetoc"><nav class="pagetoc"></nav></div>
<h1 id="rust-编程语言"><a class="header" href="#rust-编程语言">Rust 编程语言</a></h1>
<p>原著:<a href="https://doc.rust-lang.org/book/">The Rust Programming Language</a></p>
<p><em>原作者Steve Klabnik 与 Carol Nichols, 及 Rust 社区</em></p>
<p>此版本的教材,假定安装了 Rust <code>1.67.1</code> (发布于 2023-02-09或更新版本。请参阅 <a href="docs/Ch01_Getting_Started.html#Installation">第 1 章的 “安装” 小节</a> 进行安装,或对已安装的 Rust 进行升级。</p>
@ -199,65 +216,65 @@ rustc 1.68.0 (2c8cc3432 2023-03-06)
<p>最后,还有一些包含了这门语言的有用信息的附录,这些附录则更多的像是参考的形式。附录 A 涵盖了 Rust 的关键字,附录 B 涵盖了 Rust 的运算符和符号,附录 C 涵盖了由标准库所提供的那些派生特质derivable traits附录 D 涵盖了一些有用的开发工具,还有附录 E 对 Rust 版本进行了解释。</p>
<p>阅读本书并无定法:你要跳着去读,也是可以的!在遇到疑惑时,或许就不得不跳回去看看了。你只要怎么有效就行了。</p>
</main>
</main>
<nav class="nav-wrapper" aria-label="Page navigation">
<!-- Mobile navigation buttons -->
<nav class="nav-wrapper" aria-label="Page navigation">
<!-- Mobile navigation buttons -->
<a rel="next" href="Ch01_Getting_Started.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
<a rel="next" href="Ch01_Getting_Started.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
<div style="clear: both"></div>
</nav>
</div>
</div>
<nav class="nav-wide-wrapper" aria-label="Page navigation">
<a rel="next" href="Ch01_Getting_Started.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
<div style="clear: both"></div>
</nav>
</div>
</div>
<!-- Livereload script (if served using the cli tool) -->
<script>
const wsProtocol = location.protocol === 'https:' ? 'wss:' : 'ws:';
const wsAddress = wsProtocol + "//" + location.host + "/" + "__livereload";
const socket = new WebSocket(wsAddress);
socket.onmessage = function (event) {
if (event.data === "reload") {
socket.close();
location.reload();
<nav class="nav-wide-wrapper" aria-label="Page navigation">
<a rel="next" href="Ch01_Getting_Started.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
</nav>
</div>
<!-- Livereload script (if served using the cli tool) -->
<script>
const wsProtocol = location.protocol === 'https:' ? 'wss:' : 'ws:';
const wsAddress = wsProtocol + "//" + location.host + "/" + "__livereload";
const socket = new WebSocket(wsAddress);
socket.onmessage = function (event) {
if (event.data === "reload") {
socket.close();
location.reload();
}
};
window.onbeforeunload = function() {
socket.close();
}
};
window.onbeforeunload = function() {
socket.close();
}
</script>
</script>
<script>
window.playground_copyable = true;
</script>
<script>
window.playground_copyable = true;
</script>
<script src="elasticlunr.min.js"></script>
<script src="mark.min.js"></script>
<script src="searcher.js"></script>
<script src="elasticlunr.min.js"></script>
<script src="mark.min.js"></script>
<script src="searcher.js"></script>
<script src="clipboard.min.js"></script>
<script src="highlight.js"></script>
<script src="book.js"></script>
<script src="clipboard.min.js"></script>
<script src="highlight.js"></script>
<script src="book.js"></script>
<!-- Custom JS scripts -->
<script src="theme/pagetoc.js"></script>
<!-- Custom JS scripts -->
<script src="theme/pagetoc.js"></script>
</div>
</body>
</body>
</html>

View File

@ -58,49 +58,49 @@
<!-- Provide site root to javascript -->
<script>
var path_to_root = "{{ path_to_root }}";
var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "{{ preferred_dark_theme }}" : "{{ default_theme }}";
var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "{{ preferred_dark_theme }}" : "{{ default_theme }}";
</script>
<!-- Work around some values being stored in localStorage wrapped in quotes -->
<script>
try {
var theme = localStorage.getItem('mdbook-theme');
var sidebar = localStorage.getItem('mdbook-sidebar');
var theme = localStorage.getItem('mdbook-theme');
var sidebar = localStorage.getItem('mdbook-sidebar');
if (theme.startsWith('"') && theme.endsWith('"')) {
localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
}
if (theme.startsWith('"') && theme.endsWith('"')) {
localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
}
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
}
} catch (e) { }
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
}
} catch (e) { }
</script>
<!-- Set the theme before any content is loaded, prevents flash -->
<script>
var theme;
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');
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');
</script>
<!-- Hide / unhide sidebar before it is displayed -->
<script>
var html = document.querySelector('html');
var sidebar = null;
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);
var sidebar = null;
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);
</script>
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
@ -140,11 +140,6 @@ html.classList.add("sidebar-" + sidebar);
<h3 class="menu-title">{{ book_title }}</h3>
<div class="right-buttons">
<a href="https://rust-lang.xfoss.com" title="Yet another Chinese rust-lang book"
aria-label="Yet another Chinese rust-lang book">
·Rust 官方书中文
</a>
<a href="https://java.xfoss.com" title="Head First Java 中文版" aria-label="Head First Java 中文版">
☕·Head First Java 中文
</a>
@ -152,12 +147,15 @@ html.classList.add("sidebar-" + sidebar);
🖧·60 天通过 CCNA
</a>
<a href="https://snippets.xfoss.com" title="代码片段与技术笔记code snippets and tech notes"
aria-label="代码片段与技术笔记code snippets and tech notes">
aria-label="代码片段与技术笔记code snippets and tech notes">
✨·代码片段与技术笔记
</a>
<a href="https://ts.xfoss.com" title="TypeScript 教程" aria-label="TypeScript 教程">
📜·TypeScript 教程
</a>
<a href="https://books.xfoss.com" title="捐赠donation" aria-label="捐赠donation">
🎁·捐赠donation
</a>
{{#if print_enable}}
<a href="{{ path_to_root }}print.html" title="Print this book" aria-label="Print this book">
@ -194,10 +192,10 @@ html.classList.add("sidebar-" + sidebar);
<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
<script>
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) {
link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
});
document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
});
</script>
<div id="content" class="content">
@ -244,18 +242,18 @@ Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
<!-- 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);
socket.onmessage = function (event) {
if (event.data === "reload") {
socket.close();
location.reload();
}
};
const wsAddress = wsProtocol + "//" + location.host + "/" + "{{{live_reload_endpoint}}}";
const socket = new WebSocket(wsAddress);
socket.onmessage = function (event) {
if (event.data === "reload") {
socket.close();
location.reload();
}
};
window.onbeforeunload = function() {
socket.close();
}
window.onbeforeunload = function() {
socket.close();
}
</script>
{{/if}}
@ -264,17 +262,17 @@ window.onbeforeunload = function() {
<script>
var localAddrs = ["localhost", "127.0.0.1", ""];
// make sure we don't activate google analytics if the developer is
// inspecting the book locally...
if (localAddrs.indexOf(document.location.hostname) === -1) {
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
// make sure we don't activate google analytics if the developer is
// inspecting the book locally...
if (localAddrs.indexOf(document.location.hostname) === -1) {
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', '{{google_analytics}}', 'auto');
ga('send', 'pageview');
}
ga('create', '{{google_analytics}}', 'auto');
ga('send', 'pageview');
}
</script>
{{/if}}
@ -317,16 +315,16 @@ if (localAddrs.indexOf(document.location.hostname) === -1) {
{{#if mathjax_support}}
<script>
window.addEventListener('load', function() {
MathJax.Hub.Register.StartupHook('End', function() {
window.setTimeout(window.print, 100);
});
});
MathJax.Hub.Register.StartupHook('End', function() {
window.setTimeout(window.print, 100);
});
});
</script>
{{else}}
<script>
window.addEventListener('load', function() {
window.setTimeout(window.print, 100);
});
window.setTimeout(window.print, 100);
});
</script>
{{/if}}
{{/if}}