Merge pull request #39 from zsjy/dev

1.3.4
This commit is contained in:
宏尘 2024-12-25 20:45:53 +08:00 committed by GitHub
commit 16611fce54
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
29 changed files with 338 additions and 226 deletions

8
package-lock.json generated
View File

@ -11,7 +11,7 @@
"dependencies": {
"html2canvas": "^1.4.1",
"qrcode": "^1.5.1",
"remixicon": "^4.5.0"
"remixicon": "^4.6.0"
},
"devDependencies": {
"@babel/core": "^7.15.5",
@ -7377,9 +7377,9 @@
}
},
"node_modules/remixicon": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/remixicon/-/remixicon-4.5.0.tgz",
"integrity": "sha512-IP/wNQGG3JCigaeFF3DERSTqMIZBlNu1yu8clNGB7wFe7ZN/ueKMplFHL5uEbnGpCzqfY6MlxIYn2vRzub+5cQ=="
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/remixicon/-/remixicon-4.6.0.tgz",
"integrity": "sha512-bKM5odjqE1yzVxEZGJE7F79WHhNrJFIKHXR+GG+P1IWXn8AnJZhl8SbIRDJsNAvIqx4VPkNwjuHfc42tutMDpQ=="
},
"node_modules/remove-bom-buffer": {
"version": "3.0.0",

View File

@ -54,6 +54,6 @@
"dependencies": {
"html2canvas": "^1.4.1",
"qrcode": "^1.5.1",
"remixicon": "^4.5.0"
"remixicon": "^4.6.0"
}
}

View File

@ -85,16 +85,6 @@ spec:
value: false
- label: 居中
value: true
- $formkit: radio
name: footer_hide_theme_info
label: 页脚主题信息
value: false
help: 控制页脚主题信息“Powered by Halo & Dream”的显示或隐藏。
options:
- label: 显示
value: false
- label: 隐藏
value: true
- group: basic_style
label: '基础样式'
formSchema:
@ -118,7 +108,7 @@ spec:
value:
console_post_class: 'ri-book-read-line'
console_moment_class: 'ri-camera-lens-line'
console_login_class: 'ri-login-circle-line'
console_login_class: 'ri-fingerprint-line'
console_person_class: 'ri-account-circle-line'
console_manage_class: 'ri-settings-3-line'
console_logout_class: 'ri-logout-circle-line'
@ -609,7 +599,6 @@ spec:
label: 默认关闭
- $formkit: radio
name: enable_post_share
id: enable_post_share
label: 开启文章分享
value: true
help: '如果文章或页面元数据配置了enable_share项则当前配置将被覆盖。'
@ -620,7 +609,6 @@ spec:
label: 默认关闭
- $formkit: repeater
name: custom_post_share
if: $get(enable_post_share).value
max: 11
min: 1
label: 文章分享方式
@ -1196,66 +1184,49 @@ spec:
label: 搜索页面
help: 使用新版搜索需要 halo >= 2.17.0 & 搜索插件 >= 1.5.0。
value:
search_enable: false
search_title: '搜索'
search_placeholder: '输入搜索内容'
search_btn_title: '搜索'
search_style: 'box'
search_target: '_self'
children:
- $formkit: radio
id: search_enable
name: search_enable
id: search_style
name: search_style
label: 搜索按钮-搜索风格
help: '仅PC客户端有效其余客户端均显示为经典。'
options:
- value: true
label: 新版
- value: false
- value: 'box'
label: 热门文章
- value: 'form'
label: 搜索表单
- value: 'basic'
label: 经典
- $formkit: text
if: $get(search_enable).value
name: search_title
validation: required
label: 搜索页面-标题
placeholder: '输入新版搜索页面标题'
- $formkit: text
if: $get(search_enable).value
name: search_placeholder
validation: required
label: 搜索页面-输入框提示语
placeholder: '输入新版搜索页面输入框提示语'
- $formkit: text
if: $get(search_enable).value
name: search_btn_title
validation: required
placeholder: '输入新版搜索页面搜索按钮提示语'
label: 搜索页面-搜索按钮提示语
- $formkit: radio
if: $get(search_enable).value
if: $get(search_style).value != 'basic'
name: search_target
validation: required
label: 搜索页面-搜索结果跳转方式
help: '搜索页面-搜索结果跳转方式,搜索表单、热门文章风格有效。'
options:
- value: _blank
label: 新标签页
- value: _self
label: 当前窗口
- $formkit: code
if: $get(search_enable).value
if: $get(search_style).value != 'basic'
name: search_empty_tips
validation: required
label: "搜索页面-无搜索结果提示语"
language: html
value: '没有搜索结果'
height: 45px
help: '搜索页面-无搜索结果提示语,支持 HTML 格式。'
help: '搜索页面-无搜索结果提示语,支持 HTML 格式,搜索表单、热门文章风格有效。'
- $formkit: number
if: $get(search_enable).value
if: $get(search_style).value != 'basic'
name: search_limit
validation: required
label: "搜索页面-搜索结果最大显示数量"
value: 10
height: 45px
help: '搜索页面-搜索结果最大显示数量。'
help: '搜索页面-搜索结果最大显示数量,搜索表单、热门文章风格有效。'
- group: enhance
label: '增强功能'
formSchema:
@ -1367,16 +1338,6 @@ spec:
label: 开启
- value: false
label: 关闭
- $formkit: radio
name: enable_comment_type
label: 评论加载方式
value: true
help: '在使用Halo评论组件时建议您关闭Pjax加载功能以获得最佳体验。同时Halo评论组件支持评论插件的新特性。而对于Web评论组件它支持Pjax加载但请注意部分新特性可能不被Web评论组件所支持。'
options:
- value: true
label: Halo评论组件
- value: false
label: Web评论组件
- $formkit: radio
name: effects_lantern_mode
id: effects_lantern_mode
@ -1493,10 +1454,6 @@ spec:
- $formkit: group
name: busuanzi_group
label: busuanzi 访客统计
value:
enable_gray_mode: false
gray_mode_start_time:
gray_mode_end_time:
children:
- $formkit: radio
name: enable_busuanzi
@ -1511,19 +1468,6 @@ spec:
label: 隐藏
- value: false
label: 关闭
- $formkit: radio
name: busuanzi_pv_use_halo
if: $get(enable_busuanzi).value === true
label: busuanzi 的访问次数显示模式
help: '可以择优选择统计次数的显示。'
value: busuanzi
options:
- value: halo
label: Halo统计
- value: busuanzi
label: busuanzi统计
- value: false
label: 不显示
- $formkit: radio
name: enable_console_version_info
label: 控制台打印版本信息

View File

@ -796,7 +796,7 @@ table td, table th {
&.fixed {
position: sticky;
top: 0;
z-index: 99;
z-index: 100;
}
&-above {
@ -5320,7 +5320,7 @@ button.swiper-pagination-bullet {
/* 搜索界面 */
.search-page {
margin-top: 1.4rem !important;
margin-bottom: 1.4rem;
.search-form-inner {
width: 100%;
@ -5392,8 +5392,10 @@ button.swiper-pagination-bullet {
}
}
.search-page-title {
margin-top: 0 !important;
#dream-search-result {
.search-page:last-child {
margin-bottom: 0 !important;
}
}
//登录组件

View File

@ -120,6 +120,17 @@ const commonContext = {
// 高亮移动端
$nav_side_menus.eq(activeIndex).addClass('current')
},
/* 搜索框弹窗 */
searchDialog() {
const $result = $('.navbar-search .result')
$('.navbar-search .input').on('click', function (e) {
e.stopPropagation()
$result.addClass('active')
})
$(document).on('click', function () {
$result.removeClass('active')
})
},
/* 激活导航栏全局下拉框功能 */
initDropMenu() {
$('.item-dropdown').each(function (index, item) {

View File

@ -193,6 +193,20 @@ $(document).on('pjax:error', function (event, xhr, textStatus, error, options) {
// pjax结束
$(document).on('pjax:complete', function (event, xhr, textStatus, options) {
console.log(`pjax:complete sn = ${options.serialNumber}`)
// 获取当前页面的标题、路径和 URL
const currentTitle = document.title
const currentPath = window.location.pathname
const currentUrl = window.location.href
if (window.history && window.history.replaceState) {
// 更新历史记录状态
window.history.replaceState(
{ url: currentUrl, title: currentTitle, path: currentPath },
currentTitle,
currentUrl
)
}
})
/**
@ -222,3 +236,21 @@ $(document).on('pjax:end', function (event, xhr, options) {
$(document).on('pjax:popstate', function (event) {
console.log('pjax:popstate')
})
// 监听 popstate 事件
window.addEventListener('popstate', function (event) {
console.log('popstate event triggered')
if (event.state) {
// console.log('State:', event.state)
const currentUrl = window.location.href
$.pjax.reload('.column-main', {
container: '.column-main', // 指定要重新加载的内容容器,默认为 document.body
push: false,
url: currentUrl,
fragment: '.column-main', // 加载的文本中被选中的目标内容
serialNumber: createSerialNumber(), // 创建序列号
timeout: 8000, // 设置超时时间(毫秒)
})
}
})

View File

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 +1 @@
(()=>{const i=new Set($('link[href*=".css"]').map((o,e)=>$(e).attr("href")).get()),l=new Set($('script[src*=".js"]').map((o,e)=>$(e).attr("src")).get()),e=()=>{var o=(new Date).getTime();return window.pjaxSerialNumber=o,console.log("sn = "+o),o},n=o=>"/"!==o.pathname&&0!==$(".banner").length?(window.initTop=99999999,window.innerHeight/4):0,c=(e,n,t)=>{if(n>=e.length)t&&t();else{let o=$(e[n]).attr("src");l.has(o)?c(e,n+1,t):(console.log((t?"同步":"异步")+"顺序加载js "+o),Utils.cachedScript(o).done(function(){console.log((t?"同步":"异步")+"顺序加载js完成 "+o),l.add(o),window.DProgress&&DProgress.inc(),c(e,n+1,t)}).fail(function(){console.log((t?"同步":"异步")+"顺序加载js失败 "+o),c(e,n+1,t)}))}};$(document).on("click","a[target!=_blank][href]:not([data-not-pjax])",o=>{$.pjax.click(o,".column-main",{scrollTo:n(o.currentTarget),fragment:".column-main",serialNumber:e(),timeout:8e3})}),$(document).on("submit","form[data-pjax]",function(o){$.pjax.submit(o,".column-main",{scrollTo:n(o.currentTarget),fragment:".column-main",serialNumber:e(),timeout:8e3})}),$(document).on("pjax:click",function(o,e){console.log("------------------------"),console.log("pjax:click sn = "+e.serialNumber)}),$(document).on("pjax:beforeSend",function(o,e,n){console.log("pjax:beforeSend sn = "+n.serialNumber),$("html").addClass("pjax-loading")}),$(document).on("pjax:start",function(o,e,n){console.log("pjax:start sn = "+n.serialNumber),window.DProgress&&DProgress.start(),$(".pjax-close").remove()}),$(document).on("pjax:send",function(o,e,n){console.log("pjax:send sn = "+n.serialNumber)}),$(document).on("pjax:clicked",function(o,e){console.log("pjax:clicked sn = "+e.serialNumber)}),$(document).on("pjax:beforeReplace",function(o,e,n){console.log("pjax:beforeReplace sn = "+n.serialNumber),$(".navbar-nav .current,.panel-side-menu .current").removeClass("current"),commonContext.initNavbar(),0<$("html.disable-scroll").length&&$(".navbar-mask").trigger("click")}),$(document).on("pjax:success",async function(o,e,n,t,a){a=a.serialNumber;if(console.log("pjax:success sn = "+a),window.pjaxSerialNumber===a){commonContext.initGallery(),commonContext.initTocAndNotice(),$("html").removeClass("pjax-loading");const s=$($.parseHTML(e,document,!0)),r=$("head");r.find("meta").remove(),r.find('link[rel="canonical"]').remove(),r.append(s.filter("meta")),r.append(s.filter('link[rel="canonical"]')),s.filter("link[data-pjax]").each(function(){let o=$(this).attr("href");i.has(o)||(r.append($(this)),console.log("加载css "+$(this).attr("href")),this.onload=function(){i.add(o),window.DProgress&&DProgress.inc(),console.log("加载css完成 "+$(this).attr("href"))})});let o=s.filter("script[data-pjax]");if(0<o.length){o.filter("[async]").each(function(){let o=$(this).attr("src");l.has(o)||(console.log("异步无序加载js "+o),Utils.cachedScript(o).done(function(){console.log("异步无序js完成 "+o),window.DProgress&&DProgress.inc(),l.add(o)}).fail(function(){console.log("异步无序js失败 "+o)}))}),new Promise(()=>{c(o.filter("[defer]"),0)});let e=o.filter(":not([async]):not([defer])");0<e.length&&await new Promise(o=>{c(e,0,o)})}console.log("全部处理完成"),window.pjaxSerialNumber===a&&(window.journalPjax&&window.journalPjax(a),window.postPjax&&window.postPjax(a),commonContext.initTimeCount(),commonContext.iniTaskItemDisabled(),commonContext.initCarousel(),window.DProgress)&&DProgress.done()}}),$(document).on("pjax:timeout",function(o,e,n){console.log("pjax:timeout sn = "+n.serialNumber)}),$(document).on("pjax:error",function(o,e,n,t,a){console.log(`pjax:error sn = ${a.serialNumber} error `+t)}),$(document).on("pjax:complete",function(o,e,n,t){console.log("pjax:complete sn = "+t.serialNumber)}),$(document).on("pjax:end",function(o,e,n){console.log("pjax:end sn = "+n.serialNumber),null==e&&(commonContext.initTocAndNotice(),commonContext.initCarousel(),commonContext.initTimeCount(),commonContext.iniTaskItemDisabled(),window.DProgress&&DProgress.done(),$("html").removeClass("pjax-loading"))}),$(document).on("pjax:popstate",function(o){console.log("pjax:popstate")})})();
(()=>{const s=new Set($('link[href*=".css"]').map((o,e)=>$(e).attr("href")).get()),l=new Set($('script[src*=".js"]').map((o,e)=>$(e).attr("src")).get()),e=()=>{var o=(new Date).getTime();return window.pjaxSerialNumber=o,console.log("sn = "+o),o},n=o=>"/"!==o.pathname&&0!==$(".banner").length?(window.initTop=99999999,window.innerHeight/4):0,c=(e,n,t)=>{if(n>=e.length)t&&t();else{let o=$(e[n]).attr("src");l.has(o)?c(e,n+1,t):(console.log((t?"同步":"异步")+"顺序加载js "+o),Utils.cachedScript(o).done(function(){console.log((t?"同步":"异步")+"顺序加载js完成 "+o),l.add(o),window.DProgress&&DProgress.inc(),c(e,n+1,t)}).fail(function(){console.log((t?"同步":"异步")+"顺序加载js失败 "+o),c(e,n+1,t)}))}};$(document).on("click","a[target!=_blank][href]:not([data-not-pjax])",o=>{$.pjax.click(o,".column-main",{scrollTo:n(o.currentTarget),fragment:".column-main",serialNumber:e(),timeout:8e3})}),$(document).on("submit","form[data-pjax]",function(o){$.pjax.submit(o,".column-main",{scrollTo:n(o.currentTarget),fragment:".column-main",serialNumber:e(),timeout:8e3})}),$(document).on("pjax:click",function(o,e){console.log("------------------------"),console.log("pjax:click sn = "+e.serialNumber)}),$(document).on("pjax:beforeSend",function(o,e,n){console.log("pjax:beforeSend sn = "+n.serialNumber),$("html").addClass("pjax-loading")}),$(document).on("pjax:start",function(o,e,n){console.log("pjax:start sn = "+n.serialNumber),window.DProgress&&DProgress.start(),$(".pjax-close").remove()}),$(document).on("pjax:send",function(o,e,n){console.log("pjax:send sn = "+n.serialNumber)}),$(document).on("pjax:clicked",function(o,e){console.log("pjax:clicked sn = "+e.serialNumber)}),$(document).on("pjax:beforeReplace",function(o,e,n){console.log("pjax:beforeReplace sn = "+n.serialNumber),$(".navbar-nav .current,.panel-side-menu .current").removeClass("current"),commonContext.initNavbar(),0<$("html.disable-scroll").length&&$(".navbar-mask").trigger("click")}),$(document).on("pjax:success",async function(o,e,n,t,a){a=a.serialNumber;if(console.log("pjax:success sn = "+a),window.pjaxSerialNumber===a){commonContext.initGallery(),commonContext.initTocAndNotice(),$("html").removeClass("pjax-loading");const i=$($.parseHTML(e,document,!0)),r=$("head");r.find("meta").remove(),r.find('link[rel="canonical"]').remove(),r.append(i.filter("meta")),r.append(i.filter('link[rel="canonical"]')),i.filter("link[data-pjax]").each(function(){let o=$(this).attr("href");s.has(o)||(r.append($(this)),console.log("加载css "+$(this).attr("href")),this.onload=function(){s.add(o),window.DProgress&&DProgress.inc(),console.log("加载css完成 "+$(this).attr("href"))})});let o=i.filter("script[data-pjax]");if(0<o.length){o.filter("[async]").each(function(){let o=$(this).attr("src");l.has(o)||(console.log("异步无序加载js "+o),Utils.cachedScript(o).done(function(){console.log("异步无序js完成 "+o),window.DProgress&&DProgress.inc(),l.add(o)}).fail(function(){console.log("异步无序js失败 "+o)}))}),new Promise(()=>{c(o.filter("[defer]"),0)});let e=o.filter(":not([async]):not([defer])");0<e.length&&await new Promise(o=>{c(e,0,o)})}console.log("全部处理完成"),window.pjaxSerialNumber===a&&(window.journalPjax&&window.journalPjax(a),window.postPjax&&window.postPjax(a),commonContext.initTimeCount(),commonContext.iniTaskItemDisabled(),commonContext.initCarousel(),window.DProgress)&&DProgress.done()}}),$(document).on("pjax:timeout",function(o,e,n){console.log("pjax:timeout sn = "+n.serialNumber)}),$(document).on("pjax:error",function(o,e,n,t,a){console.log(`pjax:error sn = ${a.serialNumber} error `+t)}),$(document).on("pjax:complete",function(o,e,n,t){console.log("pjax:complete sn = "+t.serialNumber);var t=document.title,a=window.location.pathname,i=window.location.href;window.history&&window.history.replaceState&&window.history.replaceState({url:i,title:t,path:a},t,i)}),$(document).on("pjax:end",function(o,e,n){console.log("pjax:end sn = "+n.serialNumber),null==e&&(commonContext.initTocAndNotice(),commonContext.initCarousel(),commonContext.initTimeCount(),commonContext.iniTaskItemDisabled(),window.DProgress&&DProgress.done(),$("html").removeClass("pjax-loading"))}),$(document).on("pjax:popstate",function(o){console.log("pjax:popstate")}),window.addEventListener("popstate",function(o){if(console.log("popstate event triggered"),o.state){const o=window.location.href;$.pjax.reload(".column-main",{container:".column-main",push:!1,url:o,fragment:".column-main",serialNumber:e(),timeout:8e3})}})})();

View File

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

Before

Width:  |  Height:  |  Size: 2.6 MiB

After

Width:  |  Height:  |  Size: 2.6 MiB

Binary file not shown.

Binary file not shown.

View File

@ -14,7 +14,7 @@
<p class="icon-spot">
<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>
th:text="${site.title}"></a><span 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"><img
@ -28,8 +28,8 @@
<span id="busuanzi_container_site_uv" style="display: none">
<i class="ri-account-circle-line" aria-hidden="true"></i><span class="stand" id="busuanzi_value_site_uv">0</span>访客
</span>
<span th:unless="${theme.config.enhance.busuanzi_group.busuanzi_pv_use_halo == false}" id="busuanzi_container_site_pv" style="display: none">
<i class="ri-pie-chart-line" aria-hidden="true"></i><span class="stand" th:id="${theme.config.enhance.busuanzi_group.busuanzi_pv_use_halo == 'busuanzi' ? 'busuanzi_value_site_pv' : 'halo_value_site_pv'}">[[${stats.visit}]]</span>访问
<span id="busuanzi_container_site_pv" style="display: none">
<i class="ri-pie-chart-line" aria-hidden="true"></i><span class="stand" id="busuanzi_value_site_pv">0</span>访问
</span>
</span>
</p>

View File

@ -25,7 +25,7 @@ th:with="description=${isPost ? post != null ? post.status.excerpt : singlePage
<link rel="canonical" th:href="${#strings.isEmpty(canonical) ? '' : #strings.startsWith(canonical,'http') ? canonical : (#strings.endsWith(canonical,'/') ? #strings.substringBefore(site.url, '/') : site.url + canonical)}"/>
<link rel="preload stylesheet" as="style" th:href="@{/assets/css/theme.min.css(mew=${theme.spec.version})}">
<link rel="preload stylesheet" as="style" th:href="@{/assets/lib/remixicon@4.5.0/remixicon.min.css}">
<link rel="preload stylesheet" as="style" th:href="@{/assets/lib/remixicon@4.6.0/remixicon.min.css}">
<link rel="preload stylesheet" as="style" th:href="@{/assets/css/style.min.css(mew=${theme.spec.version})}">
<link th:if="${theme.config.basic_style.theme_style == 'celebration'}" rel="preload stylesheet" as="style" th:href="@{/assets/css/celebration.min.css(mew=${theme.spec.version})}">

View File

@ -65,11 +65,24 @@
</th:block>
</nav>
<div th:if="${pluginFinder.available('PluginSearchWidget')}" class="navbar-search">
<button th:unless="${theme.config.page_config.search.search_enable}" onclick="javascript:SearchWidget.open();" class="submit" aria-label="搜索按钮" style="border-radius: 17px;"><i class="ri-search-line"></i></button>
<a th:if="${theme.config.page_config.search.search_enable}" target="_self" href="/search" class="submit" aria-label="搜索按钮" style="border-radius: 17px;display: flex;align-items: center;justify-content: center;"><i class="ri-search-line"></i></a>
<button th:if="${theme.config.page_config.search.search_style == 'basic'}" onclick="javascript:SearchWidget.open();" class="submit" aria-label="搜索按钮" style="border-radius: 17px;"><i class="ri-search-line"></i></button>
<a th:if="${theme.config.page_config.search.search_style == 'form'}" target="_self" href="/search" class="submit" aria-label="搜索按钮" style="border-radius: 17px;display: flex;align-items: center;justify-content: center;"><i class="ri-search-line"></i></a>
<form data-pjax class="navbar-search" method="get" action="/search" th:if="${theme.config.page_config.search.search_style == 'box'}">
<input autocomplete="off" placeholder="搜索内容..." name="keyword" value="" class="input" type="text"/>
<input type="hidden" name="limit" th:value="${theme.config.page_config.search.search_limit}"/>
<button type="submit" class="submit" title="搜索" aria-label="搜索按钮"><i class="ri-search-line"></i></button>
<span class="icon"></span>
<nav class="result" th:with="searchPosts = ${postFinder.list({page: 1,size: 5,sort: {'stats.visit,desc'}})}">
<a th:each="postData,pIndex : ${searchPosts}" th:href="@{${postData.status.permalink}}"
th:title="${postData.spec.title}" th:target="${theme.config.page_config.search.search_target}"
class="item">
<span class="sort">[[${pIndex.count}]]</span>
<span class="text">[[${postData.spec.title}]]</span>
</a>
</nav>
</form>
</div>
<i th:unless="${theme.config.page_config.search.search_enable}" class="ri-search-line navbar-searchicon" onclick="javascript:SearchWidget.open();"></i>
<a th:if="${theme.config.page_config.search.search_enable}" class="navbar-searchicon" target="_self" href="/search"><i class="ri-search-line navbar-searchicon"></i></a>
<i class="ri-search-line navbar-searchicon" onclick="javascript:SearchWidget.open();"></i>
<a data-not-pjax th:if="${theme.config.basic_style.show_console == 'console'}" class="navbar-console" th:href="${!#strings.isEmpty(logonUserName) ? theme.config.basic_style.console.console_logon_url : theme.config.basic_style.console.console_url}"
th:target="${!#strings.isEmpty(logonUserName) ? theme.config.basic_style.console.console_logon_target : theme.config.basic_style.console.console_target}"
th:title="${theme.config.basic_style.console.console_title}">

View File

@ -49,41 +49,19 @@
</div>
<div class="card card-content comment-wrapper-z-index" id="comment-wrapper" th:if="${enableComment}">
<h3 class="comment-title">评论</h3>
<th:block th:unless="${theme.config.enhance.enable_comment_type}">
<th:block th:if="${theme.config.page_config.link_enable_comment == 'custom'}">
<comment-widget
group="content.halo.run"
kind="SinglePage"
version="v1alpha1"
th:name="${theme.config.page_config.link_comment_id}"
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: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.enhance.enable_comment_type}">
<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 th:if="${theme.config.page_config.link_enable_comment != 'custom'}">
<halo:comment
group="plugin.halo.run"
kind="Plugin"
th:attr="name=${pluginName}"
/>
</th:block>
</div>
</th:block>

View File

@ -98,21 +98,10 @@
<div class="card card-content comment-wrapper-z-index" id="comment-wrapper" th:if="${enableComment}">
<h3 class="comment-title">评论</h3>
<th:block th:unless="${theme.config.enhance.enable_comment_type}">
<comment-widget
group="content.halo.run"
th:kind="${type}"
version="v1alpha1"
th:name="${post.metadata.name}"
with-replies="false"
></comment-widget>
</th:block>
<th:block th:if="${theme.config.enhance.enable_comment_type}">
<halo:comment
group="content.halo.run"
th:kind="${type}"
th:attr="name=${post.metadata.name}"
/>
</th:block>
<halo:comment
group="content.halo.run"
th:kind="${type}"
th:attr="name=${post.metadata.name}"
/>
</div>
</th:block>

View File

@ -57,22 +57,11 @@
</div>
</div>
<div class="journal-comment comment-wrapper-z-index" th:if="${enableComment}">
<th:block th:unless="${theme.config.enhance.enable_comment_type}">
<comment-widget
group="moment.halo.run"
kind="Moment"
version="v1alpha1"
th:name="${moment.metadata.name}"
with-replies="false"
></comment-widget>
</th:block>
<th:block th:if="${theme.config.enhance.enable_comment_type}">
<halo:comment
group="moment.halo.run"
kind="Moment"
th:attr="name=${moment.metadata.name}"
/>
</th:block>
<halo:comment
group="moment.halo.run"
kind="Moment"
th:attr="name=${moment.metadata.name}"
/>
</div>
</div>

View File

@ -68,22 +68,11 @@
</div>
</div>
<div class="journal-comment comment-wrapper-z-index" th:if="${enableComment}">
<th:block th:unless="${theme.config.enhance.enable_comment_type}">
<comment-widget
group="moment.halo.run"
kind="Moment"
version="v1alpha1"
th:name="${moment.metadata.name}"
with-replies="false"
></comment-widget>
</th:block>
<th:block th:if="${theme.config.enhance.enable_comment_type}">
<halo:comment
group="moment.halo.run"
kind="Moment"
th:attr="name=${moment.metadata.name}"
/>
</th:block>
<halo:comment
group="moment.halo.run"
kind="Moment"
th:attr="name=${moment.metadata.name}"
/>
</div>
</div>
<th:block th:replace="~{main/pagination :: pagination (${moments}, '/moments')}"/>

View File

@ -1,10 +1,11 @@
<!DOCTYPE html>
<th:block
th:insert="~{common/layout :: layout (title = ${theme.config.page_config.search.search_title} + ' - ' + ${site.title}, canonical = @{/search}, content = ~{::content}, isPost = true)}"
th:insert="~{common/layout :: layout (title = '搜索' + ' - ' + ${site.title}, canonical = @{/search}, content = ~{::content}, isPost = true)}"
th:with="isJournals = true, enableShare = false, baseEnableComment = false"
xmlns:th="https://www.thymeleaf.org">
<th:block th:fragment="content">
<div class="card card-content search-page search-page-title">
<div class="card card-content search-page"
th:if="${theme.config.page_config.search.search_style == 'form'}">
<div class="card-tab">
<div>[[${#strings.replace(title, ' - ' + site.title, '')}]]</div>
</div>
@ -123,17 +124,67 @@
class="text-input"
type="search"
name="keyword"
th:title="${theme.config.page_config.search.search_placeholder}"
th:placeholder="${theme.config.page_config.search.search_placeholder}"
placeholder="搜索内容..."
th:value="${searchResult.keyword}"
/>
<button class="search-form-btn" th:title="${theme.config.page_config.search.search_btn_title}"
<button class="search-form-btn" title="搜索"
type="submit">
<i class="ri-search-line"></i>
</button>
</form>
</div>
</div>
<div th:if="${theme.config.page_config.search.search_style == 'box'}">
<script th:inline="javascript">
$(function () {
var target = [[${theme.config.page_config.search.search_target}]]
var searchResult = $('#dream-search-result')
var searchResultEmpty = $('#dream-search-result-empty')
function removeHTMLTags(str) {
const regex = /<(?!\/?B\b)[^>]*>/g
return str.replace(regex, '')
}
function findResult() {
var result = [[${searchResult}]]
if (result.hits.length > 0) {
searchResultEmpty.hide()
searchResult.empty()
for (var i = 0; i < result.hits.length; i++) {
try {
var hit = result.hits[i]
var title = removeHTMLTags(hit.title)
var description = hit.content ? removeHTMLTags(hit.content) : ''
searchResult.append('<div class="widget card search-page">\n' +
'<div class="card-content main">\n' +
'<a href="' + hit.permalink + '" ' + ' target="' + target + '">\n' +
'<h2 class="title">' + title + '</h2>\n' +
'</a>\n' +
(description ?
('<div class="main-content not-toc description">\n' + description +
'\n</div>\n') : '') +
'<hr/>\n' +
'<div class="meta">\n' +
'<div></div>\n' +
'<em>' + '最后更新于 ' + Utils.formatDate(hit.updateTimestamp, 'yyyy年MM月dd日') + '</em>\n' +
'</div>\n' +
'</div>\n')
// eslint-disable-next-line no-empty
} catch (e) {
}
}
} else {
searchResultEmpty.show()
searchResult.empty()
}
}
findResult()
})
</script>
</div>
<div id="dream-search-result">
</div>
<div id="dream-search-result-empty" class="widget card search-page">

View File

@ -30,7 +30,7 @@ spec:
settingName: theme-dream2-plus-setting
configMapName: theme-dream2-plus-configMap
# 版本号
version: 1.3.3
version: 1.3.4
# 最低支持的 Halo 版本
require: ">=2.20.0"
# 许可