2022-01-04 20:42:55 +08:00
---
layout: default
title: 搜索
---
< h1 > 搜索< / h1 >
2025-04-26 13:52:27 +00:00
<!-- [if IE]>
<p>很遗憾, IE搜不了捏~ </p>
<![endif] -->
<!-- [if !IE]> -->
2025-04-29 16:00:02 +00:00
< p > Keyword: < input type = "text" id = "search-input" placeholder = "Search blog posts.." / > < img src = "/images/loading.svg" alt = "Loading..." id = "search-loading" style = "width:22px;vertical-align: bottom" / > < / p >
2022-01-04 20:42:55 +08:00
< ul id = "results-container" > < / ul >
2025-04-11 17:07:43 +00:00
< script src = "/assets/js/simple-jekyll-search.min.js" > < / script >
2022-01-04 20:42:55 +08:00
< script >
2025-04-03 14:38:40 +00: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 15:20:22 +00: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-02 18:17:34 +00: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 13:52:27 +00:00
<!-- <![endif] -->