mirror of
https://ghfast.top/https://github.com/zsjy/halo-theme-dream2.0-plus.git
synced 2025-03-16 00:49:40 +08:00
新版搜索界面搜索校验增加*符号的校验避免站点500错误
This commit is contained in:
parent
33b3f098fa
commit
81d09b42ef
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
@ -9,15 +9,29 @@
|
||||
<div>[[${#strings.replace(title, ' - ' + site.title, '')}]]</div>
|
||||
</div>
|
||||
<div class="search-box">
|
||||
<form class="search-form-inner" method="get" action="/search" role="search" data-pjax>
|
||||
<script th:inline="javascript">
|
||||
$(function(){
|
||||
document.getElementById('halo-search-form').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 ? '请输入搜索内容' : '搜索内容不能以 * 开头');
|
||||
}
|
||||
});
|
||||
})
|
||||
</script>
|
||||
<form id="halo-search-form" class="search-form-inner" method="get" action="/search" role="search" data-pjax>
|
||||
<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}"
|
||||
required
|
||||
/>
|
||||
<button class="search-form-btn" th:title="${theme.config.page_config.search.search_btn_title}" type="submit">
|
||||
<i class="ri-search-line"></i>
|
||||
|
@ -30,7 +30,7 @@ spec:
|
||||
settingName: theme-dream2-plus-setting
|
||||
configMapName: theme-dream2-plus-configMap
|
||||
# 版本号
|
||||
version: 1.2.6.beta2
|
||||
version: 1.2.6.beta3
|
||||
# 最低支持的 Halo 版本
|
||||
require: ">=2.15.0"
|
||||
# 许可
|
||||
|
Loading…
x
Reference in New Issue
Block a user