2022-01-04 20:42:55 +08:00
---
layout: default
title: 搜索
---
< h1 > 搜索< / h1 >
2025-04-26 21:52:27 +08:00
<!-- [if IE]>
< p > 很遗憾, IE搜不了捏~ < / p >
<![endif]-->
<!-- [if !IE]> -->
2022-01-04 20:42:55 +08:00
< p > Keyword: < input type = "text" id = "search-input" placeholder = "Search blog posts.." > < img src = "/images/loading.svg" id = "search-loading" style = "width:22px;vertical-align: bottom" > < / p >
< ul id = "results-container" > < / ul >
2025-04-12 01:07:43 +08:00
< script src = "/assets/js/simple-jekyll-search.min.js" > < / script >
2022-01-04 20:42:55 +08:00
< script >
2025-04-03 22:38:40 +08:00
const urlParams = new URLSearchParams(window.location.search);
const mykeyword = urlParams.get('keyword')?.trim();
const sbox = document.getElementById('search-input');
if (mykeyword) {
sbox.value = mykeyword;
2022-01-04 20:42:55 +08:00
}
2024-09-29 23:20:22 +08:00
getSearchJSON(function(json){
2022-01-04 20:42:55 +08:00
var sjs = SimpleJekyllSearch({
searchInput: sbox,
resultsContainer: document.getElementById('results-container'),
json: json,
2025-04-03 02:17:34 +08:00
searchResultTemplate: '< p > < li > {date} - < a href = "{url}?kw={query}" > {title}< / a > < / li > < / p > ',
2022-01-04 20:42:55 +08:00
limit: 20
});
sjs.search(mykeyword);
document.getElementById('search-loading').style.display = "none";
});
< / script >
2025-04-26 21:52:27 +08:00
<!-- <![endif] -->