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错误,优化pjax下发生错误的问题
This commit is contained in:
parent
81d09b42ef
commit
0cb5356cce
@ -75,6 +75,7 @@
|
||||
DreamConfig["gray_mode"] = [[${theme.config.enhance.gray_mode_group.enable_gray_mode}]];
|
||||
DreamConfig["gray_mode_start_time"] = [[${theme.config.enhance.gray_mode_group.gray_mode_start_time}]];
|
||||
DreamConfig["gray_mode_end_time"] = [[${theme.config.enhance.gray_mode_group.gray_mode_end_time}]];
|
||||
DreamConfig["pjax_state"] = [[${theme.config.enhance.enable_pjax}]];
|
||||
/** 配置分享方式 */
|
||||
let post_share = []
|
||||
for (let share of [[${theme.config.post.custom_post_share}]]) {
|
||||
|
@ -10,20 +10,27 @@
|
||||
</div>
|
||||
<div class="search-box">
|
||||
<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();
|
||||
$(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();
|
||||
event.preventDefault()
|
||||
// 显示错误信息
|
||||
Qmsg.warning(!query ? '请输入搜索内容' : '搜索内容不能以 * 开头');
|
||||
Qmsg.warning(!query ? '请输入搜索内容' : '搜索内容不能以 * 开头')
|
||||
return
|
||||
}
|
||||
});
|
||||
if(DreamConfig.pjax_state) {
|
||||
// 阻止表单提交
|
||||
event.preventDefault()
|
||||
searchForm.setAttribute('data-pjax', '')
|
||||
}
|
||||
})
|
||||
})
|
||||
</script>
|
||||
<form id="halo-search-form" class="search-form-inner" method="get" action="/search" role="search" data-pjax>
|
||||
<form id="halo-search-form" class="search-form-inner" method="get" action="/search" role="search">
|
||||
<input
|
||||
id="halo-search-form-text-input"
|
||||
class="text-input"
|
||||
|
@ -30,7 +30,7 @@ spec:
|
||||
settingName: theme-dream2-plus-setting
|
||||
configMapName: theme-dream2-plus-configMap
|
||||
# 版本号
|
||||
version: 1.2.6.beta3
|
||||
version: 1.2.6.beta4
|
||||
# 最低支持的 Halo 版本
|
||||
require: ">=2.15.0"
|
||||
# 许可
|
||||
|
Loading…
x
Reference in New Issue
Block a user