Skip to content

Commit

Permalink
update from gridea: 2020-03-04 08:25:09
Browse files Browse the repository at this point in the history
  • Loading branch information
Sata-moto committed Mar 4, 2020
1 parent dee84b1 commit 285ecac
Show file tree
Hide file tree
Showing 33 changed files with 2,942 additions and 48 deletions.
2 changes: 1 addition & 1 deletion archives/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta name="keywords" content="Gridea静态个人博客">
<meta name="description" content="从远方而来,归往远方
">
<link rel="shortcut icon" href="https://sata-moto.github.io/favicon.ico?v=1583281070944">
<link rel="shortcut icon" href="https://sata-moto.github.io/favicon.ico?v=1583281497194">
<link rel="stylesheet" href="https://sata-moto.github.io/styles/main.css">

<link rel="stylesheet" href="/media/css/gemini.css">
Expand Down
2 changes: 1 addition & 1 deletion atom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<feed xmlns="http://www.w3.org/2005/Atom">
<id>https://sata-moto.github.io</id>
<title>Sata_moto&apos;s Blog</title>
<updated>2020-03-04T00:17:54.435Z</updated>
<updated>2020-03-04T00:25:05.134Z</updated>
<generator>https://github.com/jpmonette/feed</generator>
<link rel="alternate" href="https://sata-moto.github.io"/>
<link rel="self" href="https://sata-moto.github.io/atom.xml"/>
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta name="keywords" content="Gridea静态个人博客">
<meta name="description" content="从远方而来,归往远方
">
<link rel="shortcut icon" href="https://sata-moto.github.io/favicon.ico?v=1583281070944">
<link rel="shortcut icon" href="https://sata-moto.github.io/favicon.ico?v=1583281497194">
<link rel="stylesheet" href="https://sata-moto.github.io/styles/main.css">

<link rel="stylesheet" href="/media/css/gemini.css">
Expand Down
Binary file modified media/images/custom-bgImg.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion page/2/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta name="keywords" content="Gridea静态个人博客">
<meta name="description" content="从远方而来,归往远方
">
<link rel="shortcut icon" href="https://sata-moto.github.io/favicon.ico?v=1583281070944">
<link rel="shortcut icon" href="https://sata-moto.github.io/favicon.ico?v=1583281497194">
<link rel="stylesheet" href="https://sata-moto.github.io/styles/main.css">

<link rel="stylesheet" href="/media/css/gemini.css">
Expand Down
194 changes: 192 additions & 2 deletions post/QDResjPWl/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta name="keywords" content="Gridea静态个人博客">
<meta name="description" content="从远方而来,归往远方
">
<link rel="shortcut icon" href="https://sata-moto.github.io/favicon.ico?v=1583281070944">
<link rel="shortcut icon" href="https://sata-moto.github.io/favicon.ico?v=1583281497194">
<link rel="stylesheet" href="https://sata-moto.github.io/styles/main.css">

<link rel="stylesheet" href="/media/css/gemini.css">
Expand Down Expand Up @@ -131,9 +131,17 @@
<div class="sidebar">
<div class="sidebar-box box-shadow-wrapper bg-color right-motion" id="sidebar">

<div class="post-list-sidebar">
<div class="sidebar-title">
<span id="tocSideBar" class="sidebar-title-item sidebar-title-active">文章目录</span>
<span id="metaSideBar" class="sidebar-title-item">站点概览</span>
</div>
</div>

<div class="sidebar-body gemini" id="sidebar_body">


<div class="post-side-meta" id="post_side_meta">

<div class="sidebar-wrapper box-shadow-wrapper bg-color">
<div class="sidebar-item">
<img class="site-author-image right-motion" src="https://sata-moto.github.io/images/avatar.png"/>
Expand Down Expand Up @@ -188,6 +196,188 @@


</div>
</div>
<div class="post-toc sidebar-body-active" id="post_toc" style="opacity: 1;">
<div class="toc-box right-motion">
<div class="toc-wrapper auto-number auto" id="toc_wrapper">
<ul class="markdownIt-TOC">
<li>
<ul>
<li>
<ul>
<li><a href="#lucas%E8%BF%99%E4%B8%AA%E5%90%8D%E5%AD%97%E8%B2%8C%E4%BC%BC%E6%8C%BA%E5%B8%B8%E8%A7%81%E7%9A%84%E6%9D%A5%E7%9D%80">Lucas这个名字貌似挺常见的来着?</a></li>
<li><a href="#%E5%89%8D%E8%A8%80">前言:</a></li>
<li><a href="#%E6%AD%A3%E6%96%87">正文:</a></li>
<li><a href="#%E7%BB%93%E8%AF%AD">结语:</a></li>
</ul>
</li>
</ul>
</li>
</ul>

</div>
</div>

<script>

let lastTop = 0, lList = [], hList = [], postBody, lastIndex = -1;
let active = 'active-show', activeClass = 'active-current';
let tocWrapper = document.querySelector('#toc_wrapper');
let tocContent = tocWrapper.children[0];
let autoNumber = tocWrapper&&tocWrapper.classList.contains('auto-number');

function addTocNumber(elem, deep) {
if (!elem) {
return;
}
let prop = elem.__proto__;

if (prop === HTMLUListElement.prototype) {
for (let i = 0; i < elem.children.length; i++) {
addTocNumber(elem.children[i], deep + (i + 1) + '.');
}
} else if (prop === HTMLLIElement.prototype) {
// 保存li元素
lList.push(elem);
for (let i = 0; i < elem.children.length; i++) {
let cur = elem.children[i];
if (cur.__proto__ === HTMLAnchorElement.prototype) {
if (autoNumber) {
cur.text = deep + ' ' + cur.text;
}
} else if (cur.__proto__ === HTMLUListElement.prototype) {
addTocNumber(cur, deep);
}
}
}
}


document.addEventListener('scroll', function(e) {
if (lList.length <= 0) {
return;
}
let scrollTop = document.scrollingElement.scrollTop;
let dir;

if (lastTop - scrollTop > 0) {
dir = 'up';
} else {
dir = 'down';
}

lastTop = scrollTop;
if (scrollTop <= 0) {
if (lastIndex >= 0 && lastIndex < hList.length) {
lList[lastIndex].classList.remove(activeClass);
}
return;
}

let current = 0, hasFind = false;
for (let i = 0; i < hList.length; i++) {
if (hList[i].offsetTop > scrollTop) {
current = i;
hasFind = true;
break;
}
}
if (!hasFind && scrollTop > lList[lList.length - 1].offsetTop) {
current = hList.length - 1;
} else {
current--;
}
if (dir === 'down') {
if (current > lastIndex) {
addActiveClass(current);
removeActiveClass(lastIndex)
lastIndex = current;
removeParentActiveClass();
lList[current] && addActiveLiElemment(lList[current].parentElement,tocContent);
}
} else {
if (current < lastIndex) {
addActiveClass(current);
removeActiveClass(lastIndex);
lastIndex = current;
removeParentActiveClass();
lList[current] && addActiveLiElemment(lList[current].parentElement,tocContent);
}
}
});

function removeParentActiveClass() {
let parents = tocContent.querySelectorAll('.'+active)
parents.forEach(function(elem) {
elem.classList.remove(active);
});
}

function addActiveClass(index) {
if (index >= 0 && index < hList.length) {
lList[index].classList.add(activeClass);
}
}

function removeActiveClass(index) {
if (index >= 0 && index < hList.length) {
lList[index].classList.remove(activeClass);
}
}

function addActiveLiElemment(elem, parent) {
if (!elem || elem === parent) {
return;
} else {
if (elem.__proto__ === HTMLLIElement.prototype) {
elem.classList.add(active);
}
addActiveLiElemment(elem.parentElement, parent);
}
}

function showToc() {
if (tocWrapper) {
postBody = document.querySelector('#post_body');
for (let i = 0; i < postBody.children.length; i++) {
if (postBody.children[i].__proto__ === HTMLHeadingElement.prototype) {
hList.push(postBody.children[i]);
}
}
if (tocWrapper.classList.contains('compress')) {
tocContent.classList.add('closed');
} else if (tocWrapper.classList.contains('no_compress')){
tocContent.classList.add('expanded');
} else {
if (hList.length > 10) {
active = 'active-hidden'
tocContent.classList.add('closed');
} else {
tocContent.classList.add('expanded');
}
}
}
}
addTocNumber(tocContent, '');

window.addEventListener('load', function() {
showToc();
document.querySelector('#sidebar').style='display: block;';
tocWrapper.classList.add('toc-active');
setTimeout(function() {
if ("createEvent" in document) {
let evt = document.createEvent("HTMLEvents");
evt.initEvent("scroll", false, true);
document.dispatchEvent(evt);
}
else {
document.fireEvent("scroll");
}
}, 500)
})

</script>
</div>

</div>
</div>
Expand Down
Loading

0 comments on commit 285ecac

Please sign in to comment.