改了下结构目录使之更可维护
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
:root {
|
||||
--dark-base-background: #222;
|
||||
--dark-base-color: #bbc0c4;
|
||||
--dark-theme-color: #42b983;
|
||||
--dark-heading-color: var(--dark-theme-color);
|
||||
--dark-cover-background: #000000a8;
|
||||
--dark-code-color: rgba(213, 213, 213, 0.68);
|
||||
--dark-code-background: rgba(42, 41, 41, 0.47);
|
||||
--dark-tip-background: #2c0000;
|
||||
--dark-warn-background: #005842;
|
||||
--dark-icon-size: 25px;
|
||||
--dark-icon-transition: .1s ease-in-out .1s;
|
||||
--dark-moon-color: #000000;
|
||||
--dark-sun-color: #ffffff;
|
||||
}
|
||||
|
||||
/*更改切换按钮的位置跟紫薯统计错开*/
|
||||
button[onclick="docsifyDarkSwitcher()"] {
|
||||
position: fixed;
|
||||
right: 10px;
|
||||
}
|
||||
|
||||
/*更改左下角菜单按钮防止跟深色模式冲突*/
|
||||
.docsify-dark-mode .sidebar-toggle span{
|
||||
background-color: #80eddd !important;
|
||||
}
|
||||
.docsify-dark-mode .sidebar-toggle {
|
||||
background: transparent !important;
|
||||
}
|
||||
|
||||
/*图片亮度*/
|
||||
.docsify-dark-mode .medium-zoom-image{
|
||||
filter: brightness(0.8);
|
||||
}
|
||||
|
||||
/*搜索栏适配夜间模式*/
|
||||
.docsify-dark-mode .search a {
|
||||
color: rgba(255, 255, 255, 0.65);
|
||||
}
|
||||
|
||||
.docsify-dark-mode .search a:hover{
|
||||
color: #ffffff !important;
|
||||
.search-keyword {
|
||||
color: rgba(99, 246, 111, 0.78);
|
||||
}
|
||||
}
|
||||
|
||||
.docsify-dark-mode .search .search-keyword {
|
||||
color: rgba(70, 185, 66, 0.55);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
.cover .mask {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
section.cover img:first-child {
|
||||
filter: drop-shadow(5px 5px 100px var(--theme-color, #42b983));
|
||||
}
|
||||
|
||||
section.cover .cover-main > p:last-child a {
|
||||
letter-spacing: -.1px;
|
||||
padding: 12px 24px;
|
||||
background-color: #ebebef;
|
||||
border: none;
|
||||
color: #000000;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
margin: 5px 8px;
|
||||
}
|
||||
|
||||
section.cover .cover-main > p:last-child a:last-child:hover {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
section.cover h1 span {
|
||||
color: var(--theme-color, #42b983);
|
||||
}
|
||||
|
||||
section.cover h1,
|
||||
section.cover blockquote {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
section.cover p:nth-last-child(2),
|
||||
section.cover ul {
|
||||
line-height: 1.5;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 960px) {
|
||||
section.cover .cover-main {
|
||||
margin: 0 72px;
|
||||
}
|
||||
|
||||
section.cover .cover-main,
|
||||
section.cover h1,
|
||||
section.cover blockquote {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
section.cover h1,
|
||||
section.cover blockquote {
|
||||
font-size: 56px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
section.cover p:nth-last-child(2),
|
||||
section.cover ul {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
section.cover p {
|
||||
max-width: 576px;
|
||||
}
|
||||
|
||||
section.cover .cover-main > p:last-child {
|
||||
margin-left: -8px;
|
||||
}
|
||||
|
||||
section.cover blockquote {
|
||||
margin-top: -52px;
|
||||
line-height: -1px;
|
||||
}
|
||||
|
||||
section.cover p:nth-last-child(2),
|
||||
section.cover ul {
|
||||
margin-top: -32px;
|
||||
}
|
||||
|
||||
section.cover p {
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
section.cover ul {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
section.cover img:first-child {
|
||||
float: right;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 75%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 540px;
|
||||
}
|
||||
}
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
.sidebar-nav li{position:relative;margin:0;cursor:pointer}.sidebar-nav ul:not(.app-sub-sidebar)>li:not(.file)::before{content:'';display:block;position:absolute;top:11px;left:-12px;height:6px;width:6px;border-right:1px solid #505d6b;border-bottom:1px solid #505d6b;transform:rotate(-45deg);transition:transform .1s}.sidebar-nav ul:not(.app-sub-sidebar)>li.open::before{transform:rotate(45deg)}.sidebar-nav ul:not(.app-sub-sidebar)>li.collapse::before{transform:rotate(-45deg)}
|
||||
@@ -0,0 +1,104 @@
|
||||
.content {
|
||||
display: flex;
|
||||
flex-direction: row-reverse;
|
||||
justify-content: center;
|
||||
}
|
||||
.markdown-section {
|
||||
flex: 1 1 0%;
|
||||
margin: 0 48px;
|
||||
}
|
||||
.nav {
|
||||
width: var(--toc-width, 200px);
|
||||
align-self: flex-start;
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
aside.nav.nothing {
|
||||
width: 0;
|
||||
}
|
||||
|
||||
.page_toc {
|
||||
position: fixed;
|
||||
border-left-style: solid;
|
||||
border-left-width: 1px;
|
||||
border-left-color: rgba(0, 0, 0, 0.07);
|
||||
border-image-slice: 1;
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
||||
.page_toc code {
|
||||
background-color: #f8f8f8;
|
||||
border-radius: 2px;
|
||||
color: #e96900;
|
||||
font-family: 'Roboto Mono', Monaco, courier, monospace;
|
||||
font-size: 0.8rem;
|
||||
margin: 0 2px;
|
||||
padding: 3px 5px;
|
||||
}
|
||||
|
||||
.page_toc p.title {
|
||||
margin: 0px 0 0px 9px;
|
||||
padding-bottom: 5px;
|
||||
font-weight: 600;
|
||||
font-size: 1.2em;
|
||||
}
|
||||
.page_toc .anchor:hover:after {
|
||||
content: "";
|
||||
}
|
||||
|
||||
.page_toc ul {
|
||||
list-style-type: none;
|
||||
margin-top: 0px;
|
||||
padding-left: 10px;
|
||||
color: var(--text-color-base, black);
|
||||
text-decoration: none;
|
||||
font-weight: 300;
|
||||
line-height: 1.6em;
|
||||
}
|
||||
|
||||
.page_toc ul a:hover span {
|
||||
color: var(--text-color-tertiary, #42b983);
|
||||
border-bottom: none !important;
|
||||
text-decoration:none !important;
|
||||
}
|
||||
|
||||
.page_toc ul a {
|
||||
color: var(--text-color-base, black);
|
||||
text-decoration: none;
|
||||
font-weight: 300;
|
||||
line-height: 1.6em;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1300px) {
|
||||
.page_toc {
|
||||
position: relative;
|
||||
left: 0;
|
||||
top: -20px;
|
||||
padding: 10px 0;
|
||||
border: none;
|
||||
border-bottom: 1px solid #ddd;
|
||||
font-size: 1.0em;
|
||||
}
|
||||
.page_toc a:before {
|
||||
content: "- ";
|
||||
}
|
||||
.nav {
|
||||
margin: 0 auto;
|
||||
width: 800px;
|
||||
}
|
||||
.page_toc p.title {
|
||||
font-weight: 300;
|
||||
font-size: 1.8em;
|
||||
}
|
||||
.content {
|
||||
display: block;
|
||||
}
|
||||
.markdown-section {
|
||||
margin: 0 auto;
|
||||
}
|
||||
}
|
||||
|
||||
.page_toc .active {
|
||||
border-left: 5px solid;
|
||||
color: var(--theme-color, #42b983);
|
||||
padding-left: 10px;
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,126 @@
|
||||
function docsifyDarkSwitcher() {
|
||||
var element = document.querySelector('body');
|
||||
element.classList.toggle("docsify-dark-mode");
|
||||
|
||||
if (element.classList.contains("docsify-dark-mode")) {
|
||||
localStorage.setItem('docsify-dark-mode', 'true');
|
||||
} else {
|
||||
localStorage.removeItem('docsify-dark-mode');
|
||||
}
|
||||
}
|
||||
|
||||
function applyInitialMode() {
|
||||
if (localStorage.getItem('docsify-dark-mode') === 'true' || window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
||||
document.querySelector('body').classList.add("docsify-dark-mode");
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', applyInitialMode);
|
||||
|
||||
function styleInject(css, ref) {
|
||||
if (ref === void 0) ref = {};
|
||||
var insertAt = ref.insertAt;
|
||||
|
||||
if (!css || typeof document === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
var head = document.head || document.getElementsByTagName('head')[0];
|
||||
var style = document.createElement('style');
|
||||
style.type = 'text/css';
|
||||
|
||||
if (insertAt === 'top') {
|
||||
if (head.firstChild) {
|
||||
head.insertBefore(style, head.firstChild);
|
||||
} else {
|
||||
head.appendChild(style);
|
||||
}
|
||||
} else {
|
||||
head.appendChild(style);
|
||||
}
|
||||
|
||||
if (style.styleSheet) {
|
||||
style.styleSheet.cssText = css;
|
||||
} else {
|
||||
style.appendChild(document.createTextNode(css));
|
||||
}
|
||||
}
|
||||
|
||||
var css = `
|
||||
:root {
|
||||
--dark-moon-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 16 16'%3E%3Cpath fill='currentColor' d='M9.598 1.591a.749.749 0 0 1 .785-.175 7.001 7.001 0 1 1-8.967 8.967.75.75 0 0 1 .961-.96 5.5 5.5 0 0 0 7.046-7.046.75.75 0 0 1 .175-.786m1.616 1.945a7 7 0 0 1-7.678 7.678 5.499 5.499 0 1 0 7.678-7.678'/%3E%3C/svg%3E");
|
||||
--dark-sun-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 16 16'%3E%3Cpath fill='currentColor' d='M8 12a4 4 0 1 1 0-8a4 4 0 0 1 0 8m0-1.5a2.5 2.5 0 1 0 0-5a2.5 2.5 0 0 0 0 5m5.657-8.157a.75.75 0 0 1 0 1.061l-1.061 1.06a.749.749 0 0 1-1.275-.326a.749.749 0 0 1 .215-.734l1.06-1.06a.75.75 0 0 1 1.06 0Zm-9.193 9.193a.75.75 0 0 1 0 1.06l-1.06 1.061a.75.75 0 1 1-1.061-1.06l1.06-1.061a.75.75 0 0 1 1.061 0M8 0a.75.75 0 0 1 .75.75v1.5a.75.75 0 0 1-1.5 0V.75A.75.75 0 0 1 8 0M3 8a.75.75 0 0 1-.75.75H.75a.75.75 0 0 1 0-1.5h1.5A.75.75 0 0 1 3 8m13 0a.75.75 0 0 1-.75.75h-1.5a.75.75 0 0 1 0-1.5h1.5A.75.75 0 0 1 16 8m-8 5a.75.75 0 0 1 .75.75v1.5a.75.75 0 0 1-1.5 0v-1.5A.75.75 0 0 1 8 13m3.536-1.464a.75.75 0 0 1 1.06 0l1.061 1.06a.75.75 0 0 1-1.06 1.061l-1.061-1.06a.75.75 0 0 1 0-1.061M2.343 2.343a.75.75 0 0 1 1.061 0l1.06 1.061a.751.751 0 0 1-.018 1.042a.751.751 0 0 1-1.042.018l-1.06-1.06a.75.75 0 0 1 0-1.06Z'/%3E%3C/svg%3E");
|
||||
}
|
||||
button[onclick="docsifyDarkSwitcher()"] {
|
||||
position: fixed;
|
||||
right: 2rem;
|
||||
top: 4rem;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
width: var(--dark-icon-size);
|
||||
height: var(--dark-icon-size);
|
||||
background: var(--dark-moon-color);
|
||||
mask-image: var(--dark-moon-icon);
|
||||
mask-size: var(--dark-icon-size) var(--dark-icon-size);
|
||||
transition: var(--dark-icon-transition);
|
||||
}
|
||||
.docsify-dark-mode button[onclick="docsifyDarkSwitcher()"] {
|
||||
background: var(--dark-sun-color);
|
||||
mask-image: var(--dark-sun-icon);
|
||||
}
|
||||
.docsify-dark-mode .cover .mask {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background: var(--dark-cover-background);
|
||||
}
|
||||
.docsify-dark-mode,
|
||||
.docsify-dark-mode .sidebar,
|
||||
.docsify-dark-mode .search input,
|
||||
.docsify-dark-mode .app-nav li ul {
|
||||
background: var(--dark-base-background);
|
||||
color: var(--dark-base-color);
|
||||
}
|
||||
.docsify-dark-mode .markdown-section code,
|
||||
.docsify-dark-mode .markdown-section pre,
|
||||
.docsify-dark-mode .markdown-section p.tip code {
|
||||
background: var(--dark-code-background);
|
||||
color: var(--dark-code-color);
|
||||
}
|
||||
.docsify-dark-mode .markdown-section p.tip {
|
||||
background: var(--dark-tip-background);
|
||||
}
|
||||
.docsify-dark-mode .markdown-section p.warn {
|
||||
background: var(--dark-warn-background);
|
||||
}
|
||||
.docsify-dark-mode .anchor span {
|
||||
color: var(--dark-heading-color);
|
||||
}
|
||||
.docsify-dark-mode .sidebar ul li.active>a {
|
||||
color: var(--dark-theme-color);
|
||||
border-color: var(--dark-theme-color);
|
||||
}
|
||||
.docsify-dark-mode .sidebar ul li a, .docsify-dark-mode .markdown-section strong {
|
||||
color: var(--dark-base-color);
|
||||
}
|
||||
.docsify-dark-mode .markdown-section tr:nth-child(2n) {
|
||||
background-color: #3b3b3b;
|
||||
}
|
||||
@media screen and (min-width:769px) {
|
||||
.docsify-dark-mode .sidebar-toggle {
|
||||
background: rgb(0 0 0 / .6);
|
||||
}
|
||||
}
|
||||
`;
|
||||
styleInject(css);
|
||||
|
||||
function install(hook, vm) {
|
||||
hook.afterEach(function (html) {
|
||||
var docsifyDarkSwitcherButton = '<button onclick="docsifyDarkSwitcher()" aria-label="Toggle dark mode" title="Toggle dark mode"></button>';
|
||||
return docsifyDarkSwitcherButton + html;
|
||||
});
|
||||
}
|
||||
|
||||
$docsify.plugins = [].concat(install, $docsify.plugins);
|
||||
@@ -0,0 +1,126 @@
|
||||
function docsifyDarkSwitcher() {
|
||||
var element = document.querySelector('body');
|
||||
element.classList.toggle("docsify-dark-mode");
|
||||
|
||||
if (element.classList.contains("docsify-dark-mode")) {
|
||||
localStorage.setItem('docsify-dark-mode', 'true');
|
||||
} else {
|
||||
localStorage.removeItem('docsify-dark-mode');
|
||||
}
|
||||
}
|
||||
|
||||
function applyInitialMode() {
|
||||
if (localStorage.getItem('docsify-dark-mode') === 'true' || window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
||||
document.querySelector('body').classList.add("docsify-dark-mode");
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', applyInitialMode);
|
||||
|
||||
function styleInject(css, ref) {
|
||||
if (ref === void 0) ref = {};
|
||||
var insertAt = ref.insertAt;
|
||||
|
||||
if (!css || typeof document === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
var head = document.head || document.getElementsByTagName('head')[0];
|
||||
var style = document.createElement('style');
|
||||
style.type = 'text/css';
|
||||
|
||||
if (insertAt === 'top') {
|
||||
if (head.firstChild) {
|
||||
head.insertBefore(style, head.firstChild);
|
||||
} else {
|
||||
head.appendChild(style);
|
||||
}
|
||||
} else {
|
||||
head.appendChild(style);
|
||||
}
|
||||
|
||||
if (style.styleSheet) {
|
||||
style.styleSheet.cssText = css;
|
||||
} else {
|
||||
style.appendChild(document.createTextNode(css));
|
||||
}
|
||||
}
|
||||
|
||||
var css = `
|
||||
:root {
|
||||
--dark-moon-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 16 16'%3E%3Cpath fill='currentColor' d='M9.598 1.591a.749.749 0 0 1 .785-.175 7.001 7.001 0 1 1-8.967 8.967.75.75 0 0 1 .961-.96 5.5 5.5 0 0 0 7.046-7.046.75.75 0 0 1 .175-.786m1.616 1.945a7 7 0 0 1-7.678 7.678 5.499 5.499 0 1 0 7.678-7.678'/%3E%3C/svg%3E");
|
||||
--dark-sun-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 16 16'%3E%3Cpath fill='currentColor' d='M8 12a4 4 0 1 1 0-8a4 4 0 0 1 0 8m0-1.5a2.5 2.5 0 1 0 0-5a2.5 2.5 0 0 0 0 5m5.657-8.157a.75.75 0 0 1 0 1.061l-1.061 1.06a.749.749 0 0 1-1.275-.326a.749.749 0 0 1 .215-.734l1.06-1.06a.75.75 0 0 1 1.06 0Zm-9.193 9.193a.75.75 0 0 1 0 1.06l-1.06 1.061a.75.75 0 1 1-1.061-1.06l1.06-1.061a.75.75 0 0 1 1.061 0M8 0a.75.75 0 0 1 .75.75v1.5a.75.75 0 0 1-1.5 0V.75A.75.75 0 0 1 8 0M3 8a.75.75 0 0 1-.75.75H.75a.75.75 0 0 1 0-1.5h1.5A.75.75 0 0 1 3 8m13 0a.75.75 0 0 1-.75.75h-1.5a.75.75 0 0 1 0-1.5h1.5A.75.75 0 0 1 16 8m-8 5a.75.75 0 0 1 .75.75v1.5a.75.75 0 0 1-1.5 0v-1.5A.75.75 0 0 1 8 13m3.536-1.464a.75.75 0 0 1 1.06 0l1.061 1.06a.75.75 0 0 1-1.06 1.061l-1.061-1.06a.75.75 0 0 1 0-1.061M2.343 2.343a.75.75 0 0 1 1.061 0l1.06 1.061a.751.751 0 0 1-.018 1.042a.751.751 0 0 1-1.042.018l-1.06-1.06a.75.75 0 0 1 0-1.06Z'/%3E%3C/svg%3E");
|
||||
}
|
||||
button[onclick="docsifyDarkSwitcher()"] {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 15px;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
width: var(--dark-icon-size);
|
||||
height: var(--dark-icon-size);
|
||||
background: var(--dark-moon-color);
|
||||
mask-image: var(--dark-moon-icon);
|
||||
mask-size: var(--dark-icon-size) var(--dark-icon-size);
|
||||
transition: var(--dark-icon-transition);
|
||||
}
|
||||
.docsify-dark-mode button[onclick="docsifyDarkSwitcher()"] {
|
||||
background: var(--dark-sun-color);
|
||||
mask-image: var(--dark-sun-icon);
|
||||
}
|
||||
.docsify-dark-mode .cover .mask {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background: var(--dark-cover-background);
|
||||
}
|
||||
.docsify-dark-mode,
|
||||
.docsify-dark-mode .sidebar,
|
||||
.docsify-dark-mode .search input,
|
||||
.docsify-dark-mode .app-nav li ul {
|
||||
background: var(--dark-base-background);
|
||||
color: var(--dark-base-color);
|
||||
}
|
||||
.docsify-dark-mode .markdown-section code,
|
||||
.docsify-dark-mode .markdown-section pre,
|
||||
.docsify-dark-mode .markdown-section p.tip code {
|
||||
background: var(--dark-code-background);
|
||||
color: var(--dark-code-color);
|
||||
}
|
||||
.docsify-dark-mode .markdown-section p.tip {
|
||||
background: var(--dark-tip-background);
|
||||
}
|
||||
.docsify-dark-mode .markdown-section p.warn {
|
||||
background: var(--dark-warn-background);
|
||||
}
|
||||
.docsify-dark-mode .anchor span {
|
||||
color: var(--dark-heading-color);
|
||||
}
|
||||
.docsify-dark-mode .sidebar ul li.active>a {
|
||||
color: var(--dark-theme-color);
|
||||
border-color: var(--dark-theme-color);
|
||||
}
|
||||
.docsify-dark-mode .sidebar ul li a, .docsify-dark-mode .markdown-section strong {
|
||||
color: var(--dark-base-color);
|
||||
}
|
||||
.docsify-dark-mode .markdown-section tr:nth-child(2n) {
|
||||
background-color: #3b3b3b;
|
||||
}
|
||||
@media screen and (min-width:769px) {
|
||||
.docsify-dark-mode .sidebar-toggle {
|
||||
background: rgb(0 0 0 / .6);
|
||||
}
|
||||
}
|
||||
`;
|
||||
styleInject(css);
|
||||
|
||||
function install(hook, vm) {
|
||||
hook.afterEach(function (html) {
|
||||
var docsifyDarkSwitcherButton = '<button onclick="docsifyDarkSwitcher()" aria-label="Toggle dark mode" title="Toggle dark mode"></button>';
|
||||
return docsifyDarkSwitcherButton + html;
|
||||
});
|
||||
}
|
||||
|
||||
$docsify.plugins = [].concat(install, $docsify.plugins);
|
||||
Vendored
+1
File diff suppressed because one or more lines are too long
+1
@@ -0,0 +1 @@
|
||||
!function(e){("object"!=typeof exports||"undefined"==typeof module)&&"function"==typeof define&&define.amd?define(e):e()}(function(){"use strict";function e(e,n){var t,a=(n=void 0===n?{}:n).insertAt;e&&"undefined"!=typeof document&&(t=document.head||document.getElementsByTagName("head")[0],(n=document.createElement("style")).type="text/css","top"===a&&t.firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e)))}var t;function a(e){e&&null!=t&&(e=e.getBoundingClientRect().top,document.querySelector(".sidebar").scrollBy(0,e-t))}function n(){requestAnimationFrame(function(){var e=document.querySelector(".app-sub-sidebar > .active");if(e)for(e.parentNode.parentNode.querySelectorAll(".app-sub-sidebar").forEach(function(e){return e.classList.remove("open")});e.parentNode.classList.contains("app-sub-sidebar")&&!e.parentNode.classList.contains("open");)e.parentNode.classList.add("open"),e=e.parentNode})}function o(e){t=e.target.getBoundingClientRect().top;var n=d(e.target,"LI",2);n&&(n.classList.contains("open")?(n.classList.remove("open"),setTimeout(function(){n.classList.add("collapse")},0)):(function(e){if(e)for(e.classList.remove("open","active");e&&"sidebar-nav"!==e.className&&e.parentNode;)"LI"!==e.parentNode.tagName&&"app-sub-sidebar"!==e.parentNode.className||e.parentNode.classList.remove("open"),e=e.parentNode}(s()),i(n),setTimeout(function(){n.classList.remove("collapse")},0)),a(n))}function s(){var e=document.querySelector(".sidebar-nav .active");return e||(e=d(document.querySelector('.sidebar-nav a[href="'.concat(decodeURIComponent(location.hash).replace(/ /gi,"%20"),'"]')),"LI",2))&&e.classList.add("active"),e}function i(e){if(e)for(e.classList.add("open","active");e&&"sidebar-nav"!==e.className&&e.parentNode;)"LI"!==e.parentNode.tagName&&"app-sub-sidebar"!==e.parentNode.className||e.parentNode.classList.add("open"),e=e.parentNode}function d(e,n,t){if(e&&e.tagName===n)return e;for(var a=0;e;){if(t<++a)return;if(e.parentNode.tagName===n)return e.parentNode;e=e.parentNode}}e(".sidebar-nav > ul > li ul {\n display: none;\n}\n\n.app-sub-sidebar {\n display: none;\n}\n\n.app-sub-sidebar.open {\n display: block;\n}\n\n.sidebar-nav .open > ul:not(.app-sub-sidebar),\n.sidebar-nav .active:not(.collapse) > ul {\n display: block;\n}\n\n/* 抖动 */\n.sidebar-nav li.open:not(.collapse) > ul {\n display: block;\n}\n\n.active + ul.app-sub-sidebar {\n display: block;\n}\n"),document.addEventListener("scroll",n);e("@media screen and (max-width: 768px) {\n /* 移动端适配 */\n .markdown-section {\n max-width: none;\n padding: 16px;\n }\n /* 改变原来按钮热区大小 */\n .sidebar-toggle {\n padding: 0 0 10px 10px;\n }\n /* my pin */\n .sidebar-pin {\n appearance: none;\n outline: none;\n position: fixed;\n bottom: 0;\n border: none;\n width: 40px;\n height: 40px;\n background: transparent;\n }\n}\n");var r,c="DOCSIFY_SIDEBAR_PIN_FLAG";function l(){var e="true"===(e=localStorage.getItem(c));localStorage.setItem(c,!e),e?(document.querySelector(".sidebar").style.transform="translateX(0)",document.querySelector(".content").style.transform="translateX(0)"):(document.querySelector(".sidebar").style.transform="translateX(300px)",document.querySelector(".content").style.transform="translateX(300px)")}768<document.documentElement.clientWidth||(localStorage.setItem(c,!1),(r=document.createElement("button")).classList.add("sidebar-pin"),r.onclick=l,document.body.append(r),window.addEventListener("load",function(){var n=document.querySelector(".content");document.body.onclick=n.onclick=function(e){e.target!==document.body&&e.currentTarget!==n||"true"===localStorage.getItem(c)&&l()}})),function(){if(window.$docsify){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];$docsify.plugins=n.concat($docsify.plugins||[])}else console.error("这是一个docsify插件,请先引用docsify库!")}(function(e,n){e.doneEach(function(e,n){var t=s();i(t),document.querySelectorAll(".sidebar-nav li").forEach(function(e){e.querySelector("ul:not(.app-sub-sidebar)")?e.classList.add("folder"):e.classList.add("file")}),function n(e,t){e&&e.childNodes&&e.childNodes.forEach(function(e){e.classList&&e.classList.contains("folder")&&(e.classList.add("level-".concat(t)),window.$docsify&&window.$docsify.sidebarDisplayLevel&&"number"==typeof window.$docsify.sidebarDisplayLevel&&t<=window.$docsify.sidebarDisplayLevel&&e.classList.add("open"),e&&1<e.childNodes.length&&n(e.childNodes[1],t+1))})}(document.querySelector(".sidebar-nav > ul"),1),a(t),n(e)}),e.ready(function(){document.querySelector(".sidebar-nav").addEventListener("click",o)})})});
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,164 @@
|
||||
function adjustFontSize(action) {
|
||||
const markdownSection = document.querySelector('.markdown-section#main');
|
||||
let currentSize = parseFloat(window.getComputedStyle(markdownSection).fontSize);
|
||||
|
||||
if (action === 'increase') {
|
||||
currentSize += 1;
|
||||
} else if (action === 'decrease') {
|
||||
currentSize -= 1;
|
||||
}
|
||||
|
||||
markdownSection.style.setProperty('--font-size', `${currentSize}px`);
|
||||
updateFontSizeDisplay(currentSize);
|
||||
localStorage.setItem('font-size', currentSize);
|
||||
}
|
||||
|
||||
function applyInitialStyles() {
|
||||
const savedSize = localStorage.getItem('font-size');
|
||||
if (savedSize) {
|
||||
const markdownSection = document.querySelector('.markdown-section#main');
|
||||
markdownSection.style.setProperty('--font-size', `${savedSize}px`);
|
||||
}
|
||||
}
|
||||
|
||||
function updateFontSizeDisplay(fontSize) {
|
||||
const fontSizeDisplay = document.querySelector('.font-size-display');
|
||||
const lang = document.documentElement.lang;
|
||||
if (fontSizeDisplay) {
|
||||
if (lang === 'zh') {
|
||||
fontSizeDisplay.textContent = `当前字体大小: ${fontSize}px`;
|
||||
} else {
|
||||
fontSizeDisplay.textContent = `Font size: ${fontSize}px`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', applyInitialStyles);
|
||||
|
||||
function styleInject(css, ref) {
|
||||
if (ref === void 0) ref = {};
|
||||
var insertAt = ref.insertAt;
|
||||
|
||||
if (!css || typeof document === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
var head = document.head || document.getElementsByTagName('head')[0];
|
||||
var style = document.createElement('style');
|
||||
style.type = 'text/css';
|
||||
|
||||
if (insertAt === 'top') {
|
||||
if (head.firstChild) {
|
||||
head.insertBefore(style, head.firstChild);
|
||||
} else {
|
||||
head.appendChild(style);
|
||||
}
|
||||
} else {
|
||||
head.appendChild(style);
|
||||
}
|
||||
|
||||
if (style.styleSheet) {
|
||||
style.styleSheet.cssText = css;
|
||||
} else {
|
||||
style.appendChild(document.createTextNode(css));
|
||||
}
|
||||
}
|
||||
|
||||
var css = `
|
||||
.markdown-section {
|
||||
--font-size: 17px;
|
||||
font-size: var(--font-size);
|
||||
}
|
||||
|
||||
.markdown-section code {
|
||||
font-size: calc(var(--font-size) - 2px) !important;
|
||||
}
|
||||
|
||||
.markdown-section ol, .markdown-section p, .markdown-section ul {
|
||||
line-height: calc(var(--font-size) * 2);
|
||||
}
|
||||
|
||||
.markdown-section h1 {
|
||||
font-size: calc(var(--font-size) * 2.3);
|
||||
}
|
||||
|
||||
.markdown-section h2 {
|
||||
font-size: calc(var(--font-size) * 2.1);
|
||||
}
|
||||
|
||||
.markdown-section h3 {
|
||||
font-size: calc(var(--font-size) * 1.8);
|
||||
}
|
||||
|
||||
.markdown-section h4 {
|
||||
font-size: calc(var(--font-size) * 1.5);
|
||||
}
|
||||
|
||||
.markdown-section h5 {
|
||||
font-size: calc(var(--font-size) * 1.3);
|
||||
}
|
||||
|
||||
.markdown-section h6 {
|
||||
font-size: calc(var(--font-size) * 1.1);
|
||||
}
|
||||
|
||||
button.font-size-button {
|
||||
position: absolute;
|
||||
top: 15px;
|
||||
right: 55px;
|
||||
padding: 6px;
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
z-index: 1000;
|
||||
font-size: 16px;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
button.font-size-button[onclick="adjustFontSize('decrease')"] {
|
||||
right: 100px;
|
||||
}
|
||||
|
||||
.docsify-dark-mode button.font-size-button {
|
||||
color: var(--dark-base-color);
|
||||
}
|
||||
|
||||
.font-size-display {
|
||||
position: absolute;
|
||||
top: 17px;
|
||||
right: 139px;
|
||||
background: transparent;
|
||||
font-size: 16px !important;
|
||||
z-index: 1000;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.font-size-display {
|
||||
top: 40px;
|
||||
right:10px;
|
||||
}
|
||||
}
|
||||
|
||||
.docsify-dark-mode .font-size-display{
|
||||
color: var(--dark-base-color);
|
||||
}
|
||||
`;
|
||||
|
||||
styleInject(css);
|
||||
|
||||
function install(hook, vm) {
|
||||
hook.afterEach(function (html) {
|
||||
const savedSize = localStorage.getItem('font-size') || 17;
|
||||
const lang = document.documentElement.lang;
|
||||
const fontSizeText = lang === 'zh' ? `当前字体大小: ${savedSize}px` : `Font size: ${savedSize}px`;
|
||||
var fontSizeButtons = `
|
||||
<button onclick="adjustFontSize('increase')" class="font-size-button" aria-label="Increase font size" title="Increase font size">A+</button>
|
||||
<button onclick="adjustFontSize('decrease')" class="font-size-button" aria-label="Decrease font size" title="Decrease font size">A-</button>
|
||||
<div class="font-size-display">${fontSizeText}</div>
|
||||
`;
|
||||
return fontSizeButtons + html;
|
||||
});
|
||||
}
|
||||
|
||||
$docsify.plugins = [].concat(install, $docsify.plugins);
|
||||
@@ -0,0 +1,170 @@
|
||||
var defaultOptions = {
|
||||
headings: 'h1, h2',
|
||||
scope: '.markdown-section',
|
||||
|
||||
// To make work
|
||||
title: 'Contents',
|
||||
listType: 'ul',
|
||||
}
|
||||
|
||||
// Element builders
|
||||
var tocHeading = function(Title) {
|
||||
return document.createElement('h2').appendChild(
|
||||
document.createTextNode(Title)
|
||||
)
|
||||
}
|
||||
|
||||
var aTag = function(src) {
|
||||
var a = document.createElement('a');
|
||||
var content = src.firstChild.innerHTML;
|
||||
|
||||
// Use this to clip text w/ HTML in it.
|
||||
// https://github.com/arendjr/text-clipper
|
||||
a.innerHTML = content;
|
||||
a.href = src.firstChild.href;
|
||||
a.onclick = tocClick
|
||||
|
||||
// In order to remove this gotta fix the styles.
|
||||
a.setAttribute('class', 'anchor');
|
||||
|
||||
return a
|
||||
};
|
||||
|
||||
var tocClick = function(e) {
|
||||
var divs = document.querySelectorAll('.page_toc .active');
|
||||
|
||||
// Remove the previous classes
|
||||
[].forEach.call(divs, function(div) {
|
||||
div.setAttribute('class', 'anchor')
|
||||
});
|
||||
|
||||
// Make sure this is attached to the parent not itself
|
||||
e.target.parentNode.setAttribute('class', 'active')
|
||||
};
|
||||
|
||||
var createList = function(wrapper, count) {
|
||||
while (count--) {
|
||||
wrapper = wrapper.appendChild(
|
||||
document.createElement('ul')
|
||||
);
|
||||
|
||||
if (count) {
|
||||
wrapper = wrapper.appendChild(
|
||||
document.createElement('li')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return wrapper;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
var getHeaders = function(selector) {
|
||||
var headings2 = document.querySelectorAll(selector);
|
||||
var ret = [];
|
||||
|
||||
[].forEach.call(headings2, function(heading) {
|
||||
ret = ret.concat(heading);
|
||||
});
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
var getLevel = function(header) {
|
||||
var decs = header.match(/\d/g);
|
||||
|
||||
return decs ? Math.min.apply(null, decs) : 1;
|
||||
};
|
||||
|
||||
var jumpBack = function(currentWrapper, offset) {
|
||||
while (offset--) {
|
||||
currentWrapper = currentWrapper.parentElement;
|
||||
}
|
||||
|
||||
return currentWrapper;
|
||||
};
|
||||
|
||||
var buildTOC = function(options) {
|
||||
var ret = document.createElement('ul');
|
||||
var wrapper = ret;
|
||||
var lastLi = null;
|
||||
var selector = options.scope + ' ' + options.headings
|
||||
var headers = getHeaders(selector)
|
||||
|
||||
headers.reduce(function(prev, curr, index) {
|
||||
var currentLevel = getLevel(curr.tagName);
|
||||
var offset = currentLevel - prev;
|
||||
|
||||
wrapper = (offset > 0)
|
||||
? createList(lastLi, offset)
|
||||
: jumpBack(wrapper, -offset * 2)
|
||||
|
||||
wrapper = wrapper || ret;
|
||||
|
||||
var li = document.createElement('li');
|
||||
|
||||
wrapper.appendChild(li).appendChild(aTag(curr));
|
||||
|
||||
lastLi = li;
|
||||
|
||||
return currentLevel;
|
||||
}, getLevel(options.headings));
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
// Docsify plugin functions
|
||||
function plugin(hook, vm) {
|
||||
var userOptions = vm.config.toc;
|
||||
|
||||
hook.mounted(function () {
|
||||
var content = window.Docsify.dom.find(".content");
|
||||
if (content) {
|
||||
var nav = window.Docsify.dom.create("aside", "");
|
||||
window.Docsify.dom.toggleClass(nav, "add", "nav");
|
||||
window.Docsify.dom.before(content, nav);
|
||||
}
|
||||
});
|
||||
|
||||
hook.doneEach(function () {
|
||||
var nav = document.querySelectorAll('.nav')[0]
|
||||
var t = Array.from(document.querySelectorAll('.nav'))
|
||||
|
||||
if (!nav) {
|
||||
return;
|
||||
}
|
||||
|
||||
const toc = buildTOC(userOptions);
|
||||
|
||||
// Just unset it for now.
|
||||
if (!toc.innerHTML) {
|
||||
nav.innerHTML = null
|
||||
return;
|
||||
}
|
||||
|
||||
// Fix me in the future
|
||||
var title = document.createElement('p');
|
||||
title.innerHTML = userOptions.title;
|
||||
title.setAttribute('class', 'title');
|
||||
|
||||
var container = document.createElement('div');
|
||||
container.setAttribute('class', 'page_toc');
|
||||
|
||||
container.appendChild(title);
|
||||
container.appendChild(toc);
|
||||
|
||||
// Existing TOC
|
||||
var tocChild = document.querySelectorAll('.nav .page_toc');
|
||||
|
||||
if (tocChild.length > 0) {
|
||||
tocChild[0].parentNode.removeChild(tocChild[0]);
|
||||
}
|
||||
|
||||
nav.appendChild(container);
|
||||
});
|
||||
}
|
||||
|
||||
// Docsify plugin options
|
||||
window.$docsify['toc'] = Object.assign(defaultOptions, window.$docsify['toc']);
|
||||
window.$docsify.plugins = [].concat(plugin, window.$docsify.plugins);
|
||||
Reference in New Issue
Block a user