-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
161 lines (111 loc) · 3.94 KB
/
index.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Roc's Blog</title>
<meta name="description" content="求知若渴,虚心若愚" />
<link rel="shortcut icon" href="https://lzp0301.github.io//favicon.ico?v=1568950532648">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.10.0/katex.min.css">
<link rel="stylesheet" href="https://lzp0301.github.io//styles/main.css">
<script src="https://cdn.bootcss.com/highlight.js/9.12.0/highlight.min.js"></script>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Droid+Serif:400,700">
</head>
<body>
<div class="main">
<div class="main-content">
<div class="site-header">
<a href="https://lzp0301.github.io/">
<img class="avatar" src="https://lzp0301.github.io//images/avatar.png?v=1568950532648" alt="">
</a>
<h1 class="site-title">
Roc's Blog
</h1>
<p class="site-description">
求知若渴,虚心若愚
</p>
<div class="menu-container">
<a href="/" class="menu">
首页
</a>
<a href="/archives" class="menu">
归档
</a>
<a href="/tags" class="menu">
标签
</a>
<a href="/post/about" class="menu">
关于
</a>
</div>
<div class="social-container">
</div>
</div>
<div class="post-container">
<article class="post">
<a href="https://lzp0301.github.io//post/hello-gridea">
<h2 class="post-title">懒人 Github Page</h2>
</a>
<div class="post-info">
<span>
2019-09-20
</span>
<span>
1 min read
</span>
<a href="https://lzp0301.github.io//tag/wjDaKMZKc" class="post-tag">
# Gridea
</a>
</div>
<a href="https://lzp0301.github.io//post/hello-gridea" class="post-feature-image" style="background-image: url('https://lzp0301.github.io//post-images/hello-gridea.png')">
</a>
<div class="post-abstract">
</di>
</article>
</div>
<div class="pagination-container">
</div>
<div class="site-footer">
|
<a class="rss" href="https://lzp0301.github.io//atom.xml" target="_blank">RSS</a>
</div>
<script>
hljs.initHighlightingOnLoad()
let mainNavLinks = document.querySelectorAll(".markdownIt-TOC a");
// This should probably be throttled.
// Especially because it triggers during smooth scrolling.
// https://lodash.com/docs/4.17.10#throttle
// You could do like...
// window.addEventListener("scroll", () => {
// _.throttle(doThatStuff, 100);
// });
// Only not doing it here to keep this Pen dependency-free.
window.addEventListener("scroll", event => {
let fromTop = window.scrollY;
mainNavLinks.forEach((link, index) => {
let section = document.getElementById(decodeURI(link.hash).substring(1));
let nextSection = null
if (mainNavLinks[index + 1]) {
nextSection = document.getElementById(decodeURI(mainNavLinks[index + 1].hash).substring(1));
}
console.log('section.offsetHeight', section.offsetHeight);
if (section.offsetTop <= fromTop) {
if (nextSection) {
if (nextSection.offsetTop > fromTop) {
link.classList.add("current");
} else {
link.classList.remove("current");
}
} else {
link.classList.add("current");
}
} else {
link.classList.remove("current");
}
});
});
</script>
</div>
</div>
</body>
</html>