Merge pull request #11 from liuzhihang/dev

Dev
This commit is contained in:
liuzhihang 2022-11-19 22:53:10 +08:00 committed by GitHub
commit 8278b8c261
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 173 additions and 126 deletions

View File

@ -9,7 +9,7 @@
---
预览:[程序员小航](https://liuzhihang.com)
预览:[程序员小航](http://hao.liuzhihang.com/)
文档:[语雀](https://www.yuque.com/liuzhihangs/halo-theme-hao)

View File

@ -1,6 +1,6 @@
{
"name": "halo-theme-hao",
"version": "1.0.0-beta.1",
"version": "1.0.0-beta.2",
"dependencies": {
}
}

View File

@ -36,15 +36,6 @@ spec:
- group: top
label: 顶部
formSchema:
- $formkit: radio
name: recentTop
label: 首页顶部
value: true
options:
- label: 显示
value: true
- label: 隐藏
value: false
- $formkit: radio
name: moment
label: 说说模块
@ -54,33 +45,103 @@ spec:
value: true
- label: 隐藏
value: false
- $formkit: radio
name: recentTop
id: recentTop
key: recentTop
label: 首页顶部
value: true
options:
- label: 显示
value: true
- label: 隐藏
value: false
- $formkit: text
if: "$get(recentTop).value"
name: bannersTitleBig
label: Banners 大标题
placeholder: 请输入大标题
value: Halo Theme Hao
help: 支持 HTML 语法
- $formkit: text
if: "$get(recentTop).value"
name: bannersTitleSmall
label: Banners 小标题
placeholder: 请输入小标题
value: 更多信息请关注 GitHub
help: 支持 HTML 语法
- $formkit: repeater
if: "$get(recentTop).value"
name: bannersIconPair
label: Banner 滚动图标
help: 为空时会使用系统内置图标
value:
- top:
bottom:
children:
- $formkit: group
name: top
label: 上图标
value:
url:
name:
background:
children:
- $formkit: url
name: url
label: 路径
placeholder: 请输入图标路径
validation: "url"
- $formkit: text
name: name
label: 名称
placeholder: 请输入名称
- $formkit: color
name: background
label: 背景色
- $formkit: group
name: bottom
label: 下图标
value:
url:
name:
background:
children:
- $formkit: url
name: url
label: 路径
placeholder: 请输入图标路径
validation: "url"
- $formkit: text
name: name
label: 名称
placeholder: 请输入名称
- $formkit: color
name: background
label: 背景色
- $formkit: url
if: "$get(recentTop).value"
name: bikan
label: 必看精选
placeholder: 请输入地址
validation: "url"
- $formkit: url
if: "$get(recentTop).value"
name: remen
label: 必看精选
placeholder: 请输入地址
validation: "url"
- $formkit: url
if: "$get(recentTop).value"
name: shiyong
label: 必看精选
placeholder: 请输入地址
validation: "url"
- $formkit: radio
if: "$get(recentTop).value"
name: todayRecommend
id: todayRecommend
key: todayRecommend
label: 今日推荐
value: false
options:
@ -88,21 +149,30 @@ spec:
value: true
- label: 隐藏
value: false
- $formkit: url
name: todayRecommendUrl
label: 今日推荐跳转地址
placeholder: 请输入地址
validation: "url"
- $formkit: text
name: todayRecommendTitle
label: 今日推荐标题
placeholder: 请输入标题
value: "今日推荐"
- $formkit: url
name: todayRecommendCover
label: 今日推荐背景图
placeholder: 请输入地址
validation: "url"
- $formkit: group
if: "$get(todayRecommend).value"
name: todayRecommendContent
label: 公众号
value:
todayRecommendUrl:
todayRecommendTitle:
todayRecommendCover:
children:
- $formkit: url
name: todayRecommendUrl
label: 今日推荐跳转地址
placeholder: 请输入地址
validation: "url"
- $formkit: text
name: todayRecommendTitle
label: 今日推荐标题
placeholder: 请输入标题
value: "今日推荐"
- $formkit: url
name: todayRecommendCover
label: 今日推荐背景图
placeholder: 请输入地址
validation: "url"
- group: layout
label: 布局
@ -155,42 +225,6 @@ spec:
label: "右侧"
- value: "left-aside"
label: "左侧"
# - $formkit: repeater
# name: widgets
# label: 小部件
# value:
# - value: profile
# - value: wechat
# - value: comments
# - value: recent-posts
# - value: comments
# - value: categories
# - value: tags
# - value: stat
# - value: tags-stat
# children:
# - $formkit: select
# name: value
# label: 部件
# options:
# - label: 站点资料
# value: profile
# - label: 微信
# value: wechat
# - label: 近期文章
# value: recent-posts
# - label: 最新评论
# value: comments
# - label: 文章分类
# value: categories
# - label: 文章标签
# value: tags
# - label: 统计
# value: stat
# - label: 标签&统计
# value: tags-stat
- $formkit: textarea
name: widgets
label: 小部件

View File

@ -89,57 +89,57 @@ var heo = {
// 标签页面
//分类条
tagPageActive: function () {
var urlinfo = window.location.pathname;
urlinfo = decodeURIComponent(urlinfo)
// console.log(urlinfo);
// 验证是否是分类链接
var pattern = /\/tags\/.*?\//;
var patbool = pattern.test(urlinfo);
// console.log(patbool);
// 获取当前的分类
if (patbool) {
var valuegroup = urlinfo.split("/");
// console.log(valuegroup[2]);
// 获取当前分类
var nowCategorie = valuegroup[2];
if (document.querySelector('#tag-page-tags')) {
$('a').removeClass('select')
document.getElementById(nowCategorie).classList.add("select");
}
}
},
// tagPageActive: function () {
// var urlinfo = window.location.pathname;
// urlinfo = decodeURIComponent(urlinfo)
// // console.log(urlinfo);
// // 验证是否是分类链接
// var pattern = /\/tags\/.*?\//;
// var patbool = pattern.test(urlinfo);
// // console.log(patbool);
// // 获取当前的分类
// if (patbool) {
// var valuegroup = urlinfo.split("/");
// // console.log(valuegroup[2]);
// // 获取当前分类
// var nowCategorie = valuegroup[2];
// if (document.querySelector('#tag-page-tags')) {
// $('a').removeClass('select')
// document.getElementById(nowCategorie).classList.add("select");
// }
// }
// },
//分类条
categoriesBarActive: function () {
if (document.querySelector('#category-bar')) {
$(".category-bar-item").removeClass("select")
}
var urlinfo = window.location.pathname;
urlinfo = decodeURIComponent(urlinfo);
// console.log(urlinfo);
//判断是否是首页
if (urlinfo == '/') {
if (document.querySelector('#category-bar')) {
document.getElementById('category-bar-home').classList.add("select");
}
} else {
// 验证是否是分类链接
var pattern = /\/categories\/.*?\//;
var patbool = pattern.test(urlinfo);
// console.log(patbool);
// 获取当前的分类
if (patbool) {
var valuegroup = urlinfo.split("/");
// console.log(valuegroup[2]);
// 获取当前分类
var nowCategorie = valuegroup[2];
if (document.querySelector('#category-bar')) {
document.getElementById(nowCategorie).classList.add("select");
}
}
}
},
// categoriesBarActive: function () {
// if (document.querySelector('#category-bar')) {
// $(".category-bar-item").removeClass("select")
// }
// var urlinfo = window.location.pathname;
// urlinfo = decodeURIComponent(urlinfo);
// // console.log(urlinfo);
// //判断是否是首页
// if (urlinfo == '/') {
// if (document.querySelector('#category-bar')) {
// document.getElementById('category-bar-home').classList.add("select");
// }
// } else {
// // 验证是否是分类链接
// var pattern = /\/categories\/.*?\//;
// var patbool = pattern.test(urlinfo);
// // console.log(patbool);
// // 获取当前的分类
// if (patbool) {
// var valuegroup = urlinfo.split("/");
// // console.log(valuegroup[2]);
// // 获取当前分类
// var nowCategorie = valuegroup[2];
// if (document.querySelector('#category-bar')) {
// document.getElementById(nowCategorie).classList.add("select");
// }
// }
// }
// },
// 页脚友链
addFriendLinksInFooter: function () {

View File

@ -779,10 +779,10 @@ document.addEventListener('load', function () {
heo.reflashEssayWaterFall()
heo.addMediumInEssay()
heo.darkModeStatus()
heo.categoriesBarActive()
// heo.categoriesBarActive()
heo.initThemeColor()
heo.hideLoading()
heo.tagPageActive()
// heo.tagPageActive()
})
window.onscroll = function () {
percent();

View File

@ -17,7 +17,7 @@
<a href="/">首页</a>
</div>
<div class="category-bar-item"
th:classappend="${category.metadata.name == categoryItem.metadata.name} ? 'select'"
th:classappend="${category.metadata.name == categoryItem.metadata.name} ? ' select'"
th:each="categoryItem : ${categoryFinder.listAll()}"
th:id="${categoryItem.spec.displayName}">
<a th:href="@{${categoryItem.status.permalink}}"

View File

@ -110,7 +110,7 @@
heo.reflashEssayWaterFall();
heo.addMediumInEssay();
heo.darkModeStatus();
heo.categoriesBarActive();
// heo.categoriesBarActive();
heo.initThemeColor();
</script>

View File

@ -13,9 +13,9 @@
th:utext="${theme.config.top.bannersTitleSmall}"></div>
</div>
<!-- 改成后台动态可配置-->
<!-- 后台可配置,未配置时使用默认值-->
<div class="tags-group-all">
<div class="tags-group-wrapper">
<div class="tags-group-wrapper" th:if="${#lists.isEmpty(theme.config.top.bannersIconPair)}">
<div class="tags-group-icon-pair">
<div class="tags-group-icon" style="background:#989bf8">
<img th:src="@{/assets/images/icons/AfterEffect.png}" title="AfterEffect">
@ -129,6 +129,18 @@
</div>
</div>
</div>
<div class="tags-group-wrapper"
th:if="${not #lists.isEmpty(theme.config.top.bannersIconPair)}"
th:with="iconPairs = ${theme.config.top.bannersIconPair}" >
<div class="tags-group-icon-pair" th:each="iconPair : ${iconPairs}">
<div class="tags-group-icon" th:style="'background:' + ${iconPair.top.background}">
<img th:src="@{${iconPair.top.url}}" th:title="${iconPair.top.name}">
</div>
<div class="tags-group-icon" th:style="'background:' + ${iconPair.bottom.background}">
<img th:src="@{${iconPair.bottom.url}}" th:title="${iconPair.bottom.name}">
</div>
</div>
</div>
</div>
<!-- 随机前往一篇文章 -->
<a id="banner-hover" onclick="randomPost()">

View File

@ -24,13 +24,13 @@
<!-- 今日推荐 -->
<div class="todayCard" id="todayCard"
th:if="${theme.config.top.todayRecommendSwitch}"
th:onclick="'window.open('+ ${theme.config.top.todayRecommendUrl} +')'">
th:onclick="'window.open('+ ${theme.config.top.todayRecommendContent.todayRecommendUrl} +')'">
<div class="todayCard-info">
<div class="todayCard-tips">今日推荐</div>
<div class="todayCard-title" th:text="${theme.config.top.todayRecommendTitle}"></div>
<div class="todayCard-title" th:text="${theme.config.top.todayRecommendContent.todayRecommendTitle}"></div>
</div>
<div class="todayCard-cover"
th:style="'background:url('+ ${theme.config.top.todayRecommendCover} +') no-repeat center/cover'">
th:style="'background:url('+ ${theme.config.top.todayRecommendContent.todayRecommendCover} +') no-repeat center/cover'">
</div>
<div class="banner-button-group">
<a class="banner-button" onclick="window.event.cancelBubble=!0;heo.hideTodayCard()">

View File

@ -11,11 +11,12 @@
<div id="tag">
<div id="tag-page-tags" th:with="tags = ${tagFinder.listAll()}">
<a style="font-size:1em;color:#3c228c"
th:each="tag : ${tags}"
th:href="@{${tag.status.permalink}}"
th:id="${tag.spec.displayName}">
<span class="tags-punctuation">#</span> [[${tag.spec.displayName}]]
<span class="tagsPageCount" th:text="${tag.status.postCount}"></span>
th:classappend="${tag.metadata.name == tagItem.metadata.name} ? 'select'"
th:each="tagItem : ${tags}"
th:href="@{${tagItem.status.permalink}}"
th:id="${tagItem.spec.displayName}">
<span class="tags-punctuation">#</span> [[${tagItem.spec.displayName}]]
<span class="tagsPageCount" th:text="${tagItem.status.postCount}"></span>
</a>
</div>
<div class="article-sort-title" th:text="${tag.spec.displayName}"></div>

View File

@ -13,5 +13,5 @@ spec:
repo: 'https://github.com/liuzhihang/halo-theme-hao'
settingName: "theme-hao-setting"
configMapName: "theme-hao-configMap"
version: beta.1
version: beta.2
require: 2.0.0