调整 logo,调整 js

This commit is contained in:
liuzhihang 2022-10-21 21:13:08 +08:00
parent 95e6e460ae
commit e28c60f060
24 changed files with 223 additions and 810 deletions

131
TODO.md
View File

@ -1,131 +0,0 @@
### 全站
- [ ] 自定义字体
- [ ] 自定义背景图
- [ ] 响应式主题
- [ ] 自定义社交渠道
- [ ] 页面加载条
- [ ] RSS 订阅
- [ ] 页面元数据控制 百度收录查询 + 主动推送
- [ ] 谷歌分析收录
- [ ] 全站 Pjax
- [ ] 多主题风格设置 (支持夜间模式)
- [ ] 开发者模式提示
- [ ] 复制等操作提示
### 菜单栏
- [ ] 相关链接
- [ ] Home 主页
- [ ] 多级菜单
- [ ] 随机文章
- [ ] 随机友链
- [ ] 文章搜索
- [ ] 控制台
- [ ] 滚动条百分比
### 首页
- [ ] 随机文章(背景图设置)
- [ ] 固定文章
- [ ] 推荐文章
### 导航栏
- [ ] 自定义导航目录
### 文章列表
- [ ] 自定义单栏、双栏、三栏
- [ ] 封面图缺省随机
- [ ] 文章简介控制
- [ ] 自定义分页
### 侧边栏
- [ ] 侧栏控制,左右及隐藏
#### 自我介绍
- [ ] 自定义欢迎标题
- [ ] 自定义名称
- [ ] 自定义介绍内容
- [ ] 自定义跳转
- [ ] 自定义社交渠道 < 2
#### 推广
- [ ] 公众号图配置
#### 标签
- [ ] 标签列表
- [ ] 自定义标签突出
#### 归档
- [ ] 自定义归档 (列表、日历)
#### 最近评论
#### 分类
#### 广告
#### 站点信息
- [ ] 文章总数
- [ ] 建站天数
- [ ] 全站字数
- [ ] 访问统计
#### 目录
- [ ] 目录跳转 (仅文章页面)
- [ ] 多级目录
#### 最近文章
- [ ] 自定义最近文章
### 底部
- [ ] 社交链接展示
- [ ] 自定义相关链接
- [ ] 版权信息设置
- [ ] 随机友链
### 文章页面
- [ ] 字数、阅读时长、时间、访问量、留言数等信息展示
- [ ] 标签、目录展示
- [ ] 自定义过期提示
- [ ] 自定义代码高亮
- [ ] 代码高亮 + 行号 + 复制 + 折叠
- [ ] 文章分享 AddThis/Sharejs/Addtoany
- [ ] 二维码打赏
- [ ] 文章页复制版权
- [ ] 阅读模式
- [ ] Mathjax 和 Katex
- [ ] 自定义文章开头、结尾
- [ ] 自定义相关文章推荐
- [ ] 上一篇下一篇文章展示
### 评论模块
- [ ] UI 设置
### 右键菜单
- [ ] 自定义右键菜单
### 页面
- [ ] 隐私协议
- [ ] 版权协议
- [ ] Cookies
- [ ] 友链
- [ ] 日志
- [ ] 相册
- [ ] 标签页
- [ ] 分类页

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -82,14 +82,6 @@ document.addEventListener("DOMContentLoaded", function () {
})
}
function A() {
var a, c, r, s, l, d, u = document.getElementById("rightside"), f = window.innerHeight + 56;
document.body.scrollHeight <= f ? u.style.cssText = "opacity: 1; transform: translateX(-38px)" : (c = !(a = 0), r = document.getElementById("page-header"), document.getElementById("guli_top"), s = document.getElementById("cookies-window"), l = "function" == typeof chatBtnHide, d = "function" == typeof chatBtnShow, window.addEventListener("scroll", btf.throttle(function (t) {
var e, n, o = window.scrollY || document.documentElement.scrollTop, i = (n = a < (e = o), a = e, n);
56 < o ? (i ? (r.classList.contains("nav-visible") && r.classList.remove("nav-visible"), d && !0 === c && (chatBtnHide(), c = !1)) : (r.classList.contains("nav-visible") || r.classList.add("nav-visible"), l && !1 === c && (chatBtnShow(), c = !0)), r.classList.add("nav-fixed"),"0" === window.getComputedStyle(u).getPropertyValue("opacity") && (u.style.cssText = "opacity: 1; transform: translateX(-38px)")) : (0 === o && r.classList.remove("nav-fixed", "nav-visible"), u.style.cssText = "opacity: ''; transform: ''"), document.body.scrollHeight <= f && (u.style.cssText = "opacity: 1; transform: translateX(-38px)")
}, 200)))
}
function S() {
var t = document.getElementById("card-toc"), r = t.getElementsByClassName("toc-content")[0],
s = r.querySelectorAll(".toc-link"), c = document.getElementById("article-container");
@ -104,8 +96,6 @@ document.addEventListener("DOMContentLoaded", function () {
o = (t - c.offsetTop) / (n < e ? e - n : document.documentElement.scrollHeight - n),
i = Math.round(100 * o), a = 100 < i ? 100 : i <= 0 ? 0 : i;
r.setAttribute("progress-percentage", a)
}, l = GLOBAL_CONFIG.isanchor, n = function () {
t.style.cssText = "animation: toc-open .3s; opacity: 1; right: 45px"
}, o = function () {
t.style.animation = "toc-close .2s", setTimeout(function () {
t.style.cssText = "opacity:''; animation: ''; right: ''"
@ -125,8 +115,7 @@ document.addEventListener("DOMContentLoaded", function () {
n > btf.getEleTop(t) - 80 && (o = "#" + encodeURI(t.getAttribute("id")), i = e)
}), u !== i) {
if (l && (t = o, window.history.replaceState && t !== window.location.hash && (t = t || location.pathname, e = GLOBAL_CONFIG_SITE.title, window.history.replaceState({
url: location.href,
title: e
url: location.href, title: e
}, e, t))), "" === o) return r.querySelectorAll(".active").forEach(function (t) {
t.classList.remove("active")
}), void (u = i);
@ -143,60 +132,11 @@ document.addEventListener("DOMContentLoaded", function () {
}
}
var d = !1, e = function () {
var e = document.body;
e.classList.add("read-mode");
var n = document.createElement("button");
n.type = "button", n.className = "fas fa-sign-out-alt exit-readmode", e.appendChild(n), n.addEventListener("click", function t() {
e.classList.remove("read-mode"), n.remove(), n.removeEventListener("click", t)
})
}, n = function () {
var d = !1, n = function () {
"light" == ("dark" === document.documentElement.getAttribute("data-theme") ? "dark" : "light") ? (activateDarkMode(), saveToLocal.set("theme", "dark", 2), void 0 !== GLOBAL_CONFIG.Snackbar && btf.snackbarShow(GLOBAL_CONFIG.Snackbar.day_to_night, !1, 2e3)) : (activateLightMode(), saveToLocal.set("theme", "light", 2), void 0 !== GLOBAL_CONFIG.Snackbar && btf.snackbarShow(GLOBAL_CONFIG.Snackbar.night_to_day, !1, 2e3)), "function" == typeof utterancesTheme && utterancesTheme(), "object" === ("undefined" == typeof FB ? "undefined" : _typeof(FB)) && window.loadFBComment(), window.DISQUS && document.getElementById("disqus_thread").children.length && setTimeout(function () {
return window.disqusReset()
}, 200)
}, u = function () {
document.getElementById("rightside-config-hide").classList.toggle("show")
}, f = function () {
btf.scrollToDest(0, 500)
}, m = function () {
var t = document.documentElement.classList;
t.contains("hide-aside") ? saveToLocal.set("aside-status", "show", 2) : saveToLocal.set("aside-status", "hide", 2), t.toggle("hide-aside")
}, h = function (t) {
var e = parseInt(window.getComputedStyle(document.documentElement).getPropertyValue("--global-font-size")),
n = "";
if (t) {
if (20 <= e) return;
n = e + 1, document.documentElement.style.setProperty("--global-font-size", n + "px"), document.getElementById("nav").classList.contains("hide-menu") || L(!0)
} else {
if (e <= 10) return;
n = e - 1, document.documentElement.style.setProperty("--global-font-size", n + "px"), document.getElementById("nav").classList.contains("hide-menu") && L(!0)
}
saveToLocal.set("global-font-size", n, 2)
};
document.getElementById("rightside").addEventListener("click", function (t) {
switch (t.target.id || t.target.parentNode.id) {
case"go-up":
f();
break;
case"rightside_config":
u();
break;
case"readmode":
e();
break;
case"darkmode":
n();
break;
case"hide-aside-btn":
m();
break;
case"font-plus":
h(!0);
break;
case"font-minus":
h()
}
});
function I(t) {
t.forEach(function (t) {
@ -237,46 +177,56 @@ document.addEventListener("DOMContentLoaded", function () {
})
})), l = document.getElementById("toggle-menu"), d = document.getElementById("sidebar-menus"), u = document.getElementById("menu-mask"), f = document.body, l.addEventListener("click", function () {
btf.sidebarPaddingR(), f.style.overflow = "hidden", btf.fadeIn(u, .5), d.classList.add("open")
}), window.addEventListener("resize", function (t) {
});
window.addEventListener("resize", function (t) {
btf.isHidden(l) && v()
}), GLOBAL_CONFIG.isPhotoFigcaption && document.querySelectorAll("#article-container img").forEach(function (t) {
var e, n = t.parentNode;
n.parentNode.classList.contains("justified-gallery") || ((e = document.createElement("div")).className = "img-alt is-center", e.textContent = t.getAttribute("alt"), n.insertBefore(e, t.nextSibling))
}), w(), "mediumZoom" === GLOBAL_CONFIG.lightbox && (h = mediumZoom(document.querySelectorAll("#article-container :not(a)>img"))).on("open", function (t) {
});
w();
"mediumZoom" === GLOBAL_CONFIG.lightbox && (h = mediumZoom(document.querySelectorAll("#article-container :not(a)>img"))).on("open", function (t) {
var e = "dark" === document.documentElement.getAttribute("data-theme") ? "#121212" : "#fff";
h.update({background: e})
}), A(), (g = document.querySelectorAll("#article-container :not(.highlight) > table, #article-container > table")).length && g.forEach(function (t) {
});
(g = document.querySelectorAll("#article-container :not(.highlight) > table, #article-container > table")).length && g.forEach(function (t) {
btf.wrap(t, "div", "", "table-wrap")
}), (y = document.querySelectorAll("#article-container .hide-button")).length && y.forEach(function (t) {
});
(y = document.querySelectorAll("#article-container .hide-button")).length && y.forEach(function (t) {
t.addEventListener("click", function (t) {
var e = this.nextElementSibling;
this.classList.toggle("open"), this.classList.contains("open") && 0 < e.querySelectorAll(".justified-gallery").length && btf.initJustifiedGallery(e.querySelectorAll(".justified-gallery"))
})
}), O(), G(), p = !1, (b = document.querySelector("#comment-switch > .switch-btn")) && b.addEventListener("click", function () {
});
O();
G();
p = !1;
(b = document.querySelector("#comment-switch > .switch-btn")) && b.addEventListener("click", function () {
this.classList.toggle("move"), document.querySelectorAll("#post-comment > .comment-wrap > div").forEach(function (t) {
btf.isHidden(t) ? t.style.cssText = "display: block;animation: tabshow .5s" : t.style.cssText = "display: none;animation: ''"
}), p || "function" != typeof loadOtherComment || (p = !0, loadOtherComment())
})
}, refreshFn(), window.addEventListener("resize", L), window.addEventListener("orientationchange", function () {
});
p || "function" != typeof loadOtherComment || (p = !0, loadOtherComment())
});
};
refreshFn();
window.addEventListener("resize", L);
window.addEventListener("orientationchange", function () {
setTimeout(L(!0), 100)
}), document.querySelectorAll("#sidebar-menus .expand").forEach(function (t) {
});
document.querySelectorAll("#sidebar-menus .expand").forEach(function (t) {
t.addEventListener("click", function () {
this.classList.toggle("hide");
var t = this.parentNode.nextElementSibling;
btf.isHidden(t) ? t.style.display = "block" : t.style.display = "none"
})
}), window.addEventListener("touchmove", function (t) {
});
window.addEventListener("touchmove", function (t) {
document.querySelectorAll("#nav .menus_item_child").forEach(function (t) {
btf.isHidden(t) || (t.style.display = "none")
})
}), GLOBAL_CONFIG.islazyload && (window.lazyLoadInstance = new LazyLoad({
elements_selector: "img",
threshold: 0,
data_src: "lazy-src"
})), void 0 !== GLOBAL_CONFIG.copyright && (g = GLOBAL_CONFIG.copyright, document.body.oncopy = function (t) {
t.preventDefault();
var e = window.getSelection(0).toString(),
n = e.length > g.limitCount ? e + "\n\n\n" + g.languages.author + "\n" + g.languages.link + window.location.href + "\n" + g.languages.source + "\n" + g.languages.info : e;
return t.clipboardData ? t.clipboardData.setData("text", n) : window.clipboardData.setData("text", n)
})
});
});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,95 +0,0 @@
.snackbar-container {
transition: all 500ms ease;
transition-property: top, right, bottom, left, opacity;
font-family: Roboto, sans-serif;
font-size: 14px;
min-height: 14px;
background-color: #070b0e;
position: fixed;
display: flex;
justify-content: space-between;
align-items: center;
color: white;
line-height: 22px;
padding: 18px 24px;
bottom: -100px;
top: -100px;
opacity: 0;
z-index: 9999;
}
.snackbar-container .action {
background: inherit;
display: inline-block;
border: none;
font-size: inherit;
text-transform: uppercase;
color: #4caf50;
margin: 0 0 0 24px;
padding: 0;
min-width: min-content;
cursor: pointer;
}
@media (min-width: 640px) {
.snackbar-container {
min-width: 288px;
max-width: 568px;
display: inline-flex;
border-radius: 2px;
margin: 24px;
}
}
@media (max-width: 640px) {
.snackbar-container {
left: 0;
right: 0;
width: 100%;
}
}
.snackbar-pos.bottom-center {
top: auto !important;
bottom: 0;
left: 50%;
transform: translate(-50%, 0);
}
.snackbar-pos.bottom-left {
top: auto !important;
bottom: 0;
left: 0;
}
.snackbar-pos.bottom-right {
top: auto !important;
bottom: 0;
right: 0;
}
.snackbar-pos.top-left {
bottom: auto !important;
top: 0;
left: 0;
}
.snackbar-pos.top-center {
bottom: auto !important;
top: 0;
left: 50%;
transform: translate(-50%, 0);
}
.snackbar-pos.top-right {
bottom: auto !important;
top: 0;
right: 0;
}
@media (max-width: 640px) {
.snackbar-pos.bottom-center, .snackbar-pos.top-center {
left: 0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AM,EAAE,CAAC;EACT,KAAK,EAAE,CAAC;;AACV,sBAAU;EACR,MAAM,EAAE,eAAe;EACvB,GAAG,EAAE,CAAC;EACN,IAAI,EAAE,CAAC;;AACT,wBAAY;EACV,MAAM,EAAE,eAAe;EACvB,GAAG,EAAE,CAAC;EACN,IAAI,EAAE,GAAG;EACT,SAAS,EAAE,qBAAqB;;AAClC,uBAAW;EACT,MAAM,EAAE,eAAe;EACvB,GAAG,EAAE,CAAC;EACN,KAAK,EAAE,CAAC",
"sources": ["../src/sass/snackbar.sass"],
"names": [],
"file": "snackbar.css"
}

View File

@ -1,189 +0,0 @@
/*!
* Snackbar v0.1.14
* http://polonel.com/Snackbar
*
* Copyright 2018 Chris Brame and other contributors
* Released under the MIT license
* https://github.com/polonel/Snackbar/blob/master/LICENSE
*/
(function (root, factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
define([], function () {
return (root.Snackbar = factory());
});
} else if (typeof module === 'object' && module.exports) {
module.exports = root.Snackbar = factory();
} else {
root.Snackbar = factory();
}
})(this, function () {
var Snackbar = {};
Snackbar.current = null;
var $defaults = {
text: 'Default Text',
textColor: '#FFFFFF',
width: 'auto',
showAction: true,
actionText: 'Dismiss',
actionTextAria: 'Dismiss, Description for Screen Readers',
alertScreenReader: false,
actionTextColor: '#4CAF50',
showSecondButton: false,
secondButtonText: '',
secondButtonAria: 'Description for Screen Readers',
secondButtonTextColor: '#4CAF50',
backgroundColor: '#323232',
pos: 'bottom-left',
duration: 5000,
customClass: '',
onActionClick: function (element) {
element.style.opacity = 0;
},
onSecondButtonClick: function (element) {
},
onClose: function (element) {
}
};
Snackbar.show = function ($options) {
var options = Extend(true, $defaults, $options);
if (Snackbar.current) {
Snackbar.current.style.opacity = 0;
setTimeout(
function () {
var $parent = this.parentElement;
if ($parent)
// possible null if too many/fast Snackbars
$parent.removeChild(this);
}.bind(Snackbar.current),
500
);
}
Snackbar.snackbar = document.createElement('div');
Snackbar.snackbar.className = 'snackbar-container ' + options.customClass;
Snackbar.snackbar.style.width = options.width;
var $p = document.createElement('p');
$p.style.margin = 0;
$p.style.padding = 0;
$p.style.color = options.textColor;
$p.style.fontSize = '14px';
$p.style.fontWeight = 300;
$p.style.lineHeight = '1em';
$p.innerHTML = options.text;
Snackbar.snackbar.appendChild($p);
Snackbar.snackbar.style.background = options.backgroundColor;
if (options.showSecondButton) {
var secondButton = document.createElement('button');
secondButton.className = 'action';
secondButton.innerHTML = options.secondButtonText;
secondButton.setAttribute('aria-label', options.secondButtonAria);
secondButton.style.color = options.secondButtonTextColor;
secondButton.addEventListener('click', function () {
options.onSecondButtonClick(Snackbar.snackbar);
});
Snackbar.snackbar.appendChild(secondButton);
}
if (options.showAction) {
var actionButton = document.createElement('button');
actionButton.className = 'action';
actionButton.innerHTML = options.actionText;
actionButton.setAttribute('aria-label', options.actionTextAria);
actionButton.style.color = options.actionTextColor;
actionButton.addEventListener('click', function () {
options.onActionClick(Snackbar.snackbar);
});
Snackbar.snackbar.appendChild(actionButton);
}
if (options.duration) {
setTimeout(
function () {
if (Snackbar.current === this) {
Snackbar.current.style.opacity = 0;
// When natural remove event occurs let's move the snackbar to its origins
Snackbar.current.style.top = '-100px';
Snackbar.current.style.bottom = '-100px';
}
}.bind(Snackbar.snackbar),
options.duration
);
}
if (options.alertScreenReader) {
Snackbar.snackbar.setAttribute('role', 'alert');
}
Snackbar.snackbar.addEventListener(
'transitionend',
function (event, elapsed) {
if (event.propertyName === 'opacity' && this.style.opacity === '0') {
if (typeof (options.onClose) === 'function')
options.onClose(this);
this.parentElement.removeChild(this);
if (Snackbar.current === this) {
Snackbar.current = null;
}
}
}.bind(Snackbar.snackbar)
);
Snackbar.current = Snackbar.snackbar;
document.body.appendChild(Snackbar.snackbar);
var $bottom = getComputedStyle(Snackbar.snackbar).bottom;
var $top = getComputedStyle(Snackbar.snackbar).top;
Snackbar.snackbar.style.opacity = 1;
Snackbar.snackbar.className =
'snackbar-container ' + options.customClass + ' snackbar-pos ' + options.pos;
};
Snackbar.close = function () {
if (Snackbar.current) {
Snackbar.current.style.opacity = 0;
}
};
// Pure JS Extend
// http://gomakethings.com/vanilla-javascript-version-of-jquery-extend/
var Extend = function () {
var extended = {};
var deep = false;
var i = 0;
var length = arguments.length;
if (Object.prototype.toString.call(arguments[0]) === '[object Boolean]') {
deep = arguments[0];
i++;
}
var merge = function (obj) {
for (var prop in obj) {
if (Object.prototype.hasOwnProperty.call(obj, prop)) {
if (deep && Object.prototype.toString.call(obj[prop]) === '[object Object]') {
extended[prop] = Extend(true, extended[prop], obj[prop]);
} else {
extended[prop] = obj[prop];
}
}
}
};
for (; i < length; i++) {
var obj = arguments[i];
merge(obj);
}
return extended;
};
return Snackbar;
});

View File

@ -1 +0,0 @@
.snackbar-container{transition:all .5s ease;transition-property:top,right,bottom,left,opacity;font-family:Roboto,sans-serif;font-size:14px;min-height:14px;background-color:#070b0e;position:fixed;display:flex;justify-content:space-between;align-items:center;color:#fff;line-height:22px;padding:18px 24px;bottom:-100px;top:-100px;opacity:0;z-index:9999}.snackbar-container .action{background:inherit;display:inline-block;border:none;font-size:inherit;text-transform:uppercase;color:#4caf50;margin:0 0 0 24px;padding:0;min-width:min-content;cursor:pointer}@media (min-width:640px){.snackbar-container{min-width:288px;max-width:568px;display:inline-flex;border-radius:2px;margin:24px}}@media (max-width:640px){.snackbar-container{left:0;right:0;width:100%}}.snackbar-pos.bottom-center{top:auto!important;bottom:0;left:50%;transform:translate(-50%,0)}.snackbar-pos.bottom-left{top:auto!important;bottom:0;left:0}.snackbar-pos.bottom-right{top:auto!important;bottom:0;right:0}.snackbar-pos.top-left{bottom:auto!important;top:0;left:0}.snackbar-pos.top-center{bottom:auto!important;top:0;left:50%;transform:translate(-50%,0)}.snackbar-pos.top-right{bottom:auto!important;top:0;right:0}@media (max-width:640px){.snackbar-pos.bottom-center,.snackbar-pos.top-center{left:0;transform:none}}

View File

@ -1,17 +0,0 @@
/*!
* Snackbar v0.1.14
* http://polonel.com/Snackbar
*
* Copyright 2018 Chris Brame and other contributors
* Released under the MIT license
* https://github.com/polonel/Snackbar/blob/master/LICENSE
*/
!function(a,b){"use strict";"function"==typeof define&&define.amd?define([],function(){return a.Snackbar=b()}):"object"==typeof module&&module.exports?module.exports=a.Snackbar=b():a.Snackbar=b()}(this,function(){var a={};a.current=null;var b={text:"Default Text",textColor:"#FFFFFF",width:"auto",showAction:!0,actionText:"Dismiss",actionTextAria:"Dismiss, Description for Screen Readers",alertScreenReader:!1,actionTextColor:"#4CAF50",showSecondButton:!1,secondButtonText:"",secondButtonAria:"Description for Screen Readers",secondButtonTextColor:"#4CAF50",backgroundColor:"#323232",pos:"bottom-left",duration:5e3,customClass:"",onActionClick:function(a){a.style.opacity=0},onSecondButtonClick:function(a){},onClose:function(a){}};a.show=function(d){var e=c(!0,b,d);a.current&&(a.current.style.opacity=0,setTimeout(function(){var a=this.parentElement;a&&
// possible null if too many/fast Snackbars
a.removeChild(this)}.bind(a.current),500)),a.snackbar=document.createElement("div"),a.snackbar.className="snackbar-container "+e.customClass,a.snackbar.style.width=e.width;var f=document.createElement("p");if(f.style.margin=0,f.style.padding=0,f.style.color=e.textColor,f.style.fontSize="14px",f.style.fontWeight=300,f.style.lineHeight="1em",f.innerHTML=e.text,a.snackbar.appendChild(f),a.snackbar.style.background=e.backgroundColor,e.showSecondButton){var g=document.createElement("button");g.className="action",g.innerHTML=e.secondButtonText,g.setAttribute("aria-label",e.secondButtonAria),g.style.color=e.secondButtonTextColor,g.addEventListener("click",function(){e.onSecondButtonClick(a.snackbar)}),a.snackbar.appendChild(g)}if(e.showAction){var h=document.createElement("button");h.className="action",h.innerHTML=e.actionText,h.setAttribute("aria-label",e.actionTextAria),h.style.color=e.actionTextColor,h.addEventListener("click",function(){e.onActionClick(a.snackbar)}),a.snackbar.appendChild(h)}e.duration&&setTimeout(function(){a.current===this&&(a.current.style.opacity=0,
// When natural remove event occurs let's move the snackbar to its origins
a.current.style.top="-100px",a.current.style.bottom="-100px")}.bind(a.snackbar),e.duration),e.alertScreenReader&&a.snackbar.setAttribute("role","alert"),a.snackbar.addEventListener("transitionend",function(b,c){"opacity"===b.propertyName&&"0"===this.style.opacity&&("function"==typeof e.onClose&&e.onClose(this),this.parentElement.removeChild(this),a.current===this&&(a.current=null))}.bind(a.snackbar)),a.current=a.snackbar,document.body.appendChild(a.snackbar);getComputedStyle(a.snackbar).bottom,getComputedStyle(a.snackbar).top;a.snackbar.style.opacity=1,a.snackbar.className="snackbar-container "+e.customClass+" snackbar-pos "+e.pos},a.close=function(){a.current&&(a.current.style.opacity=0)};
// Pure JS Extend
// http://gomakethings.com/vanilla-javascript-version-of-jquery-extend/
var c=function(){var a={},b=!1,d=0,e=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(b=arguments[0],d++);for(var f=function(d){for(var e in d)Object.prototype.hasOwnProperty.call(d,e)&&(b&&"[object Object]"===Object.prototype.toString.call(d[e])?a[e]=c(!0,a[e],d[e]):a[e]=d[e])};d<e;d++){var g=arguments[d];f(g)}return a};return a});
//# sourceMappingURL=snackbar.min.js.map

View File

@ -1 +0,0 @@
{"version":3,"sources":["../src/js/snackbar.js"],"names":["root","factory","define","amd","Snackbar","module","exports","this","current","$defaults","text","textColor","width","showAction","actionText","actionTextAria","alertScreenReader","actionTextColor","showSecondButton","secondButtonText","secondButtonAria","secondButtonTextColor","backgroundColor","pos","duration","customClass","onActionClick","element","style","opacity","onSecondButtonClick","onClose","show","$options","options","Extend","setTimeout","$parent","parentElement","removeChild","bind","snackbar","document","createElement","className","$p","margin","padding","color","fontSize","fontWeight","lineHeight","innerHTML","appendChild","background","secondButton","setAttribute","addEventListener","actionButton","top","bottom","event","elapsed","propertyName","body","getComputedStyle","close","extended","deep","i","length","arguments","Object","prototype","toString","call","merge","obj","prop","hasOwnProperty"],"mappings":";;;;;;;;CASA,SAAUA,EAAMC,GACZ,YAEsB,mBAAXC,SAAyBA,OAAOC,IACvCD,UAAW,WACP,MAAQF,GAAKI,SAAWH,MAEH,gBAAX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MAAQ,WACT9D,EAASI,UACTJ,EAASI,QAAQoB,MAAMC,QAAU;;;AAMzC,GAAIM,GAAS,WACT,GAAIgC,MACAC,GAAO,EACPC,EAAI,EACJC,EAASC,UAAUD,MAE8B,sBAAjDE,OAAOC,UAAUC,SAASC,KAAKJ,UAAU,MACzCH,EAAOG,UAAU,GACjBF,IAeJ,KAZA,GAAIO,GAAQ,SAASC,GACjB,IAAK,GAAIC,KAAQD,GACTL,OAAOC,UAAUM,eAAeJ,KAAKE,EAAKC,KACtCV,GAAsD,oBAA9CI,OAAOC,UAAUC,SAASC,KAAKE,EAAIC,IAC3CX,EAASW,GAAQ3C,GAAO,EAAMgC,EAASW,GAAOD,EAAIC,IAElDX,EAASW,GAAQD,EAAIC,KAM9BT,EAAIC,EAAQD,IAAK,CACpB,GAAIQ,GAAMN,UAAUF,EACpBO,GAAMC,GAGV,MAAOV,GAGX,OAAO/D","file":"snackbar.min.js"}

View File

@ -10054,10 +10054,6 @@ blockquote p {
object-fit: cover
}
#article-container img.error {
content: url(../../img.zhheo.com/i/2022/08/31/630efd3d82799.webp)
}
.doge-inner-player {
border-radius: 12px !important
}
@ -10140,7 +10136,6 @@ figure {
left: 0;
width: 100%;
height: 100%;
background: url(../../img.zhheo.com/i/2022/08/31/630efd3d82799.webp);
background-size: 100% 100%
}

View File

@ -6,15 +6,9 @@
<!-- 个人信息卡片 -->
<div th:replace="modules/widgets/profile :: profile"></div>
<!-- 微信公众号 -->
<div class="card-widget heo-right-widget" id="card-wechat" onclick='window.open("/wechat/")'>
<div id="flip-wrapper">
<div id="flip-content">
<div class="face"></div>
<div class="back face"></div>
</div>
</div>
</div>
<!-- 近期文章 -->
<div th:replace="modules/widgets/recent-posts :: recent-posts"></div>
<div class="sticky_layout">
<div class="card-widget card-tags card-archives card-webinfo card-allinfo">

View File

@ -8,15 +8,19 @@
<title th:text="${site.title}"></title>
<meta content="telephone=no" name="format-detection">
<meta content="var(--heo-card-bg)" name="theme-color">
<link rel="shortcut icon"
th:href="@{${#strings.isEmpty(site.favicon) ? '/assets/images/hao-logo.jpg' : site.favicon}}"/>
<script th:src="@{/assets/js/heo.js}"></script>
<link rel="stylesheet" th:href="@{/assets/zhheo/zhheoblog.css}">
<!-- fontawesome-pro https://github.com/duyplus/fontawesome-pro 对应目录下没有这个文件,先注释掉 -->
<!-- <link th:href="@{/assets/fontawesome-pro/v6.2.0/css/all.min.css}"
media="print"
<!-- fontawesome-pro https://github.com/duyplus/fontawesome-pro -->
<link media="print"
onload='this.media="all"'
rel="stylesheet"
/> -->
th:href="@{/assets/libs/fontawesome-pro/v6.2.0/css/all.min.css}"
/>
<!-- 右下角通知 -->
<link href="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/node-snackbar/0.1.16/snackbar.min.css"
@ -26,156 +30,166 @@
/>
<!-- 全局配置 -->
<!-- todo 不知是否可以移除,或者抽走 -->
<script>var GLOBAL_CONFIG = {
root: "/",
localSearch: void 0,
translate: {defaultEncoding: 2, translateDelay: 0, msgToTraditionalChinese: "简", msgToSimplifiedChinese: "繁"},
noticeOutdate: void 0,
copy: {success: "复制成功", error: "复制错误", noSupport: "浏览器不支持"},
relativeDate: {homepage: !0, post: !1},
runtime: "天",
date_suffix: {just: "刚刚", min: "分钟前", hour: "小时前", day: "天前", month: "个月前"},
copyright: void 0,
lightbox: "fancybox",
Snackbar: {
chs_to_cht: "你已切换为繁体",
cht_to_chs: "你已切换为简体",
day_to_night: "你已切换为深色模式",
night_to_day: "你已切换为浅色模式",
bgLight: "#49b1f5",
bgDark: "#121212",
position: "top-center"
},
source: {
jQuery: "https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/3.6.0/jquery.min.js",
justifiedGallery: {
js: "https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/justifiedGallery/3.8.1/js/jquery.justifiedGallery.min.js",
css: "https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/justifiedGallery/3.8.1/css/justifiedGallery.min.css"
<script>
var GLOBAL_CONFIG = {
root: "/",
localSearch: void 0,
translate: {
defaultEncoding: 2,
translateDelay: 0,
msgToTraditionalChinese: "简",
msgToSimplifiedChinese: "繁"
},
fancybox: {
js: "https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/fancybox/3.5.7/jquery.fancybox.min.js",
css: "https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/fancybox/3.5.7/jquery.fancybox.min.css"
}
},
isPhotoFigcaption: !0,
islazyload: !0,
isanchor: !1
}</script>
<!-- 站点配置 感觉这个没有什么用-->
<script id="config-diff">var GLOBAL_CONFIG_SITE = {
title: "halo",
isPost: !1,
isHome: !0,
isHighlightShrink: !1,
isToc: !1,
postUpdate: "2022-09-30 12:24:38"
}</script>
noticeOutdate: void 0,
copy: {success: "复制成功", error: "复制错误", noSupport: "浏览器不支持"},
relativeDate: {homepage: !0, post: !1},
runtime: "天",
date_suffix: {just: "刚刚", min: "分钟前", hour: "小时前", day: "天前", month: "个月前"},
copyright: void 0,
lightbox: "fancybox",
Snackbar: {
chs_to_cht: "你已切换为繁体",
cht_to_chs: "你已切换为简体",
day_to_night: "你已切换为深色模式",
night_to_day: "你已切换为浅色模式",
bgLight: "#49b1f5",
bgDark: "#121212",
position: "top-center"
},
source: {
jQuery: "https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/3.6.0/jquery.min.js",
justifiedGallery: {
js: "https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/justifiedGallery/3.8.1/js/jquery.justifiedGallery.min.js",
css: "https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/justifiedGallery/3.8.1/css/justifiedGallery.min.css"
},
fancybox: {
js: "https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/fancybox/3.5.7/jquery.fancybox.min.js",
css: "https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/fancybox/3.5.7/jquery.fancybox.min.css"
}
},
}</script>
<!-- 站点配置, 这里和 JS 有联动,需要抽走-->
<script id="config-diff" th:inline="javascript">
let post = [[${post == null}]];
var GLOBAL_CONFIG_SITE = {
title: post ? [[${site.title}]] : '',
isPost: post,
isHome: !post,
isToc: !1,
postUpdate: "2022-09-30 12:24:38"
}
</script>
<noscript>
<style>#nav {
opacity: 1
}
<style>
#nav {
opacity: 1
}
.justified-gallery img {
opacity: 1
}
.justified-gallery img {
opacity: 1
}
#post-meta time, #recent-posts time {
display: inline !important
}</style>
#post-meta time, #recent-posts time {
display: inline !important
}
</style>
</noscript>
<script>(win => {
win.saveToLocal = {
set: function setWithExpiry(key, value, ttl) {
if (ttl === 0) return
const now = new Date()
const expiryDay = ttl * 86400000
const item = {
value: value,
expiry: now.getTime() + expiryDay,
}
localStorage.setItem(key, JSON.stringify(item))
},
<script>
(win => {
win.saveToLocal = {
set: function setWithExpiry(key, value, ttl) {
if (ttl === 0) return
const now = new Date()
const expiryDay = ttl * 86400000
const item = {
value: value,
expiry: now.getTime() + expiryDay,
}
localStorage.setItem(key, JSON.stringify(item))
},
get: function getWithExpiry(key) {
const itemStr = localStorage.getItem(key)
get: function getWithExpiry(key) {
const itemStr = localStorage.getItem(key)
if (!itemStr) {
return undefined
}
const item = JSON.parse(itemStr)
const now = new Date()
if (!itemStr) {
return undefined
}
const item = JSON.parse(itemStr)
const now = new Date()
if (now.getTime() > item.expiry) {
localStorage.removeItem(key)
return undefined
if (now.getTime() > item.expiry) {
localStorage.removeItem(key)
return undefined
}
return item.value
}
return item.value
}
}
win.getScript = url => new Promise((resolve, reject) => {
const script = document.createElement('script')
script.src = url
script.async = true
script.onerror = reject
script.onload = script.onreadystatechange = function () {
const loadState = this.readyState
if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
script.onload = script.onreadystatechange = null
resolve()
}
document.head.appendChild(script)
})
win.activateDarkMode = function () {
document.documentElement.setAttribute('data-theme', 'dark')
heo.initThemeColor()
}
win.activateLightMode = function () {
document.documentElement.setAttribute('data-theme', 'light')
heo.initThemeColor()
}
const t = saveToLocal.get('theme')
const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches
const isLightMode = window.matchMedia('(prefers-color-scheme: light)').matches
const isNotSpecified = window.matchMedia('(prefers-color-scheme: no-preference)').matches
const hasNoSupport = !isDarkMode && !isLightMode && !isNotSpecified
if (t === undefined) {
if (isLightMode) activateLightMode()
else if (isDarkMode) activateDarkMode()
else if (isNotSpecified || hasNoSupport) {
const now = new Date()
const hour = now.getHours()
const isNight = hour <= 6 || hour >= 18
isNight ? activateDarkMode() : activateLightMode()
}
window.matchMedia('(prefers-color-scheme: dark)').addListener(function (e) {
if (saveToLocal.get('theme') === undefined) {
e.matches ? activateDarkMode() : activateLightMode()
win.getScript = url => new Promise((resolve, reject) => {
const script = document.createElement('script')
script.src = url
script.async = true
script.onerror = reject
script.onload = script.onreadystatechange = function () {
const loadState = this.readyState
if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
script.onload = script.onreadystatechange = null
resolve()
}
document.head.appendChild(script)
})
} else if (t === 'light') activateLightMode()
else activateDarkMode()
const asideStatus = saveToLocal.get('aside-status')
if (asideStatus !== undefined) {
if (asideStatus === 'hide') {
document.documentElement.classList.add('hide-aside')
} else {
document.documentElement.classList.remove('hide-aside')
win.activateDarkMode = function () {
document.documentElement.setAttribute('data-theme', 'dark')
heo.initThemeColor()
}
}
})(window)</script>
win.activateLightMode = function () {
document.documentElement.setAttribute('data-theme', 'light')
heo.initThemeColor()
}
const t = saveToLocal.get('theme')
const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches
const isLightMode = window.matchMedia('(prefers-color-scheme: light)').matches
const isNotSpecified = window.matchMedia('(prefers-color-scheme: no-preference)').matches
const hasNoSupport = !isDarkMode && !isLightMode && !isNotSpecified
if (t === undefined) {
if (isLightMode) activateLightMode()
else if (isDarkMode) activateDarkMode()
else if (isNotSpecified || hasNoSupport) {
const now = new Date()
const hour = now.getHours()
const isNight = hour <= 6 || hour >= 18
isNight ? activateDarkMode() : activateLightMode()
}
window.matchMedia('(prefers-color-scheme: dark)').addListener(function (e) {
if (saveToLocal.get('theme') === undefined) {
e.matches ? activateDarkMode() : activateLightMode()
}
})
} else if (t === 'light') activateLightMode()
else activateDarkMode()
const asideStatus = saveToLocal.get('aside-status')
if (asideStatus !== undefined) {
if (asideStatus === 'hide') {
document.documentElement.classList.add('hide-aside')
} else {
document.documentElement.classList.remove('hide-aside')
}
}
})(window)
</script>
<script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/3.6.0/jquery.min.js"></script>
<!-- todo 不知道是否有用 https://remixicon.com/ -->
<link href="https://cdn2.tianli0.top/npm/remixicon@2.5.0/fonts/remixicon.css" rel="stylesheet">
<!-- todo 应该是日志模块用的 https://blog.zhheo.com/p/a6947667.html -->
<link href="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/Swiper/8.0.6/swiper-bundle.min.css" rel="stylesheet">
<!-- 动态加载条 -->
<script data-pace-options='{ "restartOnRequestAfter":false,"eventLag":false}'
src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/pace/1.2.4/pace.min.js"
@ -183,7 +197,7 @@
</script>
<!-- 复制 https://github.com/zenorocha/clipboard.js -->
<script th:src="@{/assets/clipboard/clipboard.min.js}"></script>
<script th:src="@{/assets/libs/clipboard/clipboard.min.js}"></script>
<!-- 补充部分 -->
<th:block th:if="${metas != null}">

View File

@ -9,7 +9,7 @@
<!-- loading 页面 -->
<div th:replace="modules/loading-box :: loading-box"></div>
<!-- todo 暂时不知道用处 -->
<!-- 网站背景 -->
<div id="web_bg"></div>
<!-- 控制台 -->
@ -18,18 +18,6 @@
<!-- 内容 -->
<th:block th:replace="${content}"></th:block>
<!-- todo 暂时不知道用处 -->
<div id="rightside">
<div id="rightside-config-hide">
<button id="translateLink" title="简繁转换" type="button"></button>
<button id="darkmode" title="浅色和深色模式转换" type="button"><i class="fas fa-adjust"></i></button>
<button id="hide-aside-btn" title="单栏和双栏切换" type="button"><i class="fas fa-arrows-alt-h"></i></button>
</div>
<div id="rightside-config-show">
<button id="rightside_config" title="设置" type="button"><i class="fas fa-cog fa-spin"></i></button>
<button id="go-up" title="回到顶部" type="button"><i class="fas fa-arrow-up"></i></button>
</div>
</div>
<div th:replace="modules/right-menu :: right-menu"></div>
@ -40,109 +28,28 @@
<!-- 繁简翻译 js -->
<!-- 改成可配置 -->
<script th:src="@{/assets/translate/tw_cn.js}"></script>
<script th:src="@{/assets/libs/translate/tw_cn.js}"></script>
<!-- https://instant.page/ 网站预加载, 放在 </body> 之前 -->
<script th:src="@{/assets/instantpage/instantpage.min.js}" type="module"></script>
<!-- https://www.andreaverlicchi.eu/vanilla-lazyload/ 懒加载-->
<!-- todo 图片懒加载,并且可自定义懒加载图片 -->
<script th:src="@{/assets/lazyload/lazyload.min.js}"></script>
<script th:src="@{/assets/libs/instantpage/instantpage.min.js}" type="module"></script>
<!-- 右下角通知 https://www.polonel.com/snackbar/ -->
<!-- todo head 中有它的 css应该可以写一块并改成后台可配置的功能代码中应该还有他的 js -->
<script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/node-snackbar/0.1.16/snackbar.min.js"></script>
<!-- todo 暂时不知道用处 -->
<div class="js-pjax"></div>
<!-- https://davidshimjs.github.io/qrcodejs/ 生成二维码 -->
<!-- 应该是文章页分享使用 -->
<script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/qrcodejs/1.0.0/qrcode.min.js"></script>
<!-- todo -->
<script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/Swiper/6.6.2/swiper-bundle.min.js"></script>
<!-- todo 不知道是否可以抽到 right-menu.html 中,做到后台可配置 -->
<script th:src="@{/assets/zhheo/rightmenu.js}"></script>
<!-- https://raphamorim.io/waterfall.js/ 应该是这个 还有相关的 js 代码 是否可以调整-->
<script th:src="@{/assets/waterfall/waterfall.min.js}"></script>
<!-- https://github.com/MoOx/pjax -->
<script th:src="@{/assets/pjax/pjax.min.js}"></script>
<!-- 不知道干啥的 -->
<script>let pjaxSelectors = [
'title',
'#config-diff',
'#body-wrap',
'#rightside-config-hide',
'#rightside-config-show',
'.js-pjax'
]
if (false) {
pjaxSelectors.unshift('meta[property="og:image"]', 'meta[property="og:title"]', 'meta[property="og:url"]')
}
var pjax = new Pjax({
elements: 'a:not([target="_blank"])',
selectors: pjaxSelectors,
cacheBust: false,
analytics: false,
scrollRestoration: false
})
document.addEventListener('pjax:send', function () {
// removeEventListener toc scroll
window.removeEventListener('scroll', window.tocScrollFn)
typeof preloader === 'object' && preloader.initLoading()
if (window.aplayers) {
for (let i = 0; i < window.aplayers.length; i++) {
if (!window.aplayers[i].options.fixed) {
window.aplayers[i].destroy()
}
}
}
typeof typed === 'object' && typed.destroy()
//reset readmode
const $bodyClassList = document.body.classList
$bodyClassList.contains('read-mode') && $bodyClassList.remove('read-mode')
})
document.addEventListener('pjax:complete', function () {
window.refreshFn()
document.querySelectorAll('script[data-pjax]').forEach(item => {
const newScript = document.createElement('script')
const content = item.text || item.textContent || item.innerHTML || ""
Array.from(item.attributes).forEach(attr => newScript.setAttribute(attr.name, attr.value))
newScript.appendChild(document.createTextNode(content))
item.parentNode.replaceChild(newScript, item)
})
GLOBAL_CONFIG.islazyload && window.lazyLoadInstance.update()
typeof chatBtnFn === 'function' && chatBtnFn()
typeof panguInit === 'function' && panguInit()
typeof preloader === 'object' && preloader.endLoading()
})
document.addEventListener('pjax:error', (e) => {
if (e.request.status === 404) {
pjax.loadUrl('/404.html')
}
})</script>
<script th:src="@{/assets/libs/waterfall/waterfall.min.js}"></script>
</div>
<!-- 不知道干啥的 -->
<div class="js-pjax">
<div>
<script th:inline="javascript">
//coverColor();

View File

@ -6,7 +6,6 @@
totalPages = ${(posts.total - 1) / posts.size + 1}, pageIndex = ${posts.page}">
<!-- card需要添加在没有图片时使用随机图片 -->
<!-- th:style="'width: calc(100% / ' + ${columns}+' - 0.5rem);'" 有点问题 -->
<div class="recent-post-item" th:each="post : ${postItems}" th:classappend="${theme.config.layout.cols}">
<div class="post_cover left_radius">
<a data-pjax-state th:attr="title=${post.spec.title}" th:href="${post.status.permalink}">

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<!-- 右键菜单 -->
<div class="js-pjax" th:fragment="right-menu">
<div th:fragment="right-menu">
<div id="rightMenu">
<div class="rightMenu-group rightMenu-small">
<div class="rightMenu-item" id="menu-backward"><i class="fa-solid fa-arrow-left"></i></div>

View File

@ -1,6 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<!-- 侧边栏推广 -->
</html>

View File

@ -22,34 +22,37 @@
var headerEl = 'h1,h2,h3,h4,h5,h6', // headers
content = '.post-content', // 文章容器
idArr = {};
$(content).children(headerEl).each(function () {
var headers = $(content).children(headerEl);
// 去除空格以及多余标点
var headerId = $(this).text().replace(/[\s|\~|`|\!|\@|\#|\$|\%|\^|\&|\*|\(|\)|\_|\+|\=|\||\|\[|\]|\{|\}|\;|\:|\"|\'|\,|\<|\.|\>|\/|\?|\|\|\。]/g, '');
// 没有 toc 目录,则直接移除
if (headers.empty()) {
document.getElementById("card-toc").remove();
} else {
headers.each(function () {
headerId = headerId.toLowerCase();
if (idArr[headerId]) {
// id已经存在
$(this).attr('id', headerId + '-' + idArr[headerId]);
idArr[headerId]++;
} else {
// id未存在
idArr[headerId] = 1;
$(this).attr('id', headerId);
}
});
// TODO 可以没有目录
tocbot.init({
// Where to render the table of contents.
tocSelector: '.toc-content',
// Where to grab the headings to build the table of contents.
contentSelector: '.post-content',
// Which headings to grab inside of the contentSelector element.
headingSelector: headerEl,
// For headings inside relative or absolute positioned containers within content.
hasInnerContainers: true,
// 去除空格以及多余标点
var headerId = $(this).text().replace(/[\s|\~|`|\!|\@|\#|\$|\%|\^|\&|\*|\(|\)|\_|\+|\=|\||\|\[|\]|\{|\}|\;|\:|\"|\'|\,|\<|\.|\>|\/|\?|\|\|\。]/g, '');
headerId = headerId.toLowerCase();
if (idArr[headerId]) {
// id已经存在
$(this).attr('id', headerId + '-' + idArr[headerId]);
idArr[headerId]++;
} else {
// id未存在
idArr[headerId] = 1;
$(this).attr('id', headerId);
}
});
tocbot.init({
tocSelector: '.toc-content',
contentSelector: '.post-content',
headingSelector: headerEl,
hasInnerContainers: true,
});
}
});
</script>
</th:block>
</html>

View File

@ -217,7 +217,7 @@
<div id="post-comment">
<div class="comment-head">
<div class="comment-headline"><i class="fas fa-message fa-fw"></i> <span>评论</span></div>
<div class="comment-privacy"><a href="../privacy/index.html">隐私政策</a></div>
<div class="comment-privacy"><a href="#">隐私政策</a></div>
<div class="comment-tips" id="comment-tips">
<span>你无需删除空行,直接评论以获取最佳展示效果</span>
</div>