mirror of
https://ghfast.top/https://github.com/zsjy/halo-theme-dream2.0-plus.git
synced 2025-03-15 16:39:40 +08:00
1. 移除搜索内容显示,由于意外html标签导致样式问题暂时移除
2. 适配搜索瞬间查看页面,搜索到瞬间时支持查看,避免500错误
This commit is contained in:
parent
e244c532ce
commit
5c04585a9a
@ -5288,6 +5288,10 @@ button.swiper-pagination-bullet {
|
||||
}
|
||||
}
|
||||
|
||||
.description {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
b {
|
||||
color: var(--light-z);
|
||||
background: var(--theme);
|
||||
|
2
templates/assets/css/style.min.css
vendored
2
templates/assets/css/style.min.css
vendored
File diff suppressed because one or more lines are too long
76
templates/moment.html
Normal file
76
templates/moment.html
Normal file
@ -0,0 +1,76 @@
|
||||
<!DOCTYPE html>
|
||||
<th:block
|
||||
th:insert="~{common/layout :: layout (title = ${title} + ' - ' + ${site.title}, canonical = @{/moments}, content = ~{::content}, isPost = true)}"
|
||||
th:with="isJournals = true, enableShare = ${theme.config.page_config.enable_journals_share}, baseEnableComment = ${theme.config.page_config.enable_journals_comment}"
|
||||
xmlns:th="https://www.thymeleaf.org">
|
||||
<th:block th:fragment="content">
|
||||
<div class="card card-content journal">
|
||||
<p class="journal-date">
|
||||
<i class="ri-send-plane-line"></i>
|
||||
<em th:text="${#dates.format(moment.spec.releaseTime,'yyyy年MM月dd日 HH:mm:ss')}"></em>
|
||||
</p>
|
||||
<div class="journal-content fold">
|
||||
<div class="main-content not-toc" data-target="Moment" th:data-id="${moment.metadata.name}">
|
||||
[(${moment.spec.content.html})]
|
||||
<mew-photos th:if="${!#lists.isEmpty(moment.spec.content.medium)}">
|
||||
<img th:each="momentItem : ${moment.spec.content.medium}" th:if="${momentItem.type.name == 'PHOTO'}" th:src="${momentItem.url}" />
|
||||
</mew-photos>
|
||||
<th:block th:if="${!#lists.isEmpty(moment.spec.content.medium)}" th:each="momentItem : ${moment.spec.content.medium}">
|
||||
<mew-video th:if="${momentItem.type.name == 'VIDEO'}" th:src="${momentItem.url}"></mew-video>
|
||||
</th:block>
|
||||
<th:block th:if="${!#lists.isEmpty(moment.spec.content.medium)}" th:each="momentItem : ${moment.spec.content.medium}">
|
||||
<mew-music th:if="${momentItem.type.name == 'AUDIO'}" th:url="${momentItem.url}"
|
||||
th:with="list = ${#strings.listSplit(momentItem.url,'/')}, size = ${#lists.size(list)}"
|
||||
th:name="${size >= 0 ? list[size - 1] : momentItem.url}"
|
||||
th:cover="${#theme.assets('/img/music.webp')}"
|
||||
></mew-music>
|
||||
</th:block>
|
||||
</div>
|
||||
</div>
|
||||
<div class="journal-operation">
|
||||
<span class="journal-operation-item">
|
||||
<a class="like" th:data-id="${moment.metadata.name}" th:data-likes="${moment.stats.upvote}">
|
||||
<i class="ri-heart-3-line"></i>
|
||||
<em th:text="${(moment.stats.upvote != 0)? moment.stats.upvote : '喜欢'}"></em>
|
||||
</a>
|
||||
</span>
|
||||
<span class="journal-operation-item" th:if="${enableComment}">
|
||||
<a class="comment">
|
||||
<i class="ri-message-3-line"></i>
|
||||
<em th:text="${(moment.stats.totalComment != 0)? moment.stats.totalComment : '评论'}"></em>
|
||||
</a>
|
||||
</span>
|
||||
<span class="journal-operation-item" th:if="${enableShare}">
|
||||
<a class="share"><i class="ri-share-forward-line"></i><em>分享</em></a>
|
||||
</span>
|
||||
<div th:if="${theme.config.page_config.enable_journals_owner}" class="journal-operation-owner" th:title="${moment.owner.displayName}">
|
||||
<img th:unless="${#strings.isEmpty(moment.owner.avatar)}" class="avatar" th:src="${moment.owner.avatar}"
|
||||
alt="avatar">
|
||||
<div th:if="${#strings.isEmpty(moment.owner.avatar)}" class="no-avatar">
|
||||
<span class="avatar-info">[[${#strings.substring(moment.owner.displayName, 0, 1)}]]</span>
|
||||
</div>
|
||||
<span class="name">[[${moment.owner.displayName}]]</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="journal-comment comment-wrapper-z-index" th:if="${enableComment}">
|
||||
<th:block th:if="${theme.config.enhance.enable_pjax}">
|
||||
<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:unless="${theme.config.enhance.enable_pjax}">
|
||||
<halo:comment
|
||||
group="moment.halo.run"
|
||||
kind="Moment"
|
||||
th:attr="name=${moment.metadata.name}"
|
||||
/>
|
||||
</th:block>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</th:block>
|
||||
</th:block>
|
@ -1,76 +1,76 @@
|
||||
<!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:with="isJournals = true, enableShare = false, baseEnableComment = false"
|
||||
xmlns:th="https://www.thymeleaf.org">
|
||||
<th:block th:fragment="content">
|
||||
<div class="card card-content search">
|
||||
<div class="card-tab">
|
||||
<div>[[${#strings.replace(title, ' - ' + site.title, '')}]]</div>
|
||||
</div>
|
||||
<div class="search-box">
|
||||
<script th:inline="javascript">
|
||||
$(function () {
|
||||
var searchForm = document.getElementById('halo-search-form')
|
||||
searchForm.addEventListener('submit', function (event) {
|
||||
var searchInput = document.getElementById('halo-search-form-text-input')
|
||||
var query = searchInput.value.trim()
|
||||
if (!query || query.startsWith('*')) {
|
||||
event.preventDefault()
|
||||
Qmsg.warning(!query ? '请输入内容' : '不能输入星号(*)作为内容开头')
|
||||
return
|
||||
}
|
||||
if(DreamConfig.pjax_state) {
|
||||
event.preventDefault()
|
||||
searchForm.setAttribute('data-pjax', '')
|
||||
}
|
||||
})
|
||||
document.addEventListener('keydown', function(event) {
|
||||
if (event.key === 'Enter') {
|
||||
if (!searchForm.contains(document.activeElement)) {
|
||||
event.preventDefault(); // 阻止默认行为
|
||||
searchForm.dispatchEvent(new Event('submit')); // 触发submit事件
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
</script>
|
||||
<form id="halo-search-form" class="search-form-inner" method="get" action="/search" role="search">
|
||||
<input type="hidden" name="limit" th:value="${theme.config.page_config.search.search_limit}">
|
||||
<input
|
||||
id="halo-search-form-text-input"
|
||||
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}"
|
||||
th:value="${searchResult.keyword}"
|
||||
/>
|
||||
<button class="search-form-btn" th:title="${theme.config.page_config.search.search_btn_title}" type="submit">
|
||||
<i class="ri-search-line"></i>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div th:if="${searchResult.hits.size() > 0}" class="widget card search" th:each="hit : ${searchResult.hits}">
|
||||
<a th:href="${hit.permalink}" th:target="${theme.config.page_config.search.search_target}" >
|
||||
<div class="card-content main">
|
||||
<h2 class="title" th:utext="${hit.title}"></h2>
|
||||
<div class="main-content not-toc">
|
||||
<span th:utext="${hit.description}"></span>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="meta">
|
||||
<div></div>
|
||||
<em th:text="'最后更新于 ' + ${#dates.format(hit.updateTimestamp,'yyyy年MM月dd日 HH:mm:ss')}"></em>
|
||||
</div>
|
||||
th:insert="~{common/layout :: layout (title = ${theme.config.page_config.search.search_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">
|
||||
<div class="card-tab">
|
||||
<div>[[${#strings.replace(title, ' - ' + site.title, '')}]]</div>
|
||||
</div>
|
||||
<div class="search-box">
|
||||
<script th:inline="javascript">
|
||||
$(function () {
|
||||
var searchForm = document.getElementById('halo-search-form')
|
||||
searchForm.addEventListener('submit', function (event) {
|
||||
var searchInput = document.getElementById('halo-search-form-text-input')
|
||||
var query = searchInput.value.trim()
|
||||
if (!query || query.startsWith('*')) {
|
||||
event.preventDefault()
|
||||
Qmsg.warning(!query ? '请输入内容' : '不能输入星号(*)作为内容开头')
|
||||
return
|
||||
}
|
||||
if (DreamConfig.pjax_state) {
|
||||
event.preventDefault()
|
||||
searchForm.setAttribute('data-pjax', '')
|
||||
}
|
||||
})
|
||||
document.addEventListener('keydown', function (event) {
|
||||
if (event.key === 'Enter') {
|
||||
if (!searchForm.contains(document.activeElement)) {
|
||||
event.preventDefault() // 阻止默认行为
|
||||
searchForm.dispatchEvent(new Event('submit')) // 触发submit事件
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
</script>
|
||||
<form id="halo-search-form" class="search-form-inner" method="get" action="/search" role="search">
|
||||
<input type="hidden" name="limit" th:value="${theme.config.page_config.search.search_limit}">
|
||||
<input
|
||||
id="halo-search-form-text-input"
|
||||
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}"
|
||||
th:value="${searchResult.keyword}"
|
||||
/>
|
||||
<button class="search-form-btn" th:title="${theme.config.page_config.search.search_btn_title}"
|
||||
type="submit">
|
||||
<i class="ri-search-line"></i>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div th:unless="${searchResult.hits.size() > 0}" class="widget card search" >
|
||||
<div class="result-empty">
|
||||
<div class="result-empty-tips" th:utext="${theme.config.page_config.search.search_empty_tips}"></div>
|
||||
</div>
|
||||
</div>
|
||||
</th:block>
|
||||
<div th:if="${searchResult.hits.size() > 0}" class="widget card search" th:each="hit : ${searchResult.hits}">
|
||||
<div class="card-content main">
|
||||
<a th:href="${hit.permalink}" th:target="${theme.config.page_config.search.search_target}">
|
||||
<h2 class="title">[(${hit.title})]</h2>
|
||||
</a>
|
||||
<!-- <div class="main-content not-toc description" th:utext="${hit.description}">-->
|
||||
<!-- </div>-->
|
||||
<hr/>
|
||||
<div class="meta">
|
||||
<div></div>
|
||||
<em th:text="'最后更新于 ' + ${#dates.format(hit.updateTimestamp,'yyyy年MM月dd日 HH:mm:ss')}"></em>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div th:unless="${searchResult.hits.size() > 0}" class="widget card search">
|
||||
<div class="result-empty">
|
||||
<div class="result-empty-tips" th:utext="${theme.config.page_config.search.search_empty_tips}"></div>
|
||||
</div>
|
||||
</div>
|
||||
</th:block>
|
||||
</th:block>
|
||||
|
@ -30,7 +30,7 @@ spec:
|
||||
settingName: theme-dream2-plus-setting
|
||||
configMapName: theme-dream2-plus-configMap
|
||||
# 版本号
|
||||
version: 1.2.7.beta1
|
||||
version: 1.2.7.beta2
|
||||
# 最低支持的 Halo 版本
|
||||
require: ">=2.15.0"
|
||||
# 许可
|
||||
|
Loading…
x
Reference in New Issue
Block a user