2024-07-10 21:26:10 +08:00
|
|
|
<!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">
|
2024-07-17 11:59:57 +08:00
|
|
|
<script th:inline="javascript">
|
2024-07-17 13:13:41 +08:00
|
|
|
$(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()
|
2024-07-17 11:59:57 +08:00
|
|
|
if (!query || query.startsWith('*')) {
|
|
|
|
// 阻止表单提交
|
2024-07-17 13:13:41 +08:00
|
|
|
event.preventDefault()
|
2024-07-17 11:59:57 +08:00
|
|
|
// 显示错误信息
|
2024-07-19 11:51:04 +08:00
|
|
|
Qmsg.warning(!query ? '请输入内容' : '不能输入星号(*)作为内容开头')
|
2024-07-17 13:13:41 +08:00
|
|
|
return
|
2024-07-17 11:59:57 +08:00
|
|
|
}
|
2024-07-17 13:13:41 +08:00
|
|
|
if(DreamConfig.pjax_state) {
|
|
|
|
// 阻止表单提交
|
|
|
|
event.preventDefault()
|
|
|
|
searchForm.setAttribute('data-pjax', '')
|
|
|
|
}
|
|
|
|
})
|
2024-07-17 11:59:57 +08:00
|
|
|
})
|
|
|
|
</script>
|
2024-07-17 13:13:41 +08:00
|
|
|
<form id="halo-search-form" class="search-form-inner" method="get" action="/search" role="search">
|
2024-07-19 11:51:04 +08:00
|
|
|
<input type="hidden" name="limit" th:value="${theme.config.page_config.search.search_limit}">
|
2024-07-10 21:26:10 +08:00
|
|
|
<input
|
2024-07-17 11:59:57 +08:00
|
|
|
id="halo-search-form-text-input"
|
2024-07-10 21:26:10 +08:00
|
|
|
class="text-input"
|
|
|
|
type="search"
|
|
|
|
name="keyword"
|
2024-07-13 10:16:34 +08:00
|
|
|
th:title="${theme.config.page_config.search.search_placeholder}"
|
2024-07-10 21:26:10 +08:00
|
|
|
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>
|
2024-07-12 16:14:21 +08:00
|
|
|
<div th:if="${searchResult.hits.size() > 0}" class="widget card search" th:each="hit : ${searchResult.hits}">
|
2024-07-10 21:26:10 +08:00
|
|
|
<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>
|
2024-07-20 14:17:33 +08:00
|
|
|
<div class="main-content not-toc">
|
|
|
|
<span th:utext="${hit.description}"></span>
|
|
|
|
</div>
|
2024-07-10 21:26:10 +08:00
|
|
|
<hr/>
|
|
|
|
<div class="meta">
|
|
|
|
<div></div>
|
|
|
|
<em th:text="'最后更新于 ' + ${#dates.format(hit.updateTimestamp,'yyyy年MM月dd日 HH:mm:ss')}"></em>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</a>
|
|
|
|
</div>
|
2024-07-12 16:14:21 +08:00
|
|
|
<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>
|
2024-07-10 21:26:10 +08:00
|
|
|
</th:block>
|
|
|
|
</th:block>
|