初步完成学习环境

This commit is contained in:
cxykevin 2024-05-30 22:06:26 +08:00
parent 29781e694e
commit 6ff164369c
1 changed files with 146 additions and 81 deletions

View File

@ -1,59 +1,95 @@
<!DOCTYPE HTML> <!DOCTYPE HTML>
<html lang="{{ language }}" class="{{ default_theme }}" dir="{{ text_direction }}"> <html lang="{{ language }}" class="{{ default_theme }}" dir="{{ text_direction }}">
<head>
<!-- Book generated using mdBook --> <head>
<meta charset="UTF-8"> <!-- Book generated using mdBook -->
<title>{{ title }}</title> <meta charset="UTF-8">
{{#if is_print }} <title>{{ title }}</title>
<meta name="robots" content="noindex"> {{#if is_print }}
{{/if}} <meta name="robots" content="noindex">
{{#if base_url}} {{/if}}
<base href="{{ base_url }}"> {{#if base_url}}
{{/if}} <base href="{{ base_url }}">
{{/if}}
<!-- Custom HTML head --> <!-- Custom HTML head -->
{{> head}} {{> head}}
<meta name="description" content="{{ description }}"> <meta name="description" content="{{ description }}">
<meta name="viewport" content="width=device-width, initial-scale=1"> <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}} {{#if favicon_svg}}
<link rel="icon" href="{{ path_to_root }}favicon.svg"> <link rel="icon" href="{{ path_to_root }}favicon.svg">
{{/if}} {{/if}}
{{#if favicon_png}} {{#if favicon_png}}
<link rel="shortcut icon" href="{{ path_to_root }}favicon.png"> <link rel="shortcut icon" href="{{ path_to_root }}favicon.png">
{{/if}} {{/if}}
<link rel="stylesheet" href="{{ path_to_root }}css/variables.css"> <link rel="stylesheet" href="{{ path_to_root }}css/variables.css">
<link rel="stylesheet" href="{{ path_to_root }}css/general.css"> <link rel="stylesheet" href="{{ path_to_root }}css/general.css">
<link rel="stylesheet" href="{{ path_to_root }}css/chrome.css"> <link rel="stylesheet" href="{{ path_to_root }}css/chrome.css">
{{#if print_enable}} {{#if print_enable}}
<link rel="stylesheet" href="{{ path_to_root }}css/print.css" media="print"> <link rel="stylesheet" href="{{ path_to_root }}css/print.css" media="print">
{{/if}} {{/if}}
<!-- Fonts --> <!-- Fonts -->
<link rel="stylesheet" href="{{ path_to_root }}FontAwesome/css/font-awesome.css"> <link rel="stylesheet" href="{{ path_to_root }}FontAwesome/css/font-awesome.css">
{{#if copy_fonts}} {{#if copy_fonts}}
<link rel="stylesheet" href="{{ path_to_root }}fonts/fonts.css"> <link rel="stylesheet" href="{{ path_to_root }}fonts/fonts.css">
{{/if}} {{/if}}
<!-- Highlight.js Stylesheets --> <!-- Highlight.js Stylesheets -->
<link rel="stylesheet" href="{{ path_to_root }}highlight.css"> <link rel="stylesheet" href="{{ path_to_root }}highlight.css">
<link rel="stylesheet" href="{{ path_to_root }}tomorrow-night.css"> <link rel="stylesheet" href="{{ path_to_root }}tomorrow-night.css">
<link rel="stylesheet" href="{{ path_to_root }}ayu-highlight.css"> <link rel="stylesheet" href="{{ path_to_root }}ayu-highlight.css">
<!-- Custom theme stylesheets --> <!-- Custom theme stylesheets -->
{{#each additional_css}} {{#each additional_css}}
<link rel="stylesheet" href="{{ ../path_to_root }}{{ this }}"> <link rel="stylesheet" href="{{ ../path_to_root }}{{ this }}">
{{/each}} {{/each}}
{{#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>
{{/if}}
<!-- study env css -->
<style>
.popup-window {
position: fixed;
top: 0;
right: -100%;
/* Start with the window off screen */
width: 100%;
height: 100%;
border: none;
background-color: white;
box-shadow: -5px 0 5px rgba(0, 0, 0, 0.2);
z-index: 1000;
overflow-y: auto;
/* Enable scrolling if content is taller than the screen */
transition: right 0.3s ease-in-out;
/* Smooth slide in animation */
}
.popup-window iframe {
width: 500px;
height: 100vh;
/* Use viewport height to fill the height of the window */
border: none;
}
.popup-window.show {
right: calc(-100% + 500px);
/* Slide the window into view */
}
</style>
</head>
<body class="sidebar-visible no-js">
{{#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>
{{/if}}
</head>
<body class="sidebar-visible no-js">
<div id="body-container"> <div id="body-container">
<!-- Provide site root to javascript --> <!-- Provide site root to javascript -->
<script> <script>
@ -80,7 +116,7 @@
<!-- Set the theme before any content is loaded, prevents flash --> <!-- Set the theme before any content is loaded, prevents flash -->
<script> <script>
var theme; var theme;
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { } try { theme = localStorage.getItem('mdbook-theme'); } catch (e) { }
if (theme === null || theme === undefined) { theme = default_theme; } if (theme === null || theme === undefined) { theme = default_theme; }
var html = document.querySelector('html'); var html = document.querySelector('html');
html.classList.remove('{{ default_theme }}') html.classList.remove('{{ default_theme }}')
@ -98,7 +134,7 @@
var sidebar = null; var sidebar = null;
var sidebar_toggle = document.getElementById("sidebar-toggle-anchor"); var sidebar_toggle = document.getElementById("sidebar-toggle-anchor");
if (document.body.clientWidth >= 1080) { if (document.body.clientWidth >= 1080) {
try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { } try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch (e) { }
sidebar = sidebar || 'visible'; sidebar = sidebar || 'visible';
} else { } else {
sidebar = 'hidden'; sidebar = 'hidden';
@ -120,7 +156,7 @@
<!-- Track and set sidebar scroll position --> <!-- Track and set sidebar scroll position -->
<script> <script>
var sidebarScrollbox = document.querySelector('#sidebar .sidebar-scrollbox'); var sidebarScrollbox = document.querySelector('#sidebar .sidebar-scrollbox');
sidebarScrollbox.addEventListener('click', function(e) { sidebarScrollbox.addEventListener('click', function (e) {
if (e.target.tagName === 'A') { if (e.target.tagName === 'A') {
sessionStorage.setItem('sidebar-scroll', sidebarScrollbox.scrollTop); sessionStorage.setItem('sidebar-scroll', sidebarScrollbox.scrollTop);
} }
@ -140,16 +176,19 @@
</script> </script>
<div id="page-wrapper" class="page-wrapper"> <div id="page-wrapper" class="page-wrapper">
<div class="page"> <div class="page">
{{> header}} {{> header}}
<div id="menu-bar-hover-placeholder"></div> <div id="menu-bar-hover-placeholder"></div>
<div id="menu-bar" class="menu-bar sticky"> <div id="menu-bar" class="menu-bar sticky">
<div class="left-buttons"> <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"> <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> <i class="fa fa-bars"></i>
</label> </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"> <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> <i class="fa fa-paint-brush"></i>
</button> </button>
<ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu"> <ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
@ -160,10 +199,14 @@
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li> <li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
</ul> </ul>
{{#if search_enabled}} {{#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"> <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> <i class="fa fa-search"></i>
</button> </button>
{{/if}} {{/if}}
<button id="popup-btn" class="icon-button" type="button" aria-expanded="false"
aria-keyshortcuts="T" class="popup-btn">实验环境</button>
</div> </div>
<h1 class="menu-title">{{ book_title }}</h1> <h1 class="menu-title">{{ book_title }}</h1>
@ -191,7 +234,8 @@
{{#if search_enabled}} {{#if search_enabled}}
<div id="search-wrapper" class="hidden"> <div id="search-wrapper" class="hidden">
<form id="searchbar-outer" class="searchbar-outer"> <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" id="searchbar" name="searchbar" placeholder="Search this book ..."
aria-controls="searchresults-outer" aria-describedby="searchresults-header">
</form> </form>
<div id="searchresults-outer" class="searchresults-outer hidden"> <div id="searchresults-outer" class="searchresults-outer hidden">
<div id="searchresults-header" class="searchresults-header"></div> <div id="searchresults-header" class="searchresults-header"></div>
@ -205,7 +249,7 @@
<script> <script>
document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible'); document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible'); document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) { Array.from(document.querySelectorAll('#sidebar a')).forEach(function (link) {
link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1); link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
}); });
</script> </script>
@ -215,36 +259,44 @@
{{{ content }}} {{{ content }}}
</main> </main>
<nav class="nav-wrapper" aria-label="Page navigation"> <nav class="nav-wrapper" aria-label="Page navigation">
<!-- Mobile navigation buttons --> <!-- Mobile navigation buttons -->
{{#previous}} {{#previous}}
<a rel="prev" href="{{ path_to_root }}{{link}}" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left"> <a rel="prev" href="{{ path_to_root }}{{link}}" class="mobile-nav-chapters previous"
<i class="fa fa-angle-left"></i> title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
</a> <i class="fa fa-angle-left"></i>
</a>
{{/previous}} {{/previous}}
{{#next}} {{#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 prefetch" href="{{ path_to_root }}{{link}}" class="mobile-nav-chapters next"
<i class="fa fa-angle-right"></i> title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
</a> <i class="fa fa-angle-right"></i>
</a>
{{/next}} {{/next}}
<div style="clear: both"></div> <div style="clear: both"></div>
</nav> </nav>
</div> </div>
<div id="popup-window" class="popup-window">
<iframe src="https://jslinux.cxykevin.top" frameborder="0"></iframe>
</div>
</div> </div>
<nav class="nav-wide-wrapper" aria-label="Page navigation"> <nav class="nav-wide-wrapper" aria-label="Page navigation">
{{#previous}} {{#previous}}
<a rel="prev" href="{{ path_to_root }}{{link}}" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left"> <a rel="prev" href="{{ path_to_root }}{{link}}" class="nav-chapters previous" title="Previous chapter"
<i class="fa fa-angle-left"></i> aria-label="Previous chapter" aria-keyshortcuts="Left">
</a> <i class="fa fa-angle-left"></i>
</a>
{{/previous}} {{/previous}}
{{#next}} {{#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 prefetch" href="{{ path_to_root }}{{link}}" class="nav-chapters next" title="Next chapter"
<i class="fa fa-angle-right"></i> aria-label="Next chapter" aria-keyshortcuts="Right">
</a> <i class="fa fa-angle-right"></i>
</a>
{{/next}} {{/next}}
</nav> </nav>
@ -263,7 +315,7 @@
} }
}; };
window.onbeforeunload = function() { window.onbeforeunload = function () {
socket.close(); socket.close();
} }
</script> </script>
@ -277,10 +329,12 @@
// make sure we don't activate google analytics if the developer is // make sure we don't activate google analytics if the developer is
// inspecting the book locally... // inspecting the book locally...
if (localAddrs.indexOf(document.location.hostname) === -1) { if (localAddrs.indexOf(document.location.hostname) === -1) {
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (function (i, s, o, g, r, a, m) {
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) (i[r].q = i[r].q || []).push(arguments)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); }, 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('create', '{{google_analytics}}', 'auto');
ga('send', 'pageview'); ga('send', 'pageview');
@ -326,21 +380,32 @@
{{#if is_print}} {{#if is_print}}
{{#if mathjax_support}} {{#if mathjax_support}}
<script> <script>
window.addEventListener('load', function() { window.addEventListener('load', function () {
MathJax.Hub.Register.StartupHook('End', function() { MathJax.Hub.Register.StartupHook('End', function () {
window.setTimeout(window.print, 100); window.setTimeout(window.print, 100);
});
}); });
});
</script> </script>
{{else}} {{else}}
<script> <script>
window.addEventListener('load', function() { window.addEventListener('load', function () {
window.setTimeout(window.print, 100); window.setTimeout(window.print, 100);
}); });
</script> </script>
{{/if}} {{/if}}
{{/if}} {{/if}}
<script>
document.getElementById('popup-btn').addEventListener('click', function () {
var popupWindow = document.getElementById('popup-window');
if (popupWindow.classList.contains('show')) {
popupWindow.classList.remove('show');
} else {
popupWindow.classList.add('show');
}
});
</script>
</div> </div>
</body> </body>
</html> </html>