Merge pull request #42 from zsjy/dev

Dev
This commit is contained in:
宏尘 2025-01-18 14:33:57 +08:00 committed by GitHub
commit a2a75619e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 59 additions and 47 deletions

View File

@ -379,7 +379,7 @@ spec:
name: top_thumbnail_mode name: top_thumbnail_mode
label: 置顶文章列表封面图模式 label: 置顶文章列表封面图模式
value: back value: back
help: '置顶的文章在列表的封面图模式,除网格布局外,如果文章元数据配置了thumbnail_mode项,则当前配置将被覆盖。注:设置网格布局后,非置顶文章也会变成网格布局。' help: '置顶的文章在列表的封面图模式,除网格布局外,如果文章元数据配置了“文章列表缩略图模式”项,则当前配置将被覆盖。注:设置网格布局后,非置顶文章也会变成网格布局。'
options: options:
- value: default - value: default
label: 默认模式 label: 默认模式
@ -399,7 +399,7 @@ spec:
name: thumbnail_mode name: thumbnail_mode
label: 文章列表封面图模式 label: 文章列表封面图模式
value: default value: default
help: '文章列表封面图模式,除网格布局外,如果文章元数据配置了thumbnail_mode项,则当前配置将被覆盖。' help: '文章列表封面图模式,除网格布局外,如果文章元数据配置了“文章列表缩略图模式”项,则当前配置将被覆盖。'
options: options:
- value: default - value: default
label: 默认模式 label: 默认模式
@ -581,7 +581,7 @@ spec:
name: enable_katex name: enable_katex
label: KaTeX 公式支持 label: KaTeX 公式支持
value: false value: false
help: '博客通过 KaTeX 做数学公式渲染,如果文章或页面元数据配置了enable_katex项,则当前配置将被覆盖。' help: '博客通过 KaTeX 做数学公式渲染,如果文章或页面元数据配置了“KaTeX 公式支持”项,则当前配置将被覆盖。'
options: options:
- value: true - value: true
label: 默认开启 label: 默认开启
@ -591,7 +591,7 @@ spec:
name: enable_copyright name: enable_copyright
label: 开启文章版权声明 label: 开启文章版权声明
value: true value: true
help: '如果文章或页面元数据配置了enable_copyright项,则当前配置将被覆盖。' help: '如果文章或页面元数据配置了“开启文章版权声明”项,则当前配置将被覆盖。'
options: options:
- value: true - value: true
label: 默认开启 label: 默认开启
@ -601,7 +601,7 @@ spec:
name: enable_post_share name: enable_post_share
label: 开启文章分享 label: 开启文章分享
value: true value: true
help: '如果文章或页面元数据配置了enable_share项,则当前配置将被覆盖。' help: '如果文章或页面元数据配置了“开启文章分享”项,则当前配置将被覆盖。'
options: options:
- value: true - value: true
label: 默认开启 label: 默认开启
@ -657,7 +657,7 @@ spec:
name: enable_post_donate name: enable_post_donate
label: 开启文章打赏 label: 开启文章打赏
value: true value: true
help: '如果文章或页面元数据配置了enable_donate项,则当前配置将被覆盖。' help: '如果文章或页面元数据配置了“开启文章打赏”项,则当前配置将被覆盖。'
options: options:
- value: true - value: true
label: 默认开启 label: 默认开启
@ -771,6 +771,26 @@ spec:
label: 侧边栏内容 label: 侧边栏内容
placeholder: 请输入 HTML 内容 placeholder: 请输入 HTML 内容
help: '非必填,仅在侧边栏类型为公告、广告、自定义时生效。' help: '非必填,仅在侧边栏类型为公告、广告、自定义时生效。'
- $formkit: select
name: show_ad_tag
if: $value.type === 'ad_piece'
label: 侧边栏广告-显示“广告”标签
value: true
options:
- value: true
label: 显示
- value: false
label: 不显示
- $formkit: select
name: ad_tag_close
if: $value.type === 'ad_piece'
label: 侧边栏广告-点击“广告”标签可关闭广告
value: true
options:
- value: true
label:
- value: false
label:
- $formkit: radio - $formkit: radio
name: enable_color_character name: enable_color_character
label: 侧边栏信息-开启彩字切换 label: 侧边栏信息-开启彩字切换
@ -940,26 +960,6 @@ spec:
type="playlist" type="playlist"
id="7355014621" id="7355014621"
help: '输入音乐参数配置(id / server / type必填)详细配置方式见官方文档https://github.com/metowolf/MetingJS/' help: '输入音乐参数配置(id / server / type必填)详细配置方式见官方文档https://github.com/metowolf/MetingJS/'
- $formkit: radio
name: show_ad_tag
label: 侧边栏广告-显示“广告”标签
help: '控制所有“广告模块”的显示广告标签功能。'
value: true
options:
- value: true
label: 显示
- value: false
label: 不显示
- $formkit: radio
name: ad_tag_close
label: 侧边栏广告-点击“广告”标签可关闭广告
help: '控制所有“广告模块”的关闭广告功能。'
value: true
options:
- value: true
label:
- value: false
label:
- $formkit: number - $formkit: number
name: recent_posts_num name: recent_posts_num
label: 侧边栏最近文章-展示文章数量 label: 侧边栏最近文章-展示文章数量
@ -1328,7 +1328,7 @@ spec:
help: '填入可用的 NPM 公共开源 CDN 地址(一行一个),通过 “{CDN 地址}/{项目名}@{版本号}/${文件路径}” 可访问到文件https://unpkg.com/halo-theme-dream2-plus@1.3.6/templates/assets/js/utils.min.js' help: '填入可用的 NPM 公共开源 CDN 地址(一行一个),通过 “{CDN 地址}/{项目名}@{版本号}/${文件路径}” 可访问到文件https://unpkg.com/halo-theme-dream2-plus@1.3.6/templates/assets/js/utils.min.js'
value: |- value: |-
https://unpkg.com https://unpkg.com
https://cdn.jsdelivr.net/npm https://cdn.onmicrosoft.cn
https://npm.elemecdn.com https://npm.elemecdn.com
- $formkit: radio - $formkit: radio
name: enable_pjax name: enable_pjax

View File

@ -3722,6 +3722,13 @@ button.swiper-pagination-bullet {
overflow: hidden; overflow: hidden;
font-size: 0.95em; font-size: 0.95em;
thead {
th {
font-weight: 500;
background: var(--bg-z);
}
}
td, td,
th { th {
padding: 8px; padding: 8px;

View File

@ -196,6 +196,8 @@ $(document).on('pjax:error', function (event, xhr, textStatus, error, options) {
$(document).on('pjax:complete', function (event, xhr, textStatus, options) { $(document).on('pjax:complete', function (event, xhr, textStatus, options) {
console.log(`pjax:complete sn = ${options.serialNumber}`) console.log(`pjax:complete sn = ${options.serialNumber}`)
//启用全局评论
if (DreamConfig.site_comment) {
// 获取当前页面的标题、路径和 URL // 获取当前页面的标题、路径和 URL
const currentTitle = document.title const currentTitle = document.title
const currentPath = window.location.pathname const currentPath = window.location.pathname
@ -204,11 +206,12 @@ $(document).on('pjax:complete', function (event, xhr, textStatus, options) {
if (window.history && window.history.replaceState) { if (window.history && window.history.replaceState) {
// 更新历史记录状态 // 更新历史记录状态
window.history.replaceState( window.history.replaceState(
{ url: currentUrl, title: currentTitle, path: currentPath }, {url: currentUrl, title: currentTitle, path: currentPath},
currentTitle, currentTitle,
currentUrl currentUrl
) )
} }
}
}) })
/** /**
@ -244,7 +247,8 @@ $(document).on('pjax:popstate', function (event) {
// 监听 popstate 事件 // 监听 popstate 事件
window.addEventListener('popstate', function (event) { window.addEventListener('popstate', function (event) {
console.log('popstate event triggered') console.log('popstate event triggered')
if (event.state) { //启用全局评论时
if (DreamConfig.site_comment && event.state) {
// console.log('State:', event.state) // console.log('State:', event.state)
const currentUrl = window.location.href const currentUrl = window.location.href

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
(()=>{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(),commonContext.closeFancybox(),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(),commonContext.closeFancybox(),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})}})})(); (()=>{const s=new Set($('link[href*=".css"]').map((o,e)=>$(e).attr("href")).get()),c=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,l=(e,n,t)=>{if(n>=e.length)t&&t();else{let o=$(e[n]).attr("src");c.has(o)?l(e,n+1,t):(console.log((t?"同步":"异步")+"顺序加载js "+o),Utils.cachedScript(o).done(function(){console.log((t?"同步":"异步")+"顺序加载js完成 "+o),c.add(o),window.DProgress&&DProgress.inc(),l(e,n+1,t)}).fail(function(){console.log((t?"同步":"异步")+"顺序加载js失败 "+o),l(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");c.has(o)||(console.log("异步无序加载js "+o),Utils.cachedScript(o).done(function(){console.log("异步无序js完成 "+o),window.DProgress&&DProgress.inc(),c.add(o)}).fail(function(){console.log("异步无序js失败 "+o)}))}),new Promise(()=>{l(o.filter("[defer]"),0)});let e=o.filter(":not([async]):not([defer])");0<e.length&&await new Promise(o=>{l(e,0,o)})}console.log("全部处理完成"),window.pjaxSerialNumber===a&&(window.journalPjax&&window.journalPjax(a),window.postPjax&&window.postPjax(a),commonContext.initTimeCount(),commonContext.iniTaskItemDisabled(),commonContext.initCarousel(),commonContext.closeFancybox(),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){if(console.log("pjax:complete sn = "+t.serialNumber),DreamConfig.site_comment){const o=document.title,e=window.location.pathname,n=window.location.href;window.history&&window.history.replaceState&&window.history.replaceState({url:n,title:o,path:e},o,n)}}),$(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(),commonContext.closeFancybox(),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"),DreamConfig.site_comment&&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

@ -114,6 +114,7 @@
DreamConfig["security_link_url"] = [[${theme.config.security_link_config.security_link_url}]]; DreamConfig["security_link_url"] = [[${theme.config.security_link_config.security_link_url}]];
DreamConfig["theme_version"] = [[${theme.spec.version}]]; DreamConfig["theme_version"] = [[${theme.spec.version}]];
DreamConfig["site_comment"] = [[${site.comment.enable}]];
DreamConfig["theme_base"] = "[(${#theme.assets('/')})]"; DreamConfig["theme_base"] = "[(${#theme.assets('/')})]";
[(${!#strings.isEmpty(theme.config.post.code_fold_line)?'DreamConfig["code_fold_line"] = "' + theme.config.post.code_fold_line + '";': ''})] [(${!#strings.isEmpty(theme.config.post.code_fold_line)?'DreamConfig["code_fold_line"] = "' + theme.config.post.code_fold_line + '";': ''})]
[(${!#strings.isEmpty(theme.config.basic_info.document_hidden_title)?'DreamConfig["document_hidden_title"] = "' + #strings.escapeJavaScript(theme.config.basic_info.document_hidden_title) + '";': ''})] [(${!#strings.isEmpty(theme.config.basic_info.document_hidden_title)?'DreamConfig["document_hidden_title"] = "' + #strings.escapeJavaScript(theme.config.basic_info.document_hidden_title) + '";': ''})]

View File

@ -110,10 +110,10 @@
<a href="/console" target="_blank"><i th:if="${!#strings.isEmpty(theme.config.basic_style.logon.console_manage_class)}" th:class="${theme.config.basic_style.logon.console_manage_class}"></i> 后台管理</a> <a href="/console" target="_blank"><i th:if="${!#strings.isEmpty(theme.config.basic_style.logon.console_manage_class)}" th:class="${theme.config.basic_style.logon.console_manage_class}"></i> 后台管理</a>
</li> </li>
<li th:if="${!#strings.isEmpty(logonUserName)}" class="navbar-logon-group-menu"> <li th:if="${!#strings.isEmpty(logonUserName)}" class="navbar-logon-group-menu">
<a href="/logout"><i th:if="${!#strings.isEmpty(theme.config.basic_style.logon.console_logout_class)}" th:class="${theme.config.basic_style.logon.console_logout_class}"></i> 退出登录</a> <a href="/logout" data-not-pjax><i th:if="${!#strings.isEmpty(theme.config.basic_style.logon.console_logout_class)}" th:class="${theme.config.basic_style.logon.console_logout_class}"></i> 退出登录</a>
</li> </li>
<li th:if="${#strings.isEmpty(logonUserName)}" class="navbar-logon-group-menu"> <li th:if="${#strings.isEmpty(logonUserName)}" class="navbar-logon-group-menu">
<a href="/login" onclick="this.href = '/login?redirect_uri=' + encodeURIComponent(window.location.href)"><i th:if="${!#strings.isEmpty(theme.config.basic_style.logon.console_login_class)}" th:class="${theme.config.basic_style.logon.console_login_class}"></i> 登录</a> <a href="/login" data-not-pjax onclick="this.href = '/login?redirect_uri=' + encodeURIComponent(window.location.href)"><i th:if="${!#strings.isEmpty(theme.config.basic_style.logon.console_login_class)}" th:class="${theme.config.basic_style.logon.console_login_class}"></i> 登录</a>
</li> </li>
</ul> </ul>
</div> </div>

View File

@ -402,7 +402,7 @@
<text transform="translate(377.037 230.025)" class="st8 st10" font-size="21"> <text transform="translate(377.037 230.025)" class="st8 st10" font-size="21">
500 500
</text> </text>
<text transform="translate(659.5 213.994)" class="st8 st10" font-size="24.025"> <text transform="translate(620.5 213.994)" class="st8 st10" font-size="24.025">
Internal server error. Internal server error.
</text> </text>
</g> </g>

View File

@ -2,8 +2,8 @@
th:fragment="widget (sidebar)" th:fragment="widget (sidebar)"
th:class="'card widget ' + ${sidebar.hide}"> th:class="'card widget ' + ${sidebar.hide}">
<th:block th:utext="${sidebar.content}"/> <th:block th:utext="${sidebar.content}"/>
<span th:if="${theme.config.sidebar.show_ad_tag}" class="ad-tag">广告 <span th:if="${sidebar.show_ad_tag}" class="ad-tag">广告
<svg th:if="${theme.config.sidebar.ad_tag_close}" class="click-close" data-close=".widget" <svg th:if="${sidebar.ad_tag_close}" class="click-close" data-close=".widget"
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15"><path xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15"><path
d="M3.25,3.25l8.5,8.5M11.75,3.25l-8.5,8.5"></path></svg> d="M3.25,3.25l8.5,8.5M11.75,3.25l-8.5,8.5"></path></svg>
</span> </span>

View File

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