From caadf44d77f8bd941c7b4ae983d2df3da82d8fe2 Mon Sep 17 00:00:00 2001 From: j m <1406993111@qq.com> Date: Sat, 28 Dec 2024 13:09:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=94=AF=E6=8C=81=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E9=94=99=E8=AF=AF=E9=A1=B5=E9=A3=8E=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- settings.yaml | 30 ++ src/js/pjax.js | 2 + templates/assets/js/pjax.min.js | 2 +- templates/common/head.html | 2 +- templates/error/4xx/error_blue_screen.html | 149 +++++++ templates/error/4xx/error_concise.html | 138 +++++++ templates/error/4xx/error_train.html | 427 +++++++++++++++++++++ templates/error/4xx/error_tv_screen.html | 208 ++++++++++ templates/error/common/error_default.html | 29 ++ templates/error/error.html | 38 +- theme.yaml | 2 +- 11 files changed, 996 insertions(+), 31 deletions(-) create mode 100644 templates/error/4xx/error_blue_screen.html create mode 100644 templates/error/4xx/error_concise.html create mode 100644 templates/error/4xx/error_train.html create mode 100644 templates/error/4xx/error_tv_screen.html create mode 100644 templates/error/common/error_default.html diff --git a/settings.yaml b/settings.yaml index 5eb5edd..638f199 100644 --- a/settings.yaml +++ b/settings.yaml @@ -1338,6 +1338,36 @@ spec: label: 开启 - value: false label: 关闭 + - $formkit: group + name: error + label: 错误页面 + help: 配置错误页面风格。 + value: + style_4xx: 'error/common/error_default' + style_5xx: 'error/common/error_default' + children: + - $formkit: select + name: style_4xx + label: 4xx错误页面风格 + help: '发生4xx错误页面风格,如:404等。' + options: + - value: 'error/4xx/error_blue_screen' + label: 蓝屏代码 + - value: 'error/4xx/error_tv_screen' + label: 电视雪花屏幕 + - value: 'error/4xx/error_train' + label: 小火车 + - value: 'error/4xx/error_concise' + label: 简洁 + - value: 'error/common/error_default' + label: 默认 + - $formkit: select + name: style_5xx + label: 5xx错误页面风格 + help: '发生5xx错误页面风格,如:500等。' + options: + - value: 'error/common/error_default' + label: 默认 - $formkit: radio name: effects_lantern_mode id: effects_lantern_mode diff --git a/src/js/pjax.js b/src/js/pjax.js index b76d792..b924e3b 100644 --- a/src/js/pjax.js +++ b/src/js/pjax.js @@ -229,6 +229,8 @@ $(document).on('pjax:end', function (event, xhr, options) { commonContext.initTimeCount() /* 初始化任务列表,禁止点击 */ commonContext.iniTaskItemDisabled() + /** 关闭画廊 **/ + commonContext.closeFancybox() window.DProgress && DProgress.done() // 应该是由于浏览器缓存失效,有时候浏览器前后退还是会执行pjax:beforeSend $('html').removeClass('pjax-loading') diff --git a/templates/assets/js/pjax.min.js b/templates/assets/js/pjax.min.js index 6e425f7..ec1e316 100644 --- a/templates/assets/js/pjax.min.js +++ b/templates/assets/js/pjax.min.js @@ -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{c(o.filter("[defer]"),0)});let e=o.filter(":not([async]):not([defer])");0{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(),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})}})})(); \ No newline at end of file +(()=>{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{c(o.filter("[defer]"),0)});let e=o.filter(":not([async]):not([defer])");0{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})}})})(); \ No newline at end of file diff --git a/templates/common/head.html b/templates/common/head.html index 3eef265..fc43209 100644 --- a/templates/common/head.html +++ b/templates/common/head.html @@ -2,7 +2,7 @@ th:with="description=${isPost ? post != null ? post.status.excerpt : singlePage != null ? singlePage.status.excerpt : site.seo.description : site.seo.description}"> - + diff --git a/templates/error/4xx/error_blue_screen.html b/templates/error/4xx/error_blue_screen.html new file mode 100644 index 0000000..cfb85c5 --- /dev/null +++ b/templates/error/4xx/error_blue_screen.html @@ -0,0 +1,149 @@ + + + + + 404 + + + +
+

:(

+

你访问的网站页面出现问题,需要回到主页。

+

我们只收集错误页面访问原因,然后为你跳转主页。

+

0% 完成

+
+ QRCODE +
+

有关此问题的详细原因:

+
    +
      1. 该页面已被管理员删除;
    +
      2. 该页面已被管理员移动到其他位置;
    +
      3. 该页面链接填写错误。
    +
      +
    +
    +
    +
    + + + \ No newline at end of file diff --git a/templates/error/4xx/error_concise.html b/templates/error/4xx/error_concise.html new file mode 100644 index 0000000..c1fd0f0 --- /dev/null +++ b/templates/error/4xx/error_concise.html @@ -0,0 +1,138 @@ + + + + + + 404 Not Found + + + + +
    +
    🔍
    +

    404 Not Found

    +

    抱歉,您请求的页面不存在。

    +

    可能是输入的网址有误,或者该页面已被移动或删除。

    + 返回首页 +
    + + + + \ No newline at end of file diff --git a/templates/error/4xx/error_train.html b/templates/error/4xx/error_train.html new file mode 100644 index 0000000..56f4255 --- /dev/null +++ b/templates/error/4xx/error_train.html @@ -0,0 +1,427 @@ + + + + + + 404 Not Found + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 404 + + + Page not found. + + + + + + + + + + + + + + + + + + +
    +
    + + \ No newline at end of file diff --git a/templates/error/4xx/error_tv_screen.html b/templates/error/4xx/error_tv_screen.html new file mode 100644 index 0000000..1a68179 --- /dev/null +++ b/templates/error/4xx/error_tv_screen.html @@ -0,0 +1,208 @@ + + + + + + 404 Not Found + + + + + +

    404

    + +
    +
    +
    +
    +
    +
    + + + \ No newline at end of file diff --git a/templates/error/common/error_default.html b/templates/error/common/error_default.html new file mode 100644 index 0000000..ccbd973 --- /dev/null +++ b/templates/error/common/error_default.html @@ -0,0 +1,29 @@ + + + +
    +
    +
    +
    +
    +
    +
    + +

    找不到网页,可能已被删除,去首页看看吧。

    +

    围观群众太过热情,服务器繁忙,请稍后访问。

    +
    +
    +
    +
    + +
    +
    最新文章推荐
    +
    + + +
    +
    \ No newline at end of file diff --git a/templates/error/error.html b/templates/error/error.html index 2d6a6e3..7295a51 100644 --- a/templates/error/error.html +++ b/templates/error/error.html @@ -1,30 +1,12 @@ - - -
    -
    -
    -
    -
    -
    -
    - -

    找不到网页,可能已被删除,去首页看看吧。

    -

    围观群众太过热情,服务器繁忙,请稍后访问。

    -
    -
    [(${#strings.defaultString(error.title, 'Internal server error')} + ':
    -' + ${error.detail})]
    -
    -
    -
    - -
    -
    最新文章推荐
    -
    - - + + - \ No newline at end of file + + +
    + diff --git a/theme.yaml b/theme.yaml index 76f5615..edb27d2 100644 --- a/theme.yaml +++ b/theme.yaml @@ -30,7 +30,7 @@ spec: settingName: theme-dream2-plus-setting configMapName: theme-dream2-plus-configMap # 版本号 - version: 1.3.5 + version: 1.3.6.beta1 # 最低支持的 Halo 版本 require: ">=2.20.0" # 许可