Merge pull request #21 from zsjy/dev

Dev
This commit is contained in:
mjking 2024-06-14 19:25:29 +08:00 committed by GitHub
commit abd055aae5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 70 additions and 31 deletions

View File

@ -990,11 +990,6 @@ spec:
- group: page_config
label: '页面设置'
formSchema:
- $formkit: text
name: links_title
label: 友链页面-标题
placeholder: '请输入友链页面的标题名称'
help: '填写友链页面的标题名称,留空时显示“友链”。'
- $formkit: attachment
name: links_thumbnail
label: 友链页面-封面图
@ -1032,18 +1027,24 @@ spec:
help: '友链页面最低部的补充说明信息,支持 HTML 格式。'
- $formkit: radio
name: link_enable_comment
id: link_enable_comment
label: 友链页面-开启评论区
help: '当链接插件版本>=1.4.0时将内置评论区ID。为保留历史评论数据可选择“开启并自定义评论区ID”选项。'
value: true
options:
- value: true
label: 开启
- value: custom
label: 开启并自定义评论区ID
- value: false
label: 关闭
- $formkit: singlePageSelect
name: link_comment_id
if: $get(link_enable_comment).value == 'custom'
label: 友链页面-评论区ID
validation: required
placeholder: '请选择一个页面作为友链页面的评论区ID'
help: '友链页面没有 ID需要指定一个自定义页面的 ID 用于评论,被指定的页面评论区将作为友链的评论区,未选择时则友链界面不显示评论区。'
help: '指定一个“自定义页面”用于友链页面的评论区ID被指定的页面评论区将作为友链的评论区。'
- $formkit: radio
name: enable_tags_tag_color
label: 标签页面-开启标签颜色

View File

@ -3454,6 +3454,23 @@ button.swiper-pagination-bullet {
line-height: 2.5rem;
}
div.columns {
margin: 0 0 14px 0;
& > .column {
border: 1px solid var(--light-b);
border-radius: var(--radius-wrap);
& :not(:last-child) {
margin-bottom: 4px !important;
}
& :last-child {
margin-bottom: 0 !important;
}
}
}
blockquote {
line-height: 1.7em;
margin-bottom: 14px;

View File

@ -88,7 +88,7 @@ const observers = []
function register($toc) {
// toc滚动时间和偏移量
const time = 20
const headingsOffset = 50
const headingsOffset = 75
const currentInView = new Set()
const headingToMenu = new Map()
const $menus = Array.from($toc.querySelectorAll('.menu-list > li > a'))

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -1 +1 @@
(()=>{function s(t,e){this.tocList=t,this.elementList=function t(e,n){if(null==e)return null;var i=e.children;if(0===i.length)return null;for(var s=[],o=0;o<i.length;o++){var l=i[o];-1!==n.indexOf(l.tagName)&&s.push(l),s.push.apply(s,t(l,n))}return s}(e,this.tocList),this.eIndex=0,this.build=function(){return null==this.elementList||0===this.elementList.length?"":this.analysis(-1,this.tocList.indexOf(this.elementList[this.eIndex].tagName))},this.analysis=function(t,e){for(var n="<ul class='menu-list'>";this.eIndex<this.elementList.length;){var i=this.elementList[this.eIndex],s=this.tocList.indexOf(i.tagName);if(t<s&&s<=e){e=s;var o=i.id,l=i.innerText;if(null!=o&&""!==o||(o=l+"_"+this.eIndex,i.setAttribute("id",o)),n+=`<li><a data-id="#${o}"><i class="ri-attachment-2"></i>${l}</a>`,this.eIndex++,this.eIndex>=this.elementList.length){n+="</li>";break}(s=this.tocList.indexOf(this.elementList[this.eIndex].tagName))>e&&(n+=this.analysis(e,s)),n+="</li>"}else if(s<=t)break}return n+"</ul>"}}const r=[];function t(t){const i=new Set,s=new Map,o=Array.from(t.querySelectorAll(".menu-list > li > a"));for(const t of o){const r=t.getAttribute("data-id").trim().slice(1),i=document.getElementById(r);i&&s.set(i,t)}const l=Array.from(s.keys()),e=new IntersectionObserver(e=>{for(const n of e)n.isIntersecting?i.add(n.target):i.delete(n.target);let n;if(i.size?n=[...i].sort((t,e)=>t.offsetTop-e.offsetTop)[0]:l.length&&(n=l.filter(t=>t.offsetTop<window.scrollY).sort((t,e)=>e.offsetTop-t.offsetTop)[0]),n&&s.has(n)){o.forEach(t=>t.classList.remove("is-active"));const e=s.get(n);e.classList.add("is-active");let t=e.parentElement.parentElement;for(;t.classList.contains("menu-list")&&"li"===t.parentElement.tagName.toLowerCase();)t.parentElement.children[0].classList.add("is-active"),t=t.parentElement.parentElement}},{threshold:0});for(const t of l){if(e.observe(t),s.has(t)){const r=s.get(t);r.addEventListener("click",()=>{let n,t=document.getElementById(r.getAttribute("data-id").substring(1)).getBoundingClientRect(),i=window.pageYOffset,s=i+t.top-50,o=(s-i)/20,l=i>s?-1:1;window.requestAnimationFrame(function t(e){(i+=o)*l<s*l?(window.scrollTo(0,i),n=window.requestAnimationFrame(t)):(window.scrollTo(0,s),window.cancelAnimationFrame(n))})})}s.has(t)&&(t.style.scrollMargin="1em")}r.push(e)}s.init=function(t){var e=t.tocList,n=t.contentElement,t=t.tocElement;if(null==e||0===e.length||null==n)return $(t).children().remove(),!1;for(var i=0;i<e.length;i++)e[i]=e[i].toUpperCase();n=new s(e,n).build();$(t).html(n)},window.tocPjax=function(){r.forEach(t=>{t.disconnect()}),r.splice(0),s.init({tocList:["h1","h2","h3","h4","h5","h6"],contentElement:$(".main-content:not(.not-toc)")[0],tocElement:".toc-content"}),void 0!==window.IntersectionObserver&&document.querySelectorAll(".toc-content").forEach(t)}})();
(()=>{function s(t,e){this.tocList=t,this.elementList=function t(e,n){if(null==e)return null;var i=e.children;if(0===i.length)return null;for(var s=[],o=0;o<i.length;o++){var l=i[o];-1!==n.indexOf(l.tagName)&&s.push(l),s.push.apply(s,t(l,n))}return s}(e,this.tocList),this.eIndex=0,this.build=function(){return null==this.elementList||0===this.elementList.length?"":this.analysis(-1,this.tocList.indexOf(this.elementList[this.eIndex].tagName))},this.analysis=function(t,e){for(var n="<ul class='menu-list'>";this.eIndex<this.elementList.length;){var i=this.elementList[this.eIndex],s=this.tocList.indexOf(i.tagName);if(t<s&&s<=e){e=s;var o=i.id,l=i.innerText;if(null!=o&&""!==o||(o=l+"_"+this.eIndex,i.setAttribute("id",o)),n+=`<li><a data-id="#${o}"><i class="ri-attachment-2"></i>${l}</a>`,this.eIndex++,this.eIndex>=this.elementList.length){n+="</li>";break}(s=this.tocList.indexOf(this.elementList[this.eIndex].tagName))>e&&(n+=this.analysis(e,s)),n+="</li>"}else if(s<=t)break}return n+"</ul>"}}const r=[];function t(t){const i=new Set,s=new Map,o=Array.from(t.querySelectorAll(".menu-list > li > a"));for(const t of o){const r=t.getAttribute("data-id").trim().slice(1),i=document.getElementById(r);i&&s.set(i,t)}const l=Array.from(s.keys()),e=new IntersectionObserver(e=>{for(const n of e)n.isIntersecting?i.add(n.target):i.delete(n.target);let n;if(i.size?n=[...i].sort((t,e)=>t.offsetTop-e.offsetTop)[0]:l.length&&(n=l.filter(t=>t.offsetTop<window.scrollY).sort((t,e)=>e.offsetTop-t.offsetTop)[0]),n&&s.has(n)){o.forEach(t=>t.classList.remove("is-active"));const e=s.get(n);e.classList.add("is-active");let t=e.parentElement.parentElement;for(;t.classList.contains("menu-list")&&"li"===t.parentElement.tagName.toLowerCase();)t.parentElement.children[0].classList.add("is-active"),t=t.parentElement.parentElement}},{threshold:0});for(const t of l){if(e.observe(t),s.has(t)){const r=s.get(t);r.addEventListener("click",()=>{let n,t=document.getElementById(r.getAttribute("data-id").substring(1)).getBoundingClientRect(),i=window.pageYOffset,s=i+t.top-75,o=(s-i)/20,l=i>s?-1:1;window.requestAnimationFrame(function t(e){(i+=o)*l<s*l?(window.scrollTo(0,i),n=window.requestAnimationFrame(t)):(window.scrollTo(0,s),window.cancelAnimationFrame(n))})})}s.has(t)&&(t.style.scrollMargin="1em")}r.push(e)}s.init=function(t){var e=t.tocList,n=t.contentElement,t=t.tocElement;if(null==e||0===e.length||null==n)return $(t).children().remove(),!1;for(var i=0;i<e.length;i++)e[i]=e[i].toUpperCase();n=new s(e,n).build();$(t).html(n)},window.tocPjax=function(){r.forEach(t=>{t.disconnect()}),r.splice(0),s.init({tocList:["h1","h2","h3","h4","h5","h6"],contentElement:$(".main-content:not(.not-toc)")[0],tocElement:".toc-content"}),void 0!==window.IntersectionObserver&&document.querySelectorAll(".toc-content").forEach(t)}})();

View File

@ -15,10 +15,11 @@
<span id="webCopyright" th:text="'&copy; '+${#dates.format(#dates.createNow(), 'yyyy')}+' '"></span><a class="record"
th:href="${site.url}" rel="noopener noreferrer nofollow"
th:text="${site.title}"></a><span th:unless="${theme.config.basic_info.footer_hide_theme_info}" class="footer-truncation">Powered by <span class="footer-copyright"><a class="powered footer-copyright-halo" href="https://halo.run/" target="_blank">Halo</a> & <a class="powered" href="https://github.com/zsjy/halo-theme-dream2.0-plus" target="_blank">Dream2.0 Plus</a></span></span></p>
<p class="icon-spot" th:if="${!#strings.isEmpty(theme.config.basic_info.record_number_ps) || !#strings.isEmpty(theme.config.basic_info.record_number)}"><a
th:if="${!#strings.isEmpty(theme.config.basic_info.record_number)}" class="record"
href="http://beian.miit.gov.cn/publish/query/indexFirst.action" target="_blank" rel="noopener noreferrer nofollow"
th:text="${theme.config.basic_info.record_number}"></a><a th:if="${!#strings.isEmpty(theme.config.basic_info.record_number_ps)}" class="record footer-truncation" th:href="'https://beian.mps.gov.cn/#/query/webSearch?code=' + ${theme.config.basic_info.record_number_ps.replaceAll('[^\d]', '')}" target="_blank" rel="noopener noreferrer nofollow"><img
<p class="icon-spot" th:if="${!#strings.isEmpty(theme.config.basic_info.record_number_ps) || !#strings.isEmpty(theme.config.basic_info.record_number)}">
<a th:if="${!#strings.isEmpty(theme.config.basic_info.record_number)}" class="record"
href="http://beian.miit.gov.cn/publish/query/indexFirst.action" target="_blank" rel="noopener noreferrer nofollow"><img
th:src="${#theme.assets('/img/ba.webp')}" height="auto" width="auto" alt="备案" style="vertical-align: text-top; width: 1.2em; margin-right: 4px;"/>[[${theme.config.basic_info.record_number}]]</a>
<a th:if="${!#strings.isEmpty(theme.config.basic_info.record_number_ps)}" class="record footer-truncation" th:href="'https://beian.mps.gov.cn/#/query/webSearch?code=' + ${theme.config.basic_info.record_number_ps.replaceAll('[^\d]', '')}" target="_blank" rel="noopener noreferrer nofollow"><img
th:src="${#theme.assets('/img/ga.webp')}" height="auto" width="auto" alt="公网安备" style="vertical-align: text-top; width: 1.2em; margin-right: 4px;"/>[[${theme.config.basic_info.record_number_ps}]]</a></p>
<p class="icon-spot" th:if="${!#strings.isEmpty(theme.config.basic_info.website_time) || theme.config.enhance.enable_busuanzi == true}">
<span th:if="${!#strings.isEmpty(theme.config.basic_info.website_time)}" id="websiteDate">建站<span class="stand">00</span><span class="stand">0</span><span class="stand">0</span><span class="stand">0</span></span>

View File

@ -1,14 +1,14 @@
<!DOCTYPE html>
<th:block xmlns:th="https://www.thymeleaf.org"
th:insert="~{common/layout :: layout (title = ${#strings.defaultString(theme.config.page_config.links_title, '友链')} + ' - ' + ${site.title}, canonical = @{/links}, content = ~{::content}, isPost = false)}"
th:with="baseEnableComment = ${!#strings.isEmpty(theme.config.page_config.link_comment_id) && theme.config.page_config.link_enable_comment}">
th:insert="~{common/layout :: layout (title = ${#strings.defaultString(linksTitle, '友链')} + ' - ' + ${site.title}, canonical = @{/links}, content = ~{::content}, isPost = false)}"
th:with="baseEnableComment = ${theme.config.page_config.link_enable_comment == true || (!#strings.isEmpty(theme.config.page_config.link_comment_id) && theme.config.page_config.link_enable_comment == 'custom')}">
<th:block th:fragment="content"
th:with="defaultAvatar = ${#strings.defaultString(theme.config.page_config.links_default_avatar, #theme.assets('/img/avatar.svg'))}">
<div class="card">
<div th:if="${!#strings.isEmpty(theme.config.page_config.links_thumbnail)}" class="card-image cover-image" th:style="'background-image: url(' + ${theme.config.page_config.links_thumbnail} + ')'">
</div>
<div class="card-content main">
<h1 class="title" th:text="${#strings.defaultString(theme.config.page_config.links_title, '友链')} + ' - ' + ${contributor.displayName} + '的小伙伴们'"></h1>
<h1 class="title" th:text="${#strings.defaultString(linksTitle, '友链')} + ' - ' + ${contributor.displayName} + '的小伙伴们'"></h1>
<div class="main-content">
<th:block th:each="group : ${groups}">
<div th:if="${!#lists.isEmpty(group.links)}" class="links">
@ -50,6 +50,7 @@
<div class="card card-content comment-wrapper-z-index" id="comment-wrapper" th:if="${enableComment}">
<h3 class="comment-title">评论</h3>
<th:block th:if="${theme.config.enhance.enable_pjax}">
<th:block th:if="${theme.config.page_config.link_enable_comment == 'custom'}">
<comment-widget
group="content.halo.run"
kind="SinglePage"
@ -58,13 +59,32 @@
with-replies="false"
></comment-widget>
</th:block>
<th:block th:if="${theme.config.page_config.link_enable_comment != 'custom'}">
<comment-widget
group="plugin.halo.run"
kind="Plugin"
version="v1alpha1"
th:name="${pluginName}"
with-replies="false"
></comment-widget>
</th:block>
</th:block>
<th:block th:unless="${theme.config.enhance.enable_pjax}">
<th:block th:if="${theme.config.page_config.link_enable_comment == 'custom'}">
<halo:comment
group="content.halo.run"
kind="SinglePage"
th:attr="name=${theme.config.page_config.link_comment_id}"
/>
</th:block>
<th:block th:if="${theme.config.page_config.link_enable_comment != 'custom'}">
<halo:comment
group="plugin.halo.run"
kind="Plugin"
th:attr="name=${pluginName}"
/>
</th:block>
</th:block>
</div>
</th:block>
</th:block>

View File

@ -30,9 +30,9 @@ spec:
settingName: theme-dream2-plus-setting
configMapName: theme-dream2-plus-configMap
# 版本号
version: 0.0.0.6
version: 0.0.0.17
# 最低支持的 Halo 版本
require: ">=2.12.0"
require: ">=2.15.0"
# 许可
license:
- name: "MIT"

View File

@ -1 +1 @@
1.2.4
1.2.4.2