-
Notifications
You must be signed in to change notification settings - Fork 1
/
tmpl.html
87 lines (81 loc) · 3.93 KB
/
tmpl.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"/>
<link rel="icon" href="{{= meta.logo }}"/>
<title>{{= meta.title ? meta.title + ' - ' : '' }}{{= meta.name }}</title>
<style>
@font-face { font-family: Poppins; src: local('Poppins Light'), local('Poppins-Light'), url(//cdn.unpkg.net/~metadream/assets/font/poppins-light.woff2) format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; src: local('JetBrains Mono Light'), local('JetBrains-Mono-Light'), url(//cdn.unpkg.net/~metadream/assets/font/jetbrains-mono.woff2) format('woff2'); }
* { box-sizing: border-box; }
body { margin: 0; height: 100vh; display: flex; color: #3b454e; font: 15px/1.8 Poppins; overflow: hidden; }
main { flex: 1; padding: 5%; overflow: auto; }
h1 { font-size: 30px; color: #00ad5d; }
h2 { font-size: 24px; color:#4688f4; }
h3 { font-size: 18px; }
h1, h2, h3 { line-height: 1.5; margin: 20px 0 10px; }
hr { border: none; height: 1px; margin: 20px 0 10px; background: #eee; }
ul, ol { padding-left: 20px; }
img { display: block; max-width: 100%; }
a { color:#666; text-decoration: none; cursor: pointer; }
a:hover { color:#333; text-decoration: underline; }
a.actived { color: #333; font-weight:700; }
p:first-child, h1:first-child, h2:first-child { margin-top: 0; }
p:last-child { margin-bottom: 0; }
code { font-family: 'JetBrains Mono'; font-size: 14px; background: #f6f6f6; margin: 0 3px; padding: 3px 6px; border-radius: 3px; }
pre { padding: 15px 20px; background: #f6f6f6; border-radius: 5px; overflow-x: auto; }
pre code { margin: 0; padding: 0; }
pre::-webkit-scrollbar { height: 5px; }
pre::-webkit-scrollbar-thumb { background: #ddd; }
blockquote { border-left: #eee 4px solid; padding-left: 15px; margin: 0; color: #999; }
table { width: 100%; border-collapse: collapse; border: #eee 1px solid; }
table thead { background: #f6f6f6; }
table tr { border-top: #eee 1px solid; }
table th, table td { padding: 5px 10px; border-left: #eee 1px solid; }
aside { width: 300px; height: 100%; padding: 20px; background: #fff; border-right: #ddd 1px solid; overflow: auto; }
aside::-webkit-scrollbar { width: 5px; }
aside::-webkit-scrollbar-thumb { background: #eee; }
aside ul, aside ol { margin: 0; }
aside li { margin: 5px 0; }
aside h1 { font-size: 18px; }
aside h2 { font-size: 16px; }
aside h3 { font-size: 15px; }
footer { font-size: 13px; color: #999; text-align: center; margin-bottom: -10px; }
.logo { display: flex; justify-content: center; align-items: center; }
.logo img { width: 64px; height: 64px; }
.logo span { font-size: 32px; margin-left: 15px; color: #555; }
.logo:hover { text-decoration: none; }
.menu { display: none; position: fixed; z-index: 1; top: 0; right: 15px; padding: 10px; }
.menu svg { width: 24px; height: 24px; fill: #999; }
.mask { display: none; position: fixed; z-index: 2; left: 0; right: 0; top: 0; bottom: 0; background: rgba(0,0,0,.3); }
@media (max-width:640px) {
aside { position: absolute; z-index: 3; left: -300px; transition: left .3s; }
.menu { display: block; }
}
</style>
</head>
<body>
<aside>{{= summary }}</aside>
<main>{{= content }}</main>
<a class="menu" onclick="openSidebar()"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path d="M128 171h768v85H128v-85zm0 298h768v86H128v-86zm0 299h768v85H128v-85z"/></svg></a>
<div class="mask" onclick="closeSidebar()"></div>
</body>
</html>
<script>
const $mask = document.querySelector(".mask");
const $aside = document.querySelector("aside");
if (location.pathname != "/") {
const link = document.querySelector("aside a[href='" + location.pathname + "']");
link.className = "actived";
link.scrollIntoView({ block: "center" });
}
function openSidebar() {
$mask.style.display = "block";
$aside.style.left = 0;
}
function closeSidebar() {
$mask.style.display = "none";
$aside.style.left = '-300px';
}
</script>