Compare commits

...

7 Commits

Author SHA1 Message Date
641d7c78ec 更新README.md文件 2024-05-21 11:32:41 +08:00
15f3614aac 增加对爱发电插件的支持
detailed:
1.增加了对爱发电插件的支持。
2.移除了爱发电apiToekn和userID的配置项。
3.修改了关于页面中访问统计内的“文章隧道”按钮在移动端下的样式。
2024-05-21 11:25:37 +08:00
eca30a503b Merge branch 'dev' of https://gitea.uptoz.cn/UPToZ/halo-theme-hao into dev 2024-05-11 18:15:27 +08:00
d19c1191ef 修改侧栏图标颜色
detailed:
1.增加了侧栏中的小板报、最新评论、最近发布、爱发电、广告、文章目录、分类的图标颜色。
2.增加了对侧栏的广告图片鼠标移入图片轻微放大的效果。
3.增加了爱发电API请求失败时的默认显示。
4.修改了侧栏中的标题与图标之间的间距。
5.修改了侧栏中爱发电内容区域的边距。
2024-05-11 18:09:07 +08:00
8f601d0817 修改侧栏图标颜色
detailed:
1.增加了侧栏中的小板报、最新评论、最近发布、爱发电、广告、文章目录、分类的图标颜色。
2.增加了对侧栏的广告图片鼠标移入图片轻微放大的效果。
3.增加了爱发电API请求失败时的默认显示。
4.修改了侧栏中的标题与图标之间的间距。
5.修改了侧栏中爱发电内容区域的边距。
2024-05-11 17:37:18 +08:00
7f8b310cf7 修改关于页面细节样式
detailed:
1.修改关于页面中十年之约的进度条的圆角样式
2.修改关于页面中卡片“banner-button-group”的位置
2024-05-09 17:29:01 +08:00
d197c0e95c 修复退出登录问题
detailed:
1.更新了readme文件和主题配置文件
2.修复了退出登录无法退出的问题
2024-04-16 17:08:46 +08:00
21 changed files with 9619 additions and 1467 deletions

View File

@ -1,3 +1,56 @@
# halo-theme-hao
<div align="center">
<!-- 主题Logo -->
<img width="100px" src="https://api.minio.yyds.pink/moony/files/2024/04/halo-theme-hao-sbxqdmuv.png">
<!-- 主题名称 -->
<h1>Halo-Theme-Hao</h1>
</div>
基于halo-theme-hao的1.4.9-beta2版本进行修改。
## 🔥 预览
| 站点名称 | 站点地址 |
|:--------------:|:------------------------:|
| 小小笔记大大用处 | https://blog.uptoz.cn |
## 👋 简介
[Halo-Theme-Hao](https://gitea.uptoz.cn/UPToZ/halo-theme-hao)
是一款适用于 [Halo2.x](https://github.com/halo-dev/halo) 的博客主题。
移植自 [Hexo](https://hexo.io/zh-cn/index.html) 社区中 [张洪 Heo](https://blog.zhheo.com/)
对 [Hexo-Theme-hao](https://github.com/chengzhongxue/halo-theme-hao)主题1.4.9-beta2的魔改版本。
## 🚨 注意事项(看我看我)
1. **建站时间必填**
2. 如果安装主题后报错,请仔细查阅[主题说明](https://gitea.uptoz.cn/UPToZ/halo-theme-hao)
与[更新说明](https://gitea.uptoz.cn/UPToZ/halo-theme-hao/releases)
3. 如果还未解决,可以加群求助!!!
4. 如果群友也解决不了再考虑提ISSUE
5. `1.0.0`及以上版本需要`Halo`版本>=`2.14.0`
6. **若安装主题后出现500错误请到主题设置页面将每个设置项都保存一下**
7. **`beta`版本主题必须使用`本地资源`,正式版本才会存在`在线资源`**
### 🔌 插件依赖
> 所有插件均为可选,不安装则不会出现对应功能。
> 部分插件可能已经预设在 Halo 内。
> 部分插件主题尚未适配。
- 评论功能 [plugin-comment-widget](https://github.com/halo-sigs/plugin-comment-widget/releases)
- 搜索功能 [plugin-search-widget](https://github.com/halo-sigs/plugin-search-widget/releases)
- 友链页面 [plugin-links](https://github.com/halo-sigs/plugin-links)
- 瞬间页面 [plugin-moments](https://github.com/halo-sigs/plugin-moments)
- 追番插件 [plugin-bilibili-bangumi](https://github.com/Roozenlz/plugin-bilibili-bangumi)
- 图库插件 [plugin-photos](https://github.com/halo-sigs/plugin-photos)
- katex插件 [plugin-katex](https://github.com/chengzhongxue/plugin-katex/releases/)
- 我的装备 [plugin-equipments](https://github.com/chengzhongxue/plugin-equipments)
- Markdown / HTML 内容块插件 [plugin-hybrid-edit-block](https://www.halo.run/store/apps/app-NgHnY)
- 爱发电 [plugin-afdian](https://www.halo.run/store/apps/app-oXvZp)
> 更多插件请参见https://github.com/halo-sigs/awesome-halo
## 📝 使用
[点我查看](https://www.yuque.com/liuzhihangs/halo-theme-hao)

View File

@ -750,8 +750,7 @@ spec:
label: 爱发电赞助
value:
powerLink: /
url: https://api.afdian.cnkj.site/api/creator/get-top-sponsors?user_id=
userId:
url: /apis/api.plugin.halo.run/v1alpha1/plugins/plugin-afdian/afdian/getSponsorList
showNum: 3
children:
- $formkit: url
@ -760,9 +759,7 @@ spec:
- $formkit: text
name: url
label: 接口地址
- $formkit: text
name: userId
label: 用户ID
help: 需要安装爱发电插件
- $formkit: number
name: showNum
label: 最大展示条数

View File

@ -1,12 +1,11 @@
.timeline {
width: 100%;
height: 20px;
height: 2rem;
background-color: var(--heo-background);
position: relative;
overflow: hidden;
margin-bottom: 20px;
border-radius: 0.5rem;
height: 2.5rem;
border-radius: 1.5rem;
}
.progress {
@ -16,7 +15,7 @@
position: absolute;
animation: progressAnimation 2s linear forwards;
animation-delay: -0.1s;
border-radius: 0.5rem
border-radius: 1.5rem
}
.past-time {
@ -55,6 +54,7 @@
0% {
width: 0;
}
100% {
width: var(--progress-percentage, 0);
}
@ -64,6 +64,7 @@
0% {
transform: scaleX(0);
}
100% {
transform: scaleX(var(--past-time-percentage, 0));
}
@ -78,9 +79,11 @@
0% {
box-shadow: 0 0 2px var(--heo-main);
}
50% {
box-shadow: 0 0 40px var(--heo-main);
}
100% {
box-shadow: 0 0 2px var(--heo-main);
}

View File

@ -18,7 +18,6 @@ let halo = {
var e = document.querySelector("link[data-code-theme=light]"),
o = document.querySelector("link[data-code-theme=dark]");
(o || e) && ("light" === t ? (o.disabled = !0, e.disabled = !1) : (e.disabled = !0, o.disabled = !1))
},
/**
@ -32,7 +31,6 @@ let halo = {
if (!Prism.plugins.toolbar) {
console.warn('Copy to Clipboard plugin loaded before Toolbar plugin.');
return;
}
@ -322,7 +320,8 @@ let halo = {
'limit': '100'
});
fetch(GLOBAL_CONFIG.source.artalk.artalkUrl + 'api/v2/stats/latest_comments?' + queryParams.toString(),
fetch(GLOBAL_CONFIG.source.artalk.artalkUrl + 'api/v2/stats/latest_comments?' + queryParams
.toString(),
statheaderList)
.then((e => e.json())).then((({
data: t
@ -375,20 +374,32 @@ let halo = {
},
getTopSponsors() {
var user_id = GLOBAL_CONFIG.source.power.userId
var show_num = GLOBAL_CONFIG.source.power.showNum
var show_num = GLOBAL_CONFIG.source.power.showNum;
var url = GLOBAL_CONFIG.source.power.url;
function getPower() {
const url = GLOBAL_CONFIG.source.power.url + user_id
const url = GLOBAL_CONFIG.source.power.url;
fetch(url)
.then(res => res.json())
.then(data => {
console.log(data)
if (200 === data["ec"]) {
var values = data["data"]["list"]
const values = data["data"]["list"];
saveToLocal.set('power-data', JSON.stringify(values), 10 / (60 * 24))
renderer(values);
}
})
.catch(error => {
let powerStar = document.getElementById("power-star")
powerStar.href = GLOBAL_CONFIG.source.power.powerLink
powerStar.innerHTML = `
<div id="power-star-image" style="background-image: url('/themes/theme-hao/assets/images/afadian/afadian.webp')">
</div>
<div class="power-star-body">
<div id="power-star-title">还没有人赞助</div>
<div id="power-star-desc">为爱发电点击赞助</div>
</div>`;
console.error(error);
})
}
@ -406,12 +417,12 @@ let halo = {
</div>`;
} else {
if (powerStar) {
powerStar.href = "https://afdian.net/u/" + data[0].user_id
powerStar.href = "https://afdian.net/u/" + data[0]["user"].user_id
powerStar.innerHTML = `
<div id="power-star-image" style="background-image: url(${data[0].avatar})">
<div id="power-star-image" style="background-image: url(${data[0]["user"].avatar})">
</div>
<div class="power-star-body">
<div id="power-star-title">${data[0].name}</div>
<div id="power-star-title">${data[0]["user"].name}</div>
<div id="power-star-desc">更多支持为爱发电</div>
</div>`;
}
@ -424,7 +435,7 @@ let halo = {
break;
}
htmlText +=
` <a href="${"https://afdian.net/u/" + value["user_id"]}" rel="external nofollow" target="_blank" th:title="${value["name"]}">${value["name"]}</a>`;
` <a href="${"https://afdian.net/u/" + value["user"]["user_id"]}" rel="external nofollow" target="_blank" th:title="${value["user"]["name"]}">${value["user"]["name"]}</a>`;
i = i + 1;
}
if (document.getElementById("power-item-link")) {
@ -439,7 +450,7 @@ let halo = {
if (data) {
renderer(JSON.parse(data))
} else {
getPower()
getPower();
}
}

View File

@ -1,16 +1,18 @@
let heo_cookiesTime = null
// 第一次播放音乐
,heo_musicFirst = false
// 音乐播放状态
,heo_musicPlaying = false
,heo_keyboard = false
,heo_intype = false
,lastSayHello = ""
,refreshNum = 1;
// 第一次播放音乐
,
heo_musicFirst = false
// 音乐播放状态
,
heo_musicPlaying = false,
heo_keyboard = false,
heo_intype = false,
lastSayHello = "",
refreshNum = 1;
// 私有函数
var heo = {
// 检测显示模式
darkModeStatus: function () {
darkModeStatus: function() {
let theme = document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' : 'light'
if (theme == 'light') {
$(".menu-darkmode-text").text("深色模式");
@ -22,13 +24,13 @@ var heo = {
// 首页bb
initIndexEssay: function() {
if (document.querySelector("#bber-talk"))
$(".swiper-wrapper .swiper-slide").each(function () {
$(".swiper-wrapper .swiper-slide").each(function() {
var text = $(this)[0].innerText;
if (text != 'undefined') {
$(this).text(btf.changeContent(text));
}
})
new Swiper(".swiper-container",{
new Swiper(".swiper-container", {
direction: "vertical",
loop: !0,
autoplay: {
@ -40,7 +42,7 @@ var heo = {
// 只在首页显示
onlyHome: function () {
onlyHome: function() {
var urlinfo = window.location.pathname;
urlinfo = decodeURIComponent(urlinfo);
if (urlinfo == '/') {
@ -51,7 +53,7 @@ var heo = {
},
//是否在首页
is_Post: function () {
is_Post: function() {
var url = window.location.href; //获取url
if (url.indexOf("/archives/") >= 0) { //判断url地址中是否包含code字符串
return true;
@ -63,8 +65,8 @@ var heo = {
//监测是否在页面开头
addNavBackgroundInit: function() {
var e = 0
, t = 0;
var e = 0,
t = 0;
document.body && (e = document.body.scrollTop),
document.documentElement && (t = document.documentElement.scrollTop),
0 != (e - t > 0 ? e : t) && (document.getElementById("page-header").classList.add("nav-fixed"),
@ -89,7 +91,8 @@ var heo = {
document.querySelector("#category-bar") && $(".category-bar-item").removeClass("select");
var e = window.location.pathname;
if ("/" == (e = decodeURIComponent(e)))
document.querySelector("#category-bar") && document.getElementById("category-bar-home").classList.add("select");
document.querySelector("#category-bar") && document.getElementById("category-bar-home").classList
.add("select");
else {
if (/\/categories\/.*?/.test(e)) {
var t = e.split("/")[2];
@ -103,14 +106,16 @@ var heo = {
},
// 页脚友链
addFriendLinksInFooter: function () {
addFriendLinksInFooter: function() {
var footerRandomFriendsBtn = document.getElementById("footer-random-friends-btn");
if(!footerRandomFriendsBtn) return;
if (!footerRandomFriendsBtn) return;
footerRandomFriendsBtn.style.opacity = "0.2";
footerRandomFriendsBtn.style.transitionDuration = "0.3s";
footerRandomFriendsBtn.style.transform = "rotate(" + 360 * refreshNum++ + "deg)";
function getLinks(){
const fetchUrl = "/apis/api.plugin.halo.run/v1alpha1/plugins/PluginLinks/links?keyword=&sort=priority,asc"
function getLinks() {
const fetchUrl =
"/apis/api.plugin.halo.run/v1alpha1/plugins/PluginLinks/links?keyword=&sort=priority,asc"
fetch(fetchUrl)
.then(res => res.json())
.then(json => {
@ -118,28 +123,31 @@ var heo = {
renderer(json.items);
})
}
function renderer(data){
function renderer(data) {
const linksUrl = GLOBAL_CONFIG.source.links.linksUrl
const num = GLOBAL_CONFIG.source.links.linksNum
var randomFriendLinks = getArrayItems(data, num);
var htmlText = '';
for (let i = 0; i < randomFriendLinks.length; ++i) {
var item = randomFriendLinks[i]
htmlText += `<a class='footer-item' href='${item.spec.url}' target="_blank" rel="noopener nofollow">${item.spec.displayName}</a>`;
htmlText +=
`<a class='footer-item' href='${item.spec.url}' target="_blank" rel="noopener nofollow">${item.spec.displayName}</a>`;
}
htmlText += `<a class='footer-item' href='${linksUrl}'>更多</a>`
if(document.getElementById("friend-links-in-footer")){
if (document.getElementById("friend-links-in-footer")) {
document.getElementById("friend-links-in-footer").innerHTML = htmlText;
}
}
function friendLinksInFooterInit(){
function friendLinksInFooterInit() {
const data = saveToLocal.get('links-data')
if (data) {
renderer(JSON.parse(data))
} else {
getLinks()
}
setTimeout(()=>{
setTimeout(() => {
footerRandomFriendsBtn.style.opacity = "1";
}, 300)
}
@ -147,18 +155,18 @@ var heo = {
},
//禁止图片右键单击
stopImgRightDrag: function () {
stopImgRightDrag: function() {
var img = $("img");
img.on("dragstart", function () {
img.on("dragstart", function() {
return false;
});
},
//置顶文章横向滚动
topPostScroll: function () {
topPostScroll: function() {
if (document.getElementById("recent-post-top")) {
let xscroll = document.getElementById("recent-post-top");
xscroll.addEventListener("mousewheel", function (e) {
xscroll.addEventListener("mousewheel", function(e) {
//计算鼠标滚轮滚动的距离
let v = -e.wheelDelta / 2;
xscroll.scrollLeft += v;
@ -170,10 +178,10 @@ var heo = {
}
},
topCategoriesBarScroll: function () {
topCategoriesBarScroll: function() {
if (document.getElementById("category-bar-items")) {
let xscroll = document.getElementById("category-bar-items");
xscroll.addEventListener("mousewheel", function (e) {
xscroll.addEventListener("mousewheel", function(e) {
//计算鼠标滚轮滚动的距离
let v = -e.wheelDelta / 2;
xscroll.scrollLeft += v;
@ -184,12 +192,12 @@ var heo = {
},
//作者卡片问好
sayhi: function () {
sayhi: function() {
if (GLOBAL_CONFIG.profileStyle == 'default') {
if (document.querySelector('#author-info__sayhi')) {
document.getElementById("author-info__sayhi").innerHTML = getTimeState() + "!我是";
}
}else{
} else {
if (document.querySelector('#author-info__sayhi')) {
document.getElementById("author-info__sayhi").innerHTML = getTimeState();
}
@ -198,7 +206,7 @@ var heo = {
},
// 二维码
qrcodeCreate: function () {
qrcodeCreate: function() {
if (document.getElementById('qrcode')) {
document.getElementById("qrcode").innerHTML = "";
var qrcode = new QRCode(document.getElementById("qrcode"), {
@ -216,22 +224,22 @@ var heo = {
reflashEssayWaterFall: function() {
document.querySelector("#waterfall") && setTimeout((function() {
waterfall("#waterfall"),
document.getElementById("waterfall") && document.getElementById("waterfall").classList.add("show")
}
), 500)
document.getElementById("waterfall") && document.getElementById("waterfall")
.classList.add("show")
}), 500)
},
// 下载图片
downloadImage: function (imgsrc, name) { //下载图片地址和图片名
downloadImage: function(imgsrc, name) { //下载图片地址和图片名
rm.hideRightMenu();
if (rm.downloadimging == false) {
rm.downloadimging = true;
btf.snackbarShow('正在下载中,请稍后', false, 10000)
setTimeout(function () {
setTimeout(function() {
let image = new Image();
// 解决跨域 Canvas 污染问题
image.setAttribute("crossOrigin", "anonymous");
image.onload = function () {
image.onload = function() {
let canvas = document.createElement("canvas");
canvas.width = image.width;
canvas.height = image.height;
@ -254,7 +262,7 @@ var heo = {
},
//控制评论弹幕
switchCommentBarrage: function () {
switchCommentBarrage: function() {
let commentBarrage = document.querySelector('.comment-barrage');
if (commentBarrage) {
if ($(".comment-barrage").is(":visible")) {
@ -271,46 +279,45 @@ var heo = {
btf.snackbarShow("✨ 已开启评论弹幕", false, 2000)
}
}
if(GLOBAL_CONFIG.rightMenuEnable){
if (GLOBAL_CONFIG.rightMenuEnable) {
rm.hideRightMenu();
}
},
//隐藏cookie窗口
hidecookie: function() {
heo_cookiesTime = setTimeout((()=>{
heo_cookiesTime = setTimeout((() => {
document.getElementById("cookies-window").classList.add("cw-hide"),
setTimeout((()=>{
setTimeout((() => {
$("#cookies-window").hide()
}
), 1e3)
}
), 3e3)
}), 1e3)
}), 3e3)
},
//隐藏今日推荐
hideTodayCard: function () {
hideTodayCard: function() {
if (document.getElementById("todayCard")) {
document.getElementById("todayCard").classList.add('hide');
}
},
//更改主题色
changeThemeColor: function (color) {
changeThemeColor: function(color) {
if (document.querySelector('meta[name="theme-color"]') !== null) {
document.querySelector('meta[name="theme-color"]').setAttribute('content', color)
}
},
//自适应主题色
initThemeColor: function () {
initThemeColor: function() {
if (heo.is_Post()) {
const currentTop = window.scrollY || document.documentElement.scrollTop
if (currentTop === 0) {
let themeColor = getComputedStyle(document.documentElement).getPropertyValue('--heo-main');
heo.changeThemeColor(themeColor);
} else {
let themeColor = getComputedStyle(document.documentElement).getPropertyValue('--heo-background');
let themeColor = getComputedStyle(document.documentElement).getPropertyValue(
'--heo-background');
heo.changeThemeColor(themeColor);
}
} else {
@ -320,28 +327,28 @@ var heo = {
},
//跳转到指定位置
jumpTo: function (dom) {
$(document).ready(function () {
jumpTo: function(dom) {
$(document).ready(function() {
$("html,body").animate({
scrollTop: $(dom).eq(i).offset().top
}, 500 /*scroll实现定位滚动*/); /*让整个页面可以滚动*/
}, 500 /*scroll实现定位滚动*/ ); /*让整个页面可以滚动*/
});
},
//显示加载动画
showLoading: function () {
showLoading: function() {
document.querySelector("#loading-box").classList.remove("loaded");
let cardColor = getComputedStyle(document.documentElement).getPropertyValue('--heo-card-bg');
heo.changeThemeColor(cardColor);
},
//隐藏加载动画
hideLoading: function () {
hideLoading: function() {
document.querySelector("#loading-box").classList.add("loaded");
},
//切换音乐播放状态
musicToggle: function (changePaly = true) {
musicToggle: function(changePaly = true) {
const navMusicEl = document.getElementById("nav-music");
if (!heo_musicFirst) {
heo.musicBindEvent();
@ -351,7 +358,7 @@ var heo = {
let msgPause = '<i class="haofont hao-icon-pause"></i><span>暂停音乐</span>';
if (heo_musicPlaying) {
navMusicEl.classList.remove("playing");
if(GLOBAL_CONFIG.rightMenuEnable){
if (GLOBAL_CONFIG.rightMenuEnable) {
document.getElementById("menu-music-toggle").innerHTML = msgPlay;
}
document.getElementById("nav-music-hoverTips").innerHTML = "音乐已暂停";
@ -360,7 +367,7 @@ var heo = {
navMusicEl.classList.remove("stretch");
} else {
navMusicEl.classList.add("playing");
if(GLOBAL_CONFIG.rightMenuEnable){
if (GLOBAL_CONFIG.rightMenuEnable) {
document.getElementById("menu-music-toggle").innerHTML = msgPause;
}
document.querySelector("#consoleMusic").classList.add("on");
@ -368,23 +375,23 @@ var heo = {
navMusicEl.classList.add("stretch");
}
if (changePaly) document.querySelector("#nav-music meting-js").aplayer.toggle();
if(GLOBAL_CONFIG.rightMenuEnable){
if (GLOBAL_CONFIG.rightMenuEnable) {
rm.hideRightMenu();
}
},
// 音乐绑定事件
musicBindEvent: function () {
document.querySelector("#nav-music .aplayer-music").addEventListener("click", function () {
musicBindEvent: function() {
document.querySelector("#nav-music .aplayer-music").addEventListener("click", function() {
heo.musicTelescopic();
});
document.querySelector("#nav-music .aplayer-button").addEventListener("click", function () {
document.querySelector("#nav-music .aplayer-button").addEventListener("click", function() {
heo.musicToggle(false);
});
},
// 音乐伸缩
musicTelescopic: function () {
musicTelescopic: function() {
const navMusicEl = document.getElementById("nav-music");
if (navMusicEl.classList.contains("stretch")) {
navMusicEl.classList.remove("stretch");
@ -394,19 +401,19 @@ var heo = {
},
//音乐上一曲
musicSkipBack: function () {
musicSkipBack: function() {
document.querySelector("meting-js").aplayer.skipBack(),
rm.hideRightMenu()
},
//音乐下一曲
musicSkipForward: function () {
musicSkipForward: function() {
document.querySelector("meting-js").aplayer.skipForward(),
rm.hideRightMenu()
},
//获取音乐中的名称
musicGetName: function () {
musicGetName: function() {
for (var e = $(".aplayer-title"), t = [], o = e.length - 1; o >= 0; o--)
t[o] = e[o].innerText;
return t[0]
@ -414,30 +421,27 @@ var heo = {
// 显示打赏中控台
rewardShowConsole: function () {
rewardShowConsole: function() {
$('.console-card-group-reward').attr('style', 'display: flex');
$('.console-card-group').attr('style', 'display: none');
document.querySelector("#console").classList.add("show");
heo.initConsoleState()
},
//显示中控台
showConsole: function () {
showConsole: function() {
$('.console-card-group-reward').attr('style', 'display: none');
$('.console-card-group').attr('style', 'display: flex');
document.querySelector("#console").classList.add("show");
},
//隐藏中控台
hideConsole: function () {
hideConsole: function() {
document.querySelector("#console").classList.remove("show");
},
//快捷键功能开关
keyboardToggle: function () {
keyboardToggle: function() {
if (heo_keyboard) {
heo_keyboard = false;
document.querySelector("#consoleKeyboard").classList.remove("on");
@ -453,47 +457,47 @@ var heo = {
scrollTo: function(e) {
const t = document.getElementById(e);
if (t) {
const e = t.getBoundingClientRect().top + window.pageYOffset - 80
, o = window.pageYOffset
, n = e - o;
const e = t.getBoundingClientRect().top + window.pageYOffset - 80,
o = window.pageYOffset,
n = e - o;
let a = null;
window.requestAnimationFrame((function e(t) {
a || (a = t);
const l = t - a
, i = (c = Math.min(l / 0, 1)) < .5 ? 2 * c * c : (4 - 2 * c) * c - 1;
const l = t - a,
i = (c = Math.min(l / 0, 1)) < .5 ? 2 * c * c : (4 - 2 * c) * c - 1;
var c;
window.scrollTo(0, o + n * i),
l < 600 && window.requestAnimationFrame(e)
}
))
}))
}
},
//隐藏侧边栏
hideAsideBtn: () => { // Hide aside
const $htmlDom = document.documentElement.classList
$htmlDom.contains('hide-aside')
? saveToLocal.set('aside-status', 'show', 2)
: saveToLocal.set('aside-status', 'hide', 2)
$htmlDom.contains('hide-aside') ?
saveToLocal.set('aside-status', 'show', 2) :
saveToLocal.set('aside-status', 'hide', 2)
$htmlDom.toggle('hide-aside')
$htmlDom.contains("hide-aside") ? document.querySelector("#consoleHideAside").classList.add("on") : document.querySelector("#consoleHideAside").classList.remove("on")
$htmlDom.contains("hide-aside") ? document.querySelector("#consoleHideAside").classList.add("on") :
document.querySelector("#consoleHideAside").classList.remove("on")
},
toPage: function() {
var e = document.querySelectorAll(".page-number")
, t = parseInt(e[e.length - 1].innerHTML)
, o = document.getElementById("toPageText")
, n = parseInt(o.value);
var e = document.querySelectorAll(".page-number"),
t = parseInt(e[e.length - 1].innerHTML),
o = document.getElementById("toPageText"),
n = parseInt(o.value);
if (!isNaN(n) && n > 0 && "0" !== ("" + n)[0] && n <= t) {
var url = window.location.href;
var photosIndexOf = url.indexOf("?group") >= 0 ? url.indexOf("?group") : -1;
if (photosIndexOf >= 0) {//图库页面
var new_url = url.substr(0,photosIndexOf);
if (photosIndexOf >= 0) { //图库页面
var new_url = url.substr(0, photosIndexOf);
var group = url.substr(photosIndexOf)
var a, l = new_url.replace(/\/page\/\d$/, "");
a = 1 === n ? l : l + (l.endsWith("/") ? "" : "/") + "page/" + n,
document.getElementById("toPageButton").href = a + group
}else{
} else {
var a, l = url.replace(/\/page\/\d$/, "");
a = 1 === n ? l : l + (l.endsWith("/") ? "" : "/") + "page/" + n,
document.getElementById("toPageButton").href = a
@ -504,22 +508,24 @@ var heo = {
}
},
changeSayHelloText: function() {
const greetings = GLOBAL_CONFIG.helloText.length == 0 ? ["🤖️ 数码科技爱好者", "🔍 分享与热心帮助", "🏠 智能家居小能手", "🔨 设计开发一条龙", "🤝 专修交互与设计", "🏃 脚踏实地行动派", "🧱 团队小组发动机", "💢 壮汉人狠话不多"] : GLOBAL_CONFIG.helloText
, authorInfoSayHiElement = document.getElementById("author-info__sayhi");
const greetings = GLOBAL_CONFIG.helloText.length == 0 ? ["🤖️ 数码科技爱好者", "🔍 分享与热心帮助", "🏠 智能家居小能手",
"🔨 设计开发一条龙", "🤝 专修交互与设计", "🏃 脚踏实地行动派", "🧱 团队小组发动机", "💢 壮汉人狠话不多"
] : GLOBAL_CONFIG.helloText,
authorInfoSayHiElement = document.getElementById("author-info__sayhi");
// 如果只有一个问候语,设置为默认值
if (greetings.length === 1) {
authorInfoSayHiElement.textContent = greetings[0];
return;
}
let randomGreeting = greetings[Math.floor(Math.random() * greetings.length)];
for (; randomGreeting === lastSayHello; )
for (; randomGreeting === lastSayHello;)
randomGreeting = greetings[Math.floor(Math.random() * greetings.length)];
authorInfoSayHiElement.textContent = randomGreeting,
lastSayHello = randomGreeting
},
//匿名评论
addRandomCommentInfo: function () {
addRandomCommentInfo: function() {
// 从形容词数组中随机取一个值
const randomAdjective = adjectives[Math.floor(Math.random() * adjectives.length)];
@ -589,15 +595,15 @@ var heo = {
//爱发电赞助
addPowerLinksInPostRightSide: async function() {
const image = document.getElementById("power-star-image")
, star = document.getElementById("power-star")
, title = document.getElementById("power-star-title")
, desc = document.getElementById("power-star-desc");
const image = document.getElementById("power-star-image"),
star = document.getElementById("power-star"),
title = document.getElementById("power-star-title"),
desc = document.getElementById("power-star-desc");
if (image && star && title && desc)
try {
const list = GLOBAL_CONFIG.source.power.list
, i = heo.getRandomInt(0, list.length)
, power = list[i].realNode;
const list = GLOBAL_CONFIG.source.power.list,
i = heo.getRandomInt(0, list.length),
power = list[i].realNode;
image.style.backgroundImage = `url(${power.avatar})`,
star.href = power.link,
title.innerText = power.name,
@ -610,12 +616,13 @@ var heo = {
//初始化console图标
initConsoleState: function() {
document.documentElement.classList.contains("hide-aside") ? document.querySelector("#consoleHideAside").classList.add("on") : document.querySelector("#consoleHideAside").classList.remove("on")
document.documentElement.classList.contains("hide-aside") ? document.querySelector("#consoleHideAside")
.classList.add("on") : document.querySelector("#consoleHideAside").classList.remove("on")
},
// 音乐节目切换背景
changeMusicBg: function (isChangeBg = true) {
changeMusicBg: function(isChangeBg = true) {
if (window.location.pathname != "/music") {
return;
}
@ -637,7 +644,7 @@ var heo = {
heo.addEventListenerChangeMusicBg();
// 暂停nav的音乐
if(GLOBAL_CONFIG.navMusicEnable){
if (GLOBAL_CONFIG.navMusicEnable) {
if (
document.querySelector("#nav-music meting-js").aplayer &&
!document.querySelector("#nav-music meting-js").aplayer.audio.paused
@ -649,37 +656,46 @@ var heo = {
}, 100);
}
},
addEventListenerChangeMusicBg: function () {
addEventListenerChangeMusicBg: function() {
const anMusicPage = document.getElementById("anMusic-page");
const aplayerIconMenu = anMusicPage.querySelector(".aplayer-info .aplayer-time .aplayer-icon-menu");
anMusicPage.querySelector("meting-js").aplayer.on("loadeddata", function () {
anMusicPage.querySelector("meting-js").aplayer.on("loadeddata", function() {
heo.changeMusicBg();
console.info("player loadeddata");
});
aplayerIconMenu.addEventListener("click", function () {
$(".music-mask").css("display","block")
$(".music-mask").css("animation","0.5s ease 0s 1 normal none running to_show")
aplayerIconMenu.addEventListener("click", function() {
$(".music-mask").css("display", "block")
$(".music-mask").css("animation", "0.5s ease 0s 1 normal none running to_show")
});
$(".music-mask").click(function(){
$(".music-mask").click(function() {
anMusicPage.querySelector(".aplayer-list").classList.remove("aplayer-list-hide");
$(".music-mask").hide();
})
},
};
const adjectives = ["美丽的", "英俊的", "聪明的", "勇敢的", "可爱的", "慷慨的", "善良的", "可靠的", "开朗的", "成熟的", "稳重的", "真诚的", "幽默的", "豁达的", "有趣的", "活泼的", "优雅的", "敏捷的", "温柔的", "温暖的", "敬业的", "细心的", "耐心的", "深沉的", "朴素的", "含蓄的", "率直的", "开放的", "务实的", "坚强的", "自信的", "谦虚的", "文静的", "深刻的", "纯真的", "朝气蓬勃的", "慎重的", "大方的", "顽强的", "迷人的", "机智的", "善解人意的", "富有想象力的", "有魅力的", "独立的", "好奇的", "干净的", "宽容的", "尊重他人的", "体贴的", "守信的", "有耐性的", "有责任心的", "有担当的", "有远见的", "有智慧的", "有眼光的", "有冒险精神的", "有爱心的", "有同情心的", "喜欢思考的", "喜欢学习的", "具有批判性思维的", "善于表达的", "善于沟通的", "善于合作的", "善于领导的", "有激情的", "有幽默感的", "有思想的", "有个性的", "有正义感的", "有责任感的", "有创造力的", "有想象力的", "有艺术细胞的", "有团队精神的", "有协调能力的", "有决策能力的", "有组织能力的", "有学习能力的", "有执行能力的", "有分析能力的", "有逻辑思维的", "有创新能力的", "有专业素养的", "有商业头脑的"]
, vegetablesAndFruits = ["萝卜", "白菜", "芹菜", "生菜", "青椒", "辣椒", "茄子", "豆角", "黄瓜", "西红柿", "洋葱", "大蒜", "土豆", "南瓜", "豆腐", "韭菜", "花菜", "西兰花", "蘑菇", "金针菇", "苹果", "香蕉", "橙子", "柠檬", "猕猴桃", "草莓", "葡萄", "桃子", "杏子", "李子", "石榴", "西瓜", "哈密瓜", "蜜瓜", "樱桃", "蓝莓", "柿子", "橄榄", "柚子", "火龙果"];
const adjectives = ["美丽的", "英俊的", "聪明的", "勇敢的", "可爱的", "慷慨的", "善良的", "可靠的", "开朗的", "成熟的", "稳重的", "真诚的", "幽默的", "豁达的",
"有趣的", "活泼的", "优雅的", "敏捷的", "温柔的", "温暖的", "敬业的", "细心的", "耐心的", "深沉的", "朴素的", "含蓄的", "率直的", "开放的", "务实的", "坚强的",
"自信的", "谦虚的", "文静的", "深刻的", "纯真的", "朝气蓬勃的", "慎重的", "大方的", "顽强的", "迷人的", "机智的", "善解人意的", "富有想象力的", "有魅力的", "独立的",
"好奇的", "干净的", "宽容的", "尊重他人的", "体贴的", "守信的", "有耐性的", "有责任心的", "有担当的", "有远见的", "有智慧的", "有眼光的", "有冒险精神的", "有爱心的",
"有同情心的", "喜欢思考的", "喜欢学习的", "具有批判性思维的", "善于表达的", "善于沟通的", "善于合作的", "善于领导的", "有激情的", "有幽默感的", "有思想的", "有个性的",
"有正义感的", "有责任感的", "有创造力的", "有想象力的", "有艺术细胞的", "有团队精神的", "有协调能力的", "有决策能力的", "有组织能力的", "有学习能力的", "有执行能力的",
"有分析能力的", "有逻辑思维的", "有创新能力的", "有专业素养的", "有商业头脑的"
],
vegetablesAndFruits = ["萝卜", "白菜", "芹菜", "生菜", "青椒", "辣椒", "茄子", "豆角", "黄瓜", "西红柿", "洋葱", "大蒜", "土豆", "南瓜", "豆腐",
"韭菜", "花菜", "西兰花", "蘑菇", "金针菇", "苹果", "香蕉", "橙子", "柠檬", "猕猴桃", "草莓", "葡萄", "桃子", "杏子", "李子", "石榴", "西瓜", "哈密瓜",
"蜜瓜", "樱桃", "蓝莓", "柿子", "橄榄", "柚子", "火龙果"
];
$(document).ready((function() {
initBlog()
}
)),
document.addEventListener("pjax:complete", (function() {
})),
document.addEventListener("pjax:complete", (function() {
initBlog();
// 解决 katex pjax问题
if((GLOBAL_CONFIG.htmlType == 'post' || GLOBAL_CONFIG.htmlType == 'page') && typeof window.renderKaTex != 'undefined'){
if ((GLOBAL_CONFIG.htmlType == 'post' || GLOBAL_CONFIG.htmlType == 'page') && typeof window
.renderKaTex != 'undefined') {
window.renderKaTex();
}
}
));
}));

View File

@ -3,7 +3,7 @@ var btf = {
// 修改时间显示"最近"
diffDateExact: function (d, more = false) {
diffDateExact: function(d, more = false) {
const dateNow = new Date();
const datePost = new Date(d);
const dateDiff = dateNow.getTime() - datePost.getTime();
@ -39,9 +39,9 @@ var btf = {
loadLightbox: ele => {
const jqLoadAndRun = () => {
const $fancyboxEle = GLOBAL_CONFIG.lightbox === 'fancybox'
? ele
: []
const $fancyboxEle = GLOBAL_CONFIG.lightbox === 'fancybox' ?
ele :
[]
const fbLengthNoZero = $fancyboxEle.length > 0
if (fbLengthNoZero) {
@ -54,13 +54,15 @@ var btf = {
/**
* fancybox
*/
const addFancybox = function (ele) {
const addFancybox = function(ele) {
const runFancybox = (ele) => {
ele.each(function (i, o) {
ele.each(function(i, o) {
const $this = $(o)
const lazyloadSrc = $this.attr('data-lazy-src') || $this.attr('src')
const dataCaption = $this.attr('alt') || ''
$this.wrap(`<a href="${lazyloadSrc}" data-fancybox="images" data-caption="${dataCaption}" class="fancybox" data-srcset="${lazyloadSrc}"></a>`)
$this.wrap(
`<a href="${lazyloadSrc}" data-fancybox="images" data-caption="${dataCaption}" class="fancybox" data-srcset="${lazyloadSrc}"></a>`
)
})
$().fancybox({
@ -75,7 +77,7 @@ var btf = {
if (typeof $.fancybox === 'undefined') {
// $('head').append(`<link rel="stylesheet" type="text/css" href="${GLOBAL_CONFIG.source.fancybox.css}">`)
$.getScript(`${GLOBAL_CONFIG.source.fancybox.js}`, function () {
$.getScript(`${GLOBAL_CONFIG.source.fancybox.js}`, function() {
runFancybox($(ele))
})
} else {
@ -86,12 +88,12 @@ var btf = {
jqLoadAndRun()
},
debounce: function (func, wait, immediate) {
debounce: function(func, wait, immediate) {
let timeout
return function () {
return function() {
const context = this
const args = arguments
const later = function () {
const later = function() {
timeout = null
if (!immediate) func.apply(context, args)
}
@ -102,19 +104,19 @@ var btf = {
}
},
throttle: function (func, wait, options) {
throttle: function(func, wait, options) {
let timeout, context, args
let previous = 0
if (!options) options = {}
const later = function () {
const later = function() {
previous = options.leading === false ? 0 : new Date().getTime()
timeout = null
func.apply(context, args)
if (!timeout) context = args = null
}
const throttled = function () {
const throttled = function() {
const now = new Date().getTime()
if (!previous && options.leading === false) previous = now
const remaining = wait - (now - previous)
@ -146,7 +148,11 @@ var btf = {
},
snackbarShow: (text, showActionFunction = false, duration = 2000, actionText = false) => {
const { position, bgLight, bgDark } = GLOBAL_CONFIG.Snackbar;
const {
position,
bgLight,
bgDark
} = GLOBAL_CONFIG.Snackbar;
const bg = document.documentElement.getAttribute("data-theme") === "light" ? bgLight : bgDark;
const root = document.querySelector(":root");
root.style.setProperty("--heo-snackbar-time", duration + "ms");
@ -163,7 +169,7 @@ var btf = {
});
},
initJustifiedGallerys: function (selector) {
initJustifiedGallerys: function(selector) {
selector.forEach((function(t) {
btf.isHidden(t) || fjGallery(t, {
itemSelector: ".fj-gallery-item",
@ -173,8 +179,7 @@ var btf = {
this.$container.style.opacity = "1"
}
})
}
))
}))
document.querySelectorAll('#article-container .loadings')[0]?.classList.remove("loadings");
},
@ -225,7 +230,9 @@ var btf = {
callback()
observerItem.disconnect()
}
}, {threshold: [0]})
}, {
threshold: [0]
})
observerItem.observe(dom)
} else {
callback()
@ -233,12 +240,12 @@ var btf = {
},
scrollToDest: (e,t)=>{
scrollToDest: (e, t) => {
if (e < 0 || t < 0)
return;
const n = window.scrollY || window.screenTop;
if (e -= 70,
"CSS"in window && CSS.supports("scroll-behavior", "smooth"))
"CSS" in window && CSS.supports("scroll-behavior", "smooth"))
return void window.scrollTo({
top: e,
behavior: "smooth"
@ -256,8 +263,7 @@ var btf = {
window.scrollTo(0, n - (n - e) * r / t),
r < t ? window.requestAnimationFrame(i) : window.scrollTo(0, e)
}
}
))
}))
},
fadeIn: (ele, time) => {
@ -295,7 +301,7 @@ var btf = {
* @param {*} id id
* @param {*} cn class name
*/
wrap: function (selector, eleType, id = '', cn = '') {
wrap: function(selector, eleType, id = '', cn = '') {
const creatEle = document.createElement(eleType)
if (id) creatEle.id = id
if (cn) creatEle.className = cn
@ -303,7 +309,7 @@ var btf = {
creatEle.appendChild(selector)
},
unwrap: function (el) {
unwrap: function(el) {
const elParentNode = el.parentNode
if (elParentNode !== document.body) {
elParentNode.parentNode.insertBefore(el, elParentNode)
@ -333,7 +339,7 @@ var btf = {
return actualTop
},
//过滤标签
changeContent: (content,length = null)=>{
changeContent: (content, length = null) => {
if (content === '') return content
content = content.replace(/<img.*?src="(.*?)"?[^\>]+>/ig, '[图片]') // replace image link
@ -341,7 +347,7 @@ var btf = {
content = content.replace(/<pre><code>.*?<\/pre>/gi, '[代码]') // replace code
content = content.replace(/<[^>]+>/g, "") // remove html tag
if (length!=null){
if (length != null) {
if (content.length > length) {
content = content.substring(0, length) + '...'
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -279,10 +279,37 @@ i.haofont.hao-icon-arrow-right.banner-righticon{
--hao-gl-size: 16px !important;
}
#aside-content .card-announcement .item-headline i{
color: red;
color: palevioletred;
margin-left: -6px;
}
/* 小板报 */
#aside-content .card-ad .item-headline i{
color: orangered;
margin-left: -6px;
}
#aside-content .card-power .item-headline i{
color: mediumpurple;
margin-right: 5px;
}
#aside-content .card-categories .item-headline i{
color: burlywood;
margin-right: 2px;
}
#aside-content .card-toc .item-headline i{
color: green;
}
#aside-content .card-comment .item-headline i{
color: rosybrown;
}
#aside-content .card-article .item-headline i{
color: cornflowerblue;
}
/* Steam卡片 */
#aside-content .item-headline-steam {

View File

@ -3,12 +3,12 @@ let rm = {};
//禁止图片拖拽
rm.stopdragimg = $("img");
rm.stopdragimg.on("dragstart", function () {
rm.stopdragimg.on("dragstart", function() {
return false;
});
// 显示菜单
rm.showRightMenu = function (isTrue, x = 0, y = 0) {
rm.showRightMenu = function(isTrue, x = 0, y = 0) {
let $rightMenu = $('#rightMenu');
$rightMenu.css('top', x + 'px').css('left', y + 'px');
if (isTrue) {
@ -20,7 +20,7 @@ rm.showRightMenu = function (isTrue, x = 0, y = 0) {
}
// 隐藏菜单
rm.hideRightMenu = function () {
rm.hideRightMenu = function() {
rm.showRightMenu(false);
$('#rightmenu-mask').attr('style', 'display: none');
}
@ -30,7 +30,7 @@ let rmWidth = $('#rightMenu').width();
let rmHeight = $('#rightMenu').height();
// 重新定义尺寸
rm.reloadrmSize = function () {
rm.reloadrmSize = function() {
rmWidth = $('#rightMenu').width();
rmHeight = $('#rightMenu').height();
}
@ -41,7 +41,7 @@ let domImgSrc = '';
let globalEvent = null;
// 监听右键初始化
window.oncontextmenu = function (event) {
window.oncontextmenu = function(event) {
if (document.body.clientWidth > 768) {
let pageX = event.clientX + 10; //加10是为了防止显示时鼠标遮在菜单上
let pageY = event.clientY;
@ -165,13 +165,13 @@ window.oncontextmenu = function (event) {
rm.downloadimging = false;
// 复制图片到剪贴板
rm.writeClipImg = function (imgsrc) {
rm.writeClipImg = function(imgsrc) {
console.log('按下复制');
rm.hideRightMenu();
btf.snackbarShow('正在下载中,请稍后', false, 10000)
if (rm.downloadimging == false) {
rm.downloadimging = true;
setTimeout(function () {
setTimeout(function() {
copyImage(imgsrc);
btf.snackbarShow('复制成功!图片已添加盲水印,请遵守版权协议');
rm.downloadimging = false;
@ -186,7 +186,7 @@ function imageToBlob(imageURL) {
img.crossOrigin = "";
img.src = imageURL;
return new Promise(resolve => {
img.onload = function () {
img.onload = function() {
c.width = this.naturalWidth;
c.height = this.naturalHeight;
ctx.drawImage(this, 0, 0);
@ -200,18 +200,20 @@ function imageToBlob(imageURL) {
async function copyImage(imageURL) {
const blob = await imageToBlob(imageURL)
const item = new ClipboardItem({"image/png": blob});
const item = new ClipboardItem({
"image/png": blob
});
navigator.clipboard.write([item]);
}
rm.switchDarkMode = function () {
rm.switchDarkMode = function() {
navFn.switchDarkMode();
rm.hideRightMenu();
//halo.darkComment();
}
rm.copyUrl = function (id) {
rm.copyUrl = function(id) {
$("body").after("<input id='copyVal'></input>");
var text = id;
var input = document.getElementById("copyVal");
@ -225,7 +227,7 @@ rm.copyUrl = function (id) {
function stopMaskScroll() {
if (document.getElementById("rightmenu-mask")) {
let xscroll = document.getElementById("rightmenu-mask");
xscroll.addEventListener("mousewheel", function (e) {
xscroll.addEventListener("mousewheel", function(e) {
//阻止浏览器默认方法
rm.hideRightMenu();
// e.preventDefault();
@ -233,7 +235,7 @@ function stopMaskScroll() {
}
if (document.getElementById("rightMenu")) {
let xscroll = document.getElementById("rightMenu");
xscroll.addEventListener("mousewheel", function (e) {
xscroll.addEventListener("mousewheel", function(e) {
//阻止浏览器默认方法
rm.hideRightMenu();
// e.preventDefault();
@ -241,21 +243,21 @@ function stopMaskScroll() {
}
}
rm.rightmenuCopyText = function (txt) {
rm.rightmenuCopyText = function(txt) {
if (navigator.clipboard) {
navigator.clipboard.writeText(txt);
}
rm.hideRightMenu();
}
rm.copyPageUrl = function () {
rm.copyPageUrl = function() {
var url = window.location.href;
rm.copyUrl(url);
btf.snackbarShow('复制本页链接地址成功', false, 2000);
rm.hideRightMenu();
}
rm.sharePage = function () {
rm.sharePage = function() {
var content = window.location.href;
rm.copyUrl(url);
btf.snackbarShow('复制本页链接地址成功', false, 2000);
@ -282,14 +284,14 @@ function selceText() {
}
// 读取剪切板
rm.readClipboard = function () {
rm.readClipboard = function() {
if (navigator.clipboard) {
navigator.clipboard.readText().then(clipText => rm.insertAtCaret(globalEvent.target, clipText));
}
}
// 粘贴文本到焦点
rm.insertAtCaret = function (elemt, value) {
rm.insertAtCaret = function(elemt, value) {
const startPos = elemt.selectionStart,
endPos = elemt.selectionEnd;
if (document.selection) {
@ -300,7 +302,8 @@ rm.insertAtCaret = function (elemt, value) {
} else {
if (startPos || startPos == '0') {
var scrollTop = elemt.scrollTop;
elemt.value = elemt.value.substring(0, startPos) + value + elemt.value.substring(endPos, elemt.value.length);
elemt.value = elemt.value.substring(0, startPos) + value + elemt.value.substring(endPos, elemt.value
.length);
elemt.focus();
elemt.selectionStart = startPos + value.length;
elemt.selectionEnd = startPos + value.length;
@ -313,13 +316,13 @@ rm.insertAtCaret = function (elemt, value) {
}
//粘贴文本
rm.pasteText = function () {
rm.pasteText = function() {
const result = rm.readClipboard() || '';
rm.hideRightMenu();
}
//引用到评论
rm.rightMenuCommentText = function (txt) {
rm.rightMenuCommentText = function(txt) {
rm.hideRightMenu();
var input = document.getElementsByClassName(GLOBAL_CONFIG.source.comments.textarea)[0];
let evt = document.createEvent('HTMLEvents');
@ -342,76 +345,76 @@ function replaceAll(string, search, replace) {
}
// 百度搜索
rm.searchBaidu = function () {
rm.searchBaidu = function() {
btf.snackbarShow('即将跳转到百度搜索', false, 2000);
setTimeout(function () {
setTimeout(function() {
window.open('https://www.baidu.com/s?wd=' + selectTextNow);
}, "2000");
rm.hideRightMenu();
}
//分享链接
rm.copyLink = function () {
rm.copyLink = function() {
rm.rightmenuCopyText(domhref);
btf.snackbarShow('已复制链接地址');
}
function addRightMenuClickEvent() {
// 添加点击事件
$('#menu-backward').on('click', function () {
$('#menu-backward').on('click', function() {
window.history.back();
rm.hideRightMenu();
});
$('#menu-forward').on('click', function () {
$('#menu-forward').on('click', function() {
window.history.forward();
rm.hideRightMenu();
});
$('#menu-refresh').on('click', function () {
$('#menu-refresh').on('click', function() {
window.location.reload();
});
$('#menu-top').on('click', function () {
$('#menu-top').on('click', function() {
btf.scrollToDest(0, 500);
rm.hideRightMenu();
});
$('.menu-link').on('click', rm.hideRightMenu);
$('#menu-darkmode').on('click', rm.switchDarkMode);
$('#menu-home').on('click', function () {
$('#menu-home').on('click', function() {
window.location.href = window.location.origin;
});
$('#menu-randomPost').on('click', function () {
$('#menu-randomPost').on('click', function() {
toRandomPost()
});
$('#menu-commentBarrage').on('click', heo.switchCommentBarrage);
$('#rightmenu-mask').on('click', rm.hideRightMenu);
$('#rightmenu-mask').contextmenu(function () {
$('#rightmenu-mask').contextmenu(function() {
rm.hideRightMenu();
return false;
});
$('#menu-translate').on('click', function () {
$('#menu-translate').on('click', function() {
rm.hideRightMenu();
});
$('#menu-copy').on('click', rm.copyPageUrl);
$('#menu-pastetext').on('click', rm.pasteText);
$('#menu-copytext').on('click', function () {
$('#menu-copytext').on('click', function() {
rm.rightmenuCopyText(selectTextNow);
btf.snackbarShow('复制成功,复制和转载请标注本文地址');
});
$('#menu-commenttext').on('click', function () {
$('#menu-commenttext').on('click', function() {
rm.rightMenuCommentText(selectTextNow);
});
$('#menu-newwindow').on('click', function () {
$('#menu-newwindow').on('click', function() {
window.open(domhref);
rm.hideRightMenu();
});
$('#menu-copylink').on('click', rm.copyLink);
$('#menu-downloadimg').on('click', function () {
$('#menu-downloadimg').on('click', function() {
heo.downloadImage(domImgSrc, 'hao');
});
$('#menu-newwindowimg').on('click', function () {
$('#menu-newwindowimg').on('click', function() {
window.open(domImgSrc, "_blank");
rm.hideRightMenu();
});
$('#menu-copyimg').on('click', function () {
$('#menu-copyimg').on('click', function() {
rm.writeClipImg(domImgSrc);
});
$('#menu-searchBaidu').on('click', rm.searchBaidu);
@ -419,7 +422,7 @@ function addRightMenuClickEvent() {
$('#menu-music-toggle').on('click', heo.musicToggle);
$('#menu-music-back').on('click', heo.musicSkipBack);
$('#menu-music-forward').on('click', heo.musicSkipForward);
$('#menu-music-copyMusicName').on('click', function () {
$('#menu-music-copyMusicName').on('click', function() {
rm.rightmenuCopyText(heo.musicGetName());
btf.snackbarShow('复制歌曲名称成功', false, 3000);
});

View File

@ -2064,7 +2064,7 @@ blockquote footer cite::before {
#aside-content .card-archives ul.card-archive-list,
#aside-content .card-categories ul.card-category-list {
margin: 0px;
margin: 8px 0 0 0;
padding: 0px;
list-style: none;
}
@ -2860,11 +2860,11 @@ blockquote footer cite::before {
display: inline;
}
#nav .menus_items .menus_item {
/* #nav .menus_items .menus_item {
position: relative;
display: inline-block;
padding: 0px 0.4rem 0px 0px;
}
} */
#nav .menus_items .recursion_menus_item:hover>.menus_item_child,
#nav .menus_items .menus_item:hover>.menus_item_child {
@ -7438,7 +7438,7 @@ span.fund_name {
}
#aside-content .card-widget.card-power .power-charge {
margin-left: auto;
margin-left: 6.5rem;
color: var(--heo-secondtext);
font-size: 14px;
line-height: 1
@ -7491,7 +7491,7 @@ a#power-star {
flex-wrap: nowrap;
justify-content: flex-start;
position: relative;
margin: 12px 0;
margin: 12px 10px;
background: var(--heo-secondbg);
transition: .3s ease-out
}
@ -11557,15 +11557,15 @@ blockquote p {
#article-container .headerlink {
float: right;
opacity: 0.08;
opacity: 0.5;
border-bottom-style: none;
border-bottom: none;
position: relative;
padding: 0px;
border: none;
border-radius: 8px !important;
line-height: 1;
font-size: 1rem;
/* line-height: 1; */
/* font-size: 1rem; */
}
#article-container .headerlink:hover {
@ -12432,11 +12432,6 @@ a.reward-main-btn:hover {
}
/* 评论 */
/* ---------------------------------------------------------------- */
/* ---------------------------------------------------------------- */
/* ---------------------------------------------------------------- */
/* ---------------------------------------------------------------- */
/* ---------------------------------------------------------------- */
div#post-comment {
margin-top: 2rem;
}
@ -16830,8 +16825,8 @@ span.hexo-douban-pagenum {
.author-content-item .card-content .banner-button-group {
position: absolute;
bottom: 1.5rem;
right: 2rem;
bottom: 1rem;
right: 1rem;
}
.author-content-item .card-content .banner-button-group .banner-button {
@ -16867,7 +16862,7 @@ span.hexo-douban-pagenum {
}
.author-content-item .card-content .banner-button-group .banner-button {
background: none;
background: none !important;
color: var(--heo-white);
padding: 0;
width: fit-content;
@ -18931,3 +18926,9 @@ body[data-type=neodb] .type-button-group button {
margin: 12px 0 0 0;
border-radius: 8px;
}
.ad-img:hover {
-webkit-backface-visibility: hidden;
-webkit-transform-style: preserve-3d;
transform: scale(1.05)
}

View File

@ -152,6 +152,8 @@
<script th:src="${assets_link + '/libs/pjax/pjax.min.js'}"></script>
<script th:src="${assets_link + '/libs/crypto/crypto-js.min.js'}"></script>
<!-- swiper 在瞬间滚动时会使用 -->
<script th:if="${theme.config.top.moment}" data-pjax
src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/Swiper/6.6.2/swiper-bundle.min.js"></script>

View File

@ -58,7 +58,6 @@
power: {
powerLink: [[${theme.config.sidebar.power.powerLink}]],
url: [[${theme.config.sidebar.power.url}]],
userId: [[${theme.config.sidebar.power.userId}]],
showNum: [[${theme.config.sidebar.power.showNum}]]
},
links: {

View File

@ -16,8 +16,8 @@
</div>
<div class="card-widget" th:if="${theme.config.sidebar.adbox.adType=='customAd'}">
<div class="item-headline"><i class="haofont hao-icon-bullhorn"></i><span>广告</span></div>
<div class="card-widget card-ad" th:if="${theme.config.sidebar.adbox.adType=='customAd'}">
<div class="item-headline"><i class="haofont hao-icon-fire"></i><span>广告</span></div>
<a th:href="${theme.config.sidebar.adbox.ad_custom.ad_redirect_url}" target="_blank" title="立即前往">
<img class="ad-img" th:src="${theme.config.sidebar.adbox.ad_custom.ad_pic_url}" alt="自定义广告">
</a>

View File

@ -1,5 +1,5 @@
<!-- 最新评论 -->
<div class="card-widget card-recent-post" >
<div class="card-widget card-recent-post card-comment" >
<a th:if="${not #strings.isEmpty(theme.config.sidebar.newcomment.newcommentUrl)}"
th:onclick="pjax.loadUrl([[${theme.config.sidebar.newcomment.newcommentUrl}]])"
title="查看更多"

View File

@ -1,11 +1,11 @@
<!-- 爱发电赞助 -->
<div>
<div class="card-widget card-power">
<div class="item-headline"><i class="haofont hao-icon-aifadian-line"></i><span>爱发电赞助</span>
<div class="item-headline"><i class="haofont hao-icon-aifadian-line"></i><span>爱发电</span>
<a class="power-charge" th:href="${theme.config.sidebar.power.powerLink}" target="_blank" title="赞助博主">赞助
</a>
</div>
<a id="power-star" rel="external nofollow" target="_blank" title="推荐博主">
<a id="power-star" rel="external nofollow" target="_blank" title="感谢赞助博主">
</a>
<div class="power-list">

View File

@ -1,4 +1,4 @@
<div class="card-widget card-recent-post" th:with='posts = ${postFinder.list(1,theme.config.sidebar.recentPost)},
<div class="card-widget card-recent-post card-article" th:with='posts = ${postFinder.list(1,theme.config.sidebar.recentPost)},
postRandomImg=${#strings.contains(theme.config.layout.postRandomImg,"?") ? theme.config.layout.postRandomImg+"&" : theme.config.layout.postRandomImg+"?"}'>
<div class="item-headline"><i class="haofont hao-icon-eicon_map-2-line1"></i><span>最近发布</span></div>
<div class="aside-list">

View File

@ -1,5 +1,5 @@
<!-- 目录 -->
<div class="card-widget" id="card-toc">
<div class="card-widget card-toc" id="card-toc">
<div class="item-headline">
<i class="haofont hao-icon-bars"></i>
<span>文章目录</span>

View File

@ -4,9 +4,9 @@
<!-- 功能都需要添加开关 -->
<!-- 随机前往一个开往项目网站 -->
<div class="nav-button only-home" id="travellings_button" title="随机前往一个开往项目网站" th:if="${theme.config.nav.right.travelling}">
<a class="site-page" href="https://www.travellings.cn/go.html" rel="external nofollow"
title="随机前往一个开往项目网站">
<div class="nav-button only-home" id="travellings_button" title="随机前往一个开往项目网站"
th:if="${theme.config.nav.right.travelling}">
<a class="site-page" href="https://www.travellings.cn/go.html" rel="external nofollow" title="随机前往一个开往项目网站">
<i class="haofont hao-icon-eicon_train-line"></i>
</a>
</div>
@ -19,8 +19,8 @@
<!-- 切换模式 -->
<div class="nav-button" id="darkmode_button" th:if="${theme.config.nav.right.darkMode}">
<a class="console_switchbutton" href="javascript:void(0);" onclick="navFn.switchDarkMode();" rel="external nofollow"
title="切换模式 - 日夜交替,黑白互换。">
<a class="console_switchbutton" href="javascript:void(0);" onclick="navFn.switchDarkMode();"
rel="external nofollow" title="切换模式 - 日夜交替,黑白互换。">
<i class="haofont hao-icon-moon-clear-fill" style="font-size: 1rem;"></i>
</a>
</div>
@ -37,8 +37,7 @@
th:with="currentUser = ${contributorFinder.getContributor(#authentication.name)}">
<span class="site-page nav-login">
<i sec:authorize="isAnonymous()" class="haofont hao-icon-zhanghao1 " style="font-size: 19.5px;"></i>
<img sec:authorize="isAuthenticated()" th:src="${currentUser.avatar}"
th:alt="${currentUser.displayName}"
<img sec:authorize="isAuthenticated()" th:src="${currentUser.avatar}" th:alt="${currentUser.displayName}"
style=" width: 24px; height: 24px; border-radius: 9999px" />
</span>
<div class="back-menu-list-groups">
@ -49,11 +48,12 @@
<span class="back-menu-item-text">控制台</span>
</a>
<a class="back-menu-item" rel="external nofollow"
href="javascript:$.ajax({type: 'post',url:'/logout'});window.location.reload()">
href="javascript:$.ajax({type: 'post',url:'/logout',headers:{'X-Xsrf-Token':document.cookie.split('; ').find((row) => row.startsWith('XSRF-TOKEN'))?.split('=')[1] || ''},success: function() {window.location.reload();},error: function(xhr, status, error) {console.error('退出登录时发生错误:', error);}});">
<span class="back-menu-item-text">退出登录</span>
</a>
</th:block>
<a sec:authorize="isAnonymous()" class="back-menu-item" rel="external nofollow" target="_blank" href="/console/login">
<a sec:authorize="isAnonymous()" class="back-menu-item" rel="external nofollow" target="_blank"
href="/console/login">
<span class="back-menu-item-text">登录</span>
</a>
</div>

View File

@ -48,8 +48,8 @@ spec:
description: Halo 2.x Theme base on Thymeleaf, Referring to Butterfly and Heo
logo: /themes/theme-hao/assets/images/hao-logo.jpg
website: https://blog.uptoz.cn
repo: https://githubfast.com/liuzhihang/halo-theme-hao
repo: https://gitea.uptoz.cn/UPToZ/halo-theme-hao
settingName: "theme-hao-setting"
configMapName: "theme-hao-configMap"
version: "1.4.9-CommemorativeEdition"
version: "1.0.1-ce"
require: ">=2.10.0"