|  |  |  | --- | 
					
						
							|  |  |  | layout: default | 
					
						
							|  |  |  | title: 搜索 | 
					
						
							|  |  |  | --- | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <h1>搜索</h1> | 
					
						
							|  |  |  | <form action="https://www.google.com/search"> | 
					
						
							|  |  |  | <input type="hidden" name="as_sitesearch" value="mabbs.github.io" /> | 
					
						
							|  |  |  | <p><center><input name="q" type="text" id="search-input" placeholder="Search blog posts.." /> <!--[if !IE]> --><img src="/images/loading.svg" alt="Loading..." id="search-loading" style="width:22px;vertical-align: bottom" /><!-- <![endif]--> <input type="submit" value="谷歌搜索" style="margin-left: 5px;" /></center></p> | 
					
						
							|  |  |  | </form> | 
					
						
							|  |  |  | <ul id="results-container"></ul> | 
					
						
							|  |  |  | <!--[if !IE]> --> | 
					
						
							|  |  |  | <script src="/assets/js/simple-jekyll-search.min.js"></script> | 
					
						
							|  |  |  | <script> | 
					
						
							|  |  |  | const urlParams = new URLSearchParams(window.location.search); | 
					
						
							|  |  |  | const mykeyword = urlParams.get('keyword')?.trim(); | 
					
						
							|  |  |  | const sbox = document.getElementById('search-input'); | 
					
						
							|  |  |  | if (mykeyword) { | 
					
						
							|  |  |  |   sbox.value = mykeyword; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | getSearchJSON(function(json){ | 
					
						
							|  |  |  |   var sjs = SimpleJekyllSearch({ | 
					
						
							|  |  |  |      searchInput: sbox, | 
					
						
							|  |  |  |      resultsContainer: document.getElementById('results-container'), | 
					
						
							|  |  |  |      json: json, | 
					
						
							|  |  |  |      searchResultTemplate: '<li><p>{date} - <a href="{url}?kw={query}">{title}</a></p></li>', | 
					
						
							|  |  |  |      limit: 20 | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  |   sjs.search(mykeyword); | 
					
						
							|  |  |  |   document.getElementById('search-loading').style.display = "none"; | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | </script> | 
					
						
							|  |  |  | <!-- <![endif]--> |