refactor: better load performance

This commit is contained in:
Colin
2022-05-06 16:14:56 +08:00
parent c27c816cbd
commit 77d3d4a3ae
5 changed files with 164 additions and 170 deletions

View File

@@ -1,91 +1,3 @@
<div id="gitalk-container" style="
margin: 20px auto;
max-width: 800px;
padding: 20px;
width: 100%;
text-align: left;
"></div>
<div class='js-toc'></div>
<style>
@media (min-width: 1560px) {
.js-toc {
display: block !important;
}
}
.js-toc {
display: none;
/* IE and Edge */
-ms-overflow-style: none;
/* Firefox */
scrollbar-width: none;
}
.js-toc::-webkit-scrollbar {
/* Chrome, Safari and Opera */
display: none;
}
.js-toc {
position: fixed;
width: 20%;
max-width: 400px;
right: 3rem;
top: 10em;
text-align: left;
overflow-y: scroll;
overflow-x: hidden;
padding: 1rem 0rem;
}
ol.toc-list>li>a:hover {
text-underline-position: under;
font-weight: bolder;
}
.toc-list li {
list-style: none;
}
.toc-list a {
text-decoration: none;
text-overflow: ellipsis;
display: inline-block;
white-space: nowrap;
font-size: 1rem;
}
.is-active-link::before {
background-color: #d71a1b !important;
}
.logo__cursor {
background: #d71a1b;
}
</style>
<!-- 超链接样式 -->
<style>
.post-tags a,
.post-content a {
text-decoration: none;
border-bottom: 1px dashed #d71a1b;
-webkit-transition: all .2s;
transition: all .2s;
}
.post-tags a:hover,
.post-content a:hover,
nav a:hover {
text-decoration: none;
border-bottom: 2px solid #d71a1b;
-webkit-transition: all .1s ease;
transition: all .1s ease;
}
</style>
<footer class="footer">
<span id="busuanzi_container_site_pv" style='display:none'>
嗨,第<span id="busuanzi_value_site_pv"></span>位小伙伴 : )
@@ -106,23 +18,4 @@
</div>
</footer>
<script async src="{{ "assets/prism.js" | absURL }}"></script>
<script src="{{ "assets/main.js" | absURL }}"></script>
<script>
let meta = document.querySelectorAll('.post:not(.on-list) .post-meta')[0];
const visitors = `<span id="busuanzi_container_page_pv" style='display:none'> 浏览:<span id="busuanzi_value_page_pv"></span>次</span>`
if (meta) meta.innerHTML = meta.innerHTML + visitors
</script>
<script src="https://cdn.jsdelivr.net/npm/pangu@4/dist/browser/pangu.min.js"></script>
<script>
pangu.spacingElementByClassName('post');
pangu.spacingElementByTagName('p');
document.addEventListener('DOMContentLoaded', () => {
// listen to any DOM change and automatically perform spacing via MutationObserver()
pangu.autoSpacingPage();
});
</script>
{{- partial "extended_footer.html" . }}