feat: 完善主题功能并适配插件 (v1.1.5)
功能新增 - 新增页面布局契约 templates/layout.html,插件前台页面可复用主题外观,避免回退到 Halo fallback 布局 - 新增微信读书页面模板 (weread.html),集成 halo-weread-plugin 书架 - 新增订阅页面模板 (page_subscriptions.html) - 新增欢迎弹窗组件(IP 地理定位,多 API 容错) - 新增点击特效组件(9 种效果) - 页脚新增全站统计,支持开关与统计项配置,默认开启 插件适配 - 适配 extra-api:文章字数改服务端统计、正文可选中英混排与服务端代码高亮 - 修正各页面插件应用市场链接与插件名 修复 - 修复文章正文图片/视频无法居中(正文样式移至全局,scoped 样式对 Thymeleaf 注入内容无效) - 修复正文 H1-H6 字号过大,重排层级与移动端断点 - 修复 th: 属性中文字符串缺少引号导致的 Thymeleaf 解析异常(/links、/moments 500) - 修复 JS 内联表达式与 Thymeleaf 内联语法冲突,全部内联脚本加 th:inline="none" - 修复移除 i18n 后 steam 页 Elvis 表达式回归问题 - 修正订阅页 th:attr 引号嵌套错误 优化 - Hero 移除灰色遮罩,下滑箭头改为可点击平滑滚动 - 优化目录样式:移除圆点与下拉箭头,支持两行显示,修复长目录截断 - 移除 i18n 多语言支持 清理 - 移除未使用的 Vue/图标依赖与废弃脚本、重复资源
This commit is contained in:
+40
-14
@@ -5,13 +5,22 @@ import LightGallery from "../components/LightGallery.astro";
|
||||
|
||||
<Layout>
|
||||
<Fragment slot="head">
|
||||
<title th:text="|${theme.config?.moments?.moments_page_title ?: #messages.msg('moments.title')} - ${site.title}|"></title>
|
||||
<title th:text="|${theme.config?.moments?.moments_page_title ?: '动态'} - ${site.title}|"></title>
|
||||
</Fragment>
|
||||
|
||||
<section class="wi-moments-page" th:attr="data-i18n-all-moments-loaded=#{common.allMomentsLoaded}">
|
||||
<section class="wi-moments-page">
|
||||
<div class="wi-moments-page__hero" th:if="${theme.config?.moments?.moments_cover}">
|
||||
<img
|
||||
class="wi-moments-page__cover"
|
||||
th:src="${theme.config?.moments?.moments_cover}"
|
||||
alt=""
|
||||
loading="eager"
|
||||
decoding="async"
|
||||
/>
|
||||
</div>
|
||||
<div class="wi-container">
|
||||
<div class="wi-moments-page__header">
|
||||
<h1 class="wi-moments-page__title" th:text="${theme.config?.moments?.moments_page_title ?: #messages.msg('moments.title')}">瞬间</h1>
|
||||
<div class="wi-moments-page__header" th:unless="${theme.config?.moments?.moments_cover}">
|
||||
<h1 class="wi-moments-page__title" th:text="${theme.config?.moments?.moments_page_title ?: '动态'}">瞬间</h1>
|
||||
<span class="wi-page-accent"></span>
|
||||
</div>
|
||||
|
||||
@@ -70,7 +79,7 @@ import LightGallery from "../components/LightGallery.astro";
|
||||
</th:block>
|
||||
<th:block th:if="${momentsResult == null or #lists.isEmpty(momentsResult.items)}">
|
||||
<div class="wi-moments-page__empty">
|
||||
<p th:text="#{moments.noMoments}">No moments yet</p>
|
||||
<p th:text="'还没有瞬间,快去记录当下的心情吧 🌙'">还没有瞬间,快去记录当下的心情吧 🌙</p>
|
||||
</div>
|
||||
</th:block>
|
||||
</div>
|
||||
@@ -126,7 +135,7 @@ import LightGallery from "../components/LightGallery.astro";
|
||||
</th:block>
|
||||
<th:block th:if="${momentsResult == null or #lists.isEmpty(momentsResult.items)}">
|
||||
<div class="wi-moments-page__empty">
|
||||
<p th:text="#{moments.noMoments}">No moments yet</p>
|
||||
<p th:text="'还没有瞬间,快去记录当下的心情吧 🌙'">还没有瞬间,快去记录当下的心情吧 🌙</p>
|
||||
</div>
|
||||
</th:block>
|
||||
</div>
|
||||
@@ -141,13 +150,13 @@ import LightGallery from "../components/LightGallery.astro";
|
||||
class="wi-moments-page__page-btn"
|
||||
th:if="${momentsResult.hasPrevious()}"
|
||||
th:href="${momentsResult.prevUrl}"
|
||||
th:text="#{common.newer}">Newer</a>
|
||||
th:text="'较新'">较新</a>
|
||||
<span class="wi-moments-page__page-spacer" th:if="${momentsResult.hasPrevious() and momentsResult.hasNext()}"></span>
|
||||
<a
|
||||
class="wi-moments-page__page-btn"
|
||||
th:if="${momentsResult.hasNext()}"
|
||||
th:href="${momentsResult.nextUrl}"
|
||||
th:text="#{common.older}">Older</a>
|
||||
th:text="'较旧'">较旧</a>
|
||||
</nav>
|
||||
|
||||
<div
|
||||
@@ -157,7 +166,7 @@ import LightGallery from "../components/LightGallery.astro";
|
||||
></div>
|
||||
<th:block th:if="${momentFinder == null}">
|
||||
<div class="wi-moments-page__empty">
|
||||
<p th:text="#{common.pluginError}">Plugin error</p>
|
||||
<p th:text="'插件加载异常,请检查插件状态'">插件加载异常,请检查插件状态</p>
|
||||
</div>
|
||||
</th:block>
|
||||
</div>
|
||||
@@ -165,7 +174,7 @@ import LightGallery from "../components/LightGallery.astro";
|
||||
|
||||
<th:block th:unless="${pluginFinder.available('PluginMoments')}">
|
||||
<div class="wi-moments-page__empty">
|
||||
<p th:utext="#{common.installPlugin('Moments', 'https://www.halo.run/store/apps/app-hqbe')}">This feature requires the Moments plugin</p>
|
||||
<p>该功能需要安装「瞬间」插件,<a href="https://www.halo.run/store/apps/app-SnwWD" target="_blank" rel="noopener noreferrer">前往应用市场安装</a></p>
|
||||
</div>
|
||||
</th:block>
|
||||
</div>
|
||||
@@ -174,7 +183,7 @@ import LightGallery from "../components/LightGallery.astro";
|
||||
<LightGallery />
|
||||
</Layout>
|
||||
|
||||
<script is:inline>
|
||||
<script is:inline th:inline="none">
|
||||
(function () {
|
||||
document.addEventListener("click", function (e) {
|
||||
var likeBtn = e.target.closest(".wi-moments-page__like-btn");
|
||||
@@ -350,9 +359,7 @@ import LightGallery from "../components/LightGallery.astro";
|
||||
sentinel.style.display = "none";
|
||||
var endMsg = document.createElement("div");
|
||||
endMsg.className = "wi-moments-page__empty";
|
||||
var momentsSection = document.querySelector(".wi-moments-page");
|
||||
var allMomentsText = momentsSection ? momentsSection.getAttribute("data-i18n-all-moments-loaded") : "All moments loaded";
|
||||
endMsg.innerHTML = "<p>" + allMomentsText + "</p>";
|
||||
endMsg.innerHTML = "<p>已加载全部瞬间</p>";
|
||||
sentinel.parentNode.appendChild(endMsg);
|
||||
}
|
||||
|
||||
@@ -376,6 +383,21 @@ import LightGallery from "../components/LightGallery.astro";
|
||||
padding-block: 1rem;
|
||||
}
|
||||
|
||||
.wi-moments-page__hero {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: clamp(220px, 30vw, 380px);
|
||||
overflow: hidden;
|
||||
background: var(--bg-raised);
|
||||
}
|
||||
|
||||
.wi-moments-page__cover {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.wi-moments-page__header {
|
||||
text-align: center;
|
||||
margin-bottom: var(--space-3xl);
|
||||
@@ -678,6 +700,10 @@ import LightGallery from "../components/LightGallery.astro";
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.wi-moments-page__hero {
|
||||
height: clamp(180px, 36vw, 260px);
|
||||
}
|
||||
|
||||
.wi-moments-page__masonry {
|
||||
columns: 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user