Skip to content

Commit

Permalink
Merge pull request #9 from liuzhihang/dev
Browse files Browse the repository at this point in the history
自定义首页欢迎弹窗
  • Loading branch information
liuzhihang authored Nov 13, 2022
2 parents cdda2f1 + 88b1bdb commit 6a1abc9
Show file tree
Hide file tree
Showing 14 changed files with 147 additions and 50 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
- [x] 文章阅读模式
- [X] [文章目录](https://github.com/liuzhihang/plugin-tocbot)(插件)
- [X] [代码高亮/语言/复制](https://github.com/liuzhihang/plugin-prismjs)(插件)
- [ ] 文章搜索
- [x] [文章搜索](https://github.com/halo-sigs/plugin-search-widget)
- [x] 显示字数统计
- [x] 显示相关文章
- [x] 文章过期提醒
Expand Down
45 changes: 41 additions & 4 deletions settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,11 @@ spec:
label: ICP 备案
placeholder: 请输入 ICP 备案号
help: "京ICP备xxxxxxxx号"
- $formkit: url
name: copyrightAgreement
label: 版权协议
placeholder: "请输入版权协议地址"
help: '文章模块声明版权,也会使用此协议'
- group: post
label: 文章
formSchema:
Expand All @@ -209,15 +214,47 @@ spec:
- label: 关闭
value: false
help: "文章底部显示版权声明模块"
- $formkit: url
name: copyrightAgreement
label: 版权协议
placeholder: "请输入版权协议地址"
- $formkit: textarea
name: copyrightInfo
label: 版权声明
placeholder: '本文是原创文章,采用 <a target="_blank" href="/cc">CC BY-NC-ND 4.0</a> 协议,完整转载请注明来自 <a href="/" target="_blank" >程序员小航</a>'
help: "版权声明内容,支持填入 HTML 标签"
- group: snackbar
label: 弹窗
help: 右下角 snackbar 弹窗
formSchema:
- $formkit: radio
name: switch
label: 开关(WIP)
value: true
options:
- label: 打开
value: true
- label: 关闭
value: false
- $formkit: radio
name: introduction
label: 介绍框(WIP)
value: true
options:
- label: 打开
value: true
- label: 关闭
value: false
- $formkit: text
name: introductionTitle
label: 介绍框标题
value: '欢迎使用主题 Hao'
- $formkit: text
name: introductionTip
label: 介绍框内容
value: '⭐️ Star halo-theme-hao,提交主题建议或意见。'
- $formkit: url
name: introductionUrl
validation: "url"
value: "https://github.com/liuzhihang/halo-theme-hao"
label: 介绍框点击跳转地址
placeholder: 请输入跳转 url
- group: rightMenu
label: 右键菜单
formSchema:
Expand Down
6 changes: 3 additions & 3 deletions templates/assets/js/heo.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ var heo = {
if (scrollTop != 0) {
document.getElementById("page-header").classList.add("nav-fixed");
document.getElementById("page-header").classList.add("nav-visible");
$('#cookies-window').hide()
$('#introduction-window').hide()
console.log("已添加class")
}
},
Expand Down Expand Up @@ -301,9 +301,9 @@ var heo = {
//隐藏cookie窗口
hidecookie: function () {
heo_cookiesTime = setTimeout(() => {
document.getElementById("cookies-window").classList.add('cw-hide');
document.getElementById("introduction-window").classList.add('cw-hide');
setTimeout(() => {
$('#cookies-window').hide()
$('#introduction-window').hide()
}, 1000)
}, 3000)
},
Expand Down
2 changes: 1 addition & 1 deletion templates/assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ document.addEventListener('DOMContentLoaded', function () {
let isChatShow = true
const $header = document.getElementById('page-header')
const $gulitop = document.getElementById('guli_top')
const $cookies_window = document.getElementById('cookies-window')
const $cookies_window = document.getElementById('introduction-window')
const isChatBtnHide = typeof chatBtnHide === 'function'
const isChatBtnShow = typeof chatBtnShow === 'function'
window.addEventListener('scroll', btf.throttle(function (e) {
Expand Down
26 changes: 23 additions & 3 deletions templates/assets/libs/iconfont/iconfont.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@font-face {
font-family: "iconfont"; /* Project id 3736806 */
src: url('iconfont.woff2?t=1668096101462') format('woff2'),
url('iconfont.woff?t=1668096101462') format('woff'),
url('iconfont.ttf?t=1668096101462') format('truetype');
src: url('iconfont.woff2?t=1668315437111') format('woff2'),
url('iconfont.woff?t=1668315437111') format('woff'),
url('iconfont.ttf?t=1668315437111') format('truetype');
}

.iconfont {
Expand All @@ -13,6 +13,26 @@
-moz-osx-font-smoothing: grayscale;
}

.icon-by:before {
content: "\e601";
}

.icon-cc:before {
content: "\e602";
}

.icon-nc:before {
content: "\e603";
}

.icon-nd:before {
content: "\e604";
}

.icon-HAO:before {
content: "\e60e";
}

.icon-logo-hao-pro:before {
content: "\f290";
}
Expand Down
2 changes: 1 addition & 1 deletion templates/assets/libs/iconfont/iconfont.js

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions templates/assets/libs/iconfont/iconfont.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,41 @@
"css_prefix_text": "icon-",
"description": "",
"glyphs": [
{
"icon_id": "12095053",
"name": "by",
"font_class": "by",
"unicode": "e601",
"unicode_decimal": 58881
},
{
"icon_id": "12095056",
"name": "cc",
"font_class": "cc",
"unicode": "e602",
"unicode_decimal": 58882
},
{
"icon_id": "12095063",
"name": "nc",
"font_class": "nc",
"unicode": "e603",
"unicode_decimal": 58883
},
{
"icon_id": "12095066",
"name": "nd",
"font_class": "nd",
"unicode": "e604",
"unicode_decimal": 58884
},
{
"icon_id": "32816778",
"name": "HAO",
"font_class": "HAO",
"unicode": "e60e",
"unicode_decimal": 58894
},
{
"icon_id": "32796142",
"name": "logo-hao-copy",
Expand Down
Binary file modified templates/assets/libs/iconfont/iconfont.ttf
Binary file not shown.
Binary file modified templates/assets/libs/iconfont/iconfont.woff
Binary file not shown.
Binary file modified templates/assets/libs/iconfont/iconfont.woff2
Binary file not shown.
12 changes: 6 additions & 6 deletions templates/assets/zhheo/zhheoblog.css
Original file line number Diff line number Diff line change
Expand Up @@ -7955,7 +7955,7 @@ span.fund_name {
}

/* cookies */
#cookies-window {
#introduction-window {
min-width: 300px;
background: var(--heo-maskbgdeep);
color: var(--heo-fontcolor);
Expand All @@ -7975,20 +7975,20 @@ span.fund_name {
animation: barrageIn 0.6s cubic-bezier(0.42, 0, 0.3, 1.11);
}

#cookies-window.cw-hide {
#introduction-window.cw-hide {
opacity: 0;
animation: barrageOut 0.6s cubic-bezier(0.42, 0, 0.3, 1.11);
z-index: -1;
}

#cookies-window .cookies-window-title {
#introduction-window .introduction-window-title {
padding-bottom: 4px;
border-bottom: var(--style-border);
font-size: 12px;
font-weight: bold;
}

#cookies-window .cookies-window-content {
#introduction-window .introduction-window-content {
font-size: 14px;
display: flex;
justify-content: space-around;
Expand All @@ -8000,13 +8000,13 @@ span.fund_name {
font-weight: bold;
}

.cookies-link {
.introduction-link {
margin-left: auto;
font-size: 16px;
}

@media screen and (max-width: 1300px) {
#cookies-window {
#introduction-window {
display: none;
}
}
Expand Down
29 changes: 17 additions & 12 deletions templates/modules/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,33 @@ <h3 class="footer-title" th:text="${menuItem.status.displayName}"></h3>
</div>
</div>
<div class="footer-banner-right">
<a class="footer-banner-link" href="/rss">订阅</a>
<!-- 订阅 需要 RSS 插件支持 -->
<!--<a class="footer-banner-link" href="/rss">订阅</a>-->
<a class="footer-banner-link" href="https://github.com/liuzhihang/halo-theme-hao">主题</a>
<a class="footer-banner-link" href="/about">关于</a>
<a class="footer-banner-link" href="https://beian.miit.gov.cn/#/Integrated/index"
rel="noopener external nofollow noreferrer noopener" target="_blank">[[${theme.config.footer.icp}]]
</a>
<a class="footer-banner-link cc" href="/cc" title="cc协议">
<i class="iconfont icon-occ"></i>
<i class="iconfont icon-occ-by"></i>
<i class="iconfont icon-onc"></i>
<i class="iconfont icon-ond"></i>
<a class="footer-banner-link cc"
th:href="${theme.config.footer.copyrightAgreement}"
th:if="${not #strings.isEmpty(theme.config.post.copyrightAgreement)}"
title="cc协议">
<i class="iconfont icon-cc"></i>
<i class="iconfont icon-by"></i>
<i class="iconfont icon-nc"></i>
<i class="iconfont icon-nd"></i>
</a>
</div>
</div>
</div>
<!-- 暂时不需要弹窗 -->
<div id="cookies-window">
<div class="cookies-window-title">协议提醒助手</div>
<div class="cookies-window-content">
<span class="cookies-tip">查看本站为你的个人隐私做出的努力</span>
<a class="cookies-link" href="privacy/index.html" title="本站如何保护你的隐私">
<i class="fas fa-arrow-circle-right"></i>
<div id="introduction-window">
<div class="introduction-window-title" th:text="${theme.config.snackbar.introductionTitle}"></div>
<div class="introduction-window-content">
<span class="introduction-tip" th:text="${theme.config.snackbar.introductionTip}"></span>
<a class="introduction-link" target="_blank" title="点击查看"
th:href="@{${theme.config.snackbar.introductionUrl}}">
<i class="iconfont icon-arrow-circle-right"></i>
</a>
</div>
</div>
Expand Down
36 changes: 18 additions & 18 deletions templates/modules/widgets/nav-right.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@
<!-- 功能都需要添加开关 -->

<!-- 随机友链 -->
<div class="nav-button only-home" id="travellings_button">
<a class="site-page" href="javascript:void(0);" rel="external nofollow"
title="友链">
<i class="iconfont icon-bus" style="font-size:1rem"></i>
</a>
</div>

<div class="nav-button">
<a class="site-page" href="javascript:void(0);" title="随机文章">
<i class="iconfont icon-shuffle" style="font-size:1rem"></i>
</a>
</div>
<!--<div class="nav-button only-home" id="travellings_button">-->
<!-- <a class="site-page" href="javascript:void(0);" rel="external nofollow"-->
<!-- title="友链">-->
<!-- <i class="iconfont icon-bus" style="font-size:1rem"></i>-->
<!-- </a>-->
<!--</div>-->

<!--<div class="nav-button">-->
<!-- <a class="site-page" href="javascript:void(0);" title="随机文章">-->
<!-- <i class="iconfont icon-shuffle" style="font-size:1rem"></i>-->
<!-- </a>-->
<!--</div>-->

<!-- 搜索使用搜索插件 -->
<div class="nav-button" id="search-button" th:if="${pluginFinder.available('PluginSearchWidget')}">
Expand All @@ -28,12 +28,12 @@
</div>

<!-- 控制台 -->
<div class="nav-button">
<a class="console_switchbutton" href="javascript:void(0);" onclick="heo.showConsole()" rel="external nofollow"
title="控制台">
<i class="iconfont icon-a-theconsole-fill" style="font-size:1rem"></i>
</a>
</div>
<!--<div class="nav-button">-->
<!-- <a class="console_switchbutton" href="javascript:void(0);" onclick="heo.showConsole()" rel="external nofollow"-->
<!-- title="控制台">-->
<!-- <i class="iconfont icon-a-theconsole-fill" style="font-size:1rem"></i>-->
<!-- </a>-->
<!--</div>-->

<div class="nav-button" id="nav-totop" onclick="btf.scrollToDest(0,500)">
<a class="totopbtn">
Expand Down
2 changes: 1 addition & 1 deletion theme.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ spec:
repo: 'https://github.com/liuzhihang/halo-theme-hao'
settingName: "theme-hao-setting"
configMapName: "theme-hao-configMap"
version: alpha.4
version: alpha.5
require: 2.0.0

0 comments on commit 6a1abc9

Please sign in to comment.