From 2b53592adc0683a5cee6fb8367730b0953771f58 Mon Sep 17 00:00:00 2001 From: Vaica <94612053+zqlit@users.noreply.github.com> Date: Tue, 2 Jun 2026 15:49:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E6=98=BC=E5=A4=9C=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E7=9A=84=E5=8A=A8=E7=94=BB=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hugo.toml | 2 +- themes/Ying/assets/js/modules/utils.js | 40 +++++++------------------- themes/Ying/layouts/page/comment.html | 2 +- 3 files changed, 13 insertions(+), 31 deletions(-) diff --git a/hugo.toml b/hugo.toml index 9f1ee028..95ea3b69 100644 --- a/hugo.toml +++ b/hugo.toml @@ -69,7 +69,7 @@ hasCJKLanguage = true # 自定义文章固定链接 (Permalinks) # 使用日期作为文件名,例如 /20260117.html [permalinks] - post = "/:slug" + posts = "/:slug" # 确保日期优先使用 Front Matter 中的 date [frontmatter] diff --git a/themes/Ying/assets/js/modules/utils.js b/themes/Ying/assets/js/modules/utils.js index e84bf0f2..86f52de3 100644 --- a/themes/Ying/assets/js/modules/utils.js +++ b/themes/Ying/assets/js/modules/utils.js @@ -1,41 +1,23 @@ function themeSweep(newTheme, callback) { - // View Transition API — browser-native crossfade, zero JS animation overhead. - // Same principle as image lightbox transitions. Chrome/Edge 111+, Opera 97+. + // View Transition API — best quality if available if (document.startViewTransition) { document.startViewTransition(function() { callback(); }); return; } - // Fallback: lightweight overlay for Safari / Firefox - var oldTheme = document.documentElement.getAttribute('data-theme'); - var tint = oldTheme === 'dark' - ? 'rgba(15,23,42,0.95)' - : 'rgba(255,255,255,0.95)'; - - var overlay = document.createElement('div'); - overlay.style.cssText = - 'position:fixed;inset:0;z-index:9999;pointer-events:none;' + - 'background:' + tint + ';opacity:1;' + - 'transition:opacity 0.22s ease;' + - 'will-change:opacity;contain:paint;'; - document.body.appendChild(overlay); - - var cleaned = false; - function cleanup() { - if (cleaned) return; - cleaned = true; - if (overlay.parentNode) overlay.parentNode.removeChild(overlay); + // UIkit animate fallback + if (window.UIkit && UIkit.animate) { + var body = document.body; + UIkit.animate(body, 'uk-animation-fade uk-animation-fast'); + setTimeout(function() { + callback(); + UIkit.animate(body, 'uk-animation-fade uk-animation-fast'); + }, 150); + return; } + // Last resort: simple opacity callback(); - overlay.offsetWidth; - overlay.style.opacity = '0'; - - overlay.addEventListener('transitionend', function(e) { - if (e.propertyName !== 'opacity') return; - cleanup(); - }); - setTimeout(cleanup, 380); } // Toast Message Helper diff --git a/themes/Ying/layouts/page/comment.html b/themes/Ying/layouts/page/comment.html index 75409826..fcac0eaa 100644 --- a/themes/Ying/layouts/page/comment.html +++ b/themes/Ying/layouts/page/comment.html @@ -9,7 +9,7 @@ - 简介:{{ .Site.Params.message_info.description | default .Site.Params.author.description }}
- 链接:{{ .Site.Params.message_info.url | default .Site.BaseURL }}
- 图标:{{ .Site.Params.message_info.icon | default .Site.Params.author.avatar }}
- - 订阅:{{ .Site.BaseURL }}rss.xml + - 订阅:{{ "rss.xml" | absURL }}