Mayx's Home Page https://mabbs.github.io
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1.2 KiB

  1. ---
  2. layout: default
  3. title: 搜索
  4. ---
  5. <h1>搜索</h1>
  6. <form action="https://www.google.com/search">
  7. <input type="hidden" name="as_sitesearch" value="mabbs.github.io">
  8. <p>Keyword: <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="Google Search" /></p>
  9. </form>
  10. <ul id="results-container"></ul>
  11. <!--[if !IE]> -->
  12. <script src="/assets/js/simple-jekyll-search.min.js"></script>
  13. <script>
  14. const urlParams = new URLSearchParams(window.location.search);
  15. const mykeyword = urlParams.get('keyword')?.trim();
  16. const sbox = document.getElementById('search-input');
  17. if (mykeyword) {
  18. sbox.value = mykeyword;
  19. }
  20. getSearchJSON(function(json){
  21. var sjs = SimpleJekyllSearch({
  22. searchInput: sbox,
  23. resultsContainer: document.getElementById('results-container'),
  24. json: json,
  25. searchResultTemplate: '<li><p>{date} - <a href="{url}?kw={query}">{title}</a></p></li>',
  26. limit: 20
  27. });
  28. sjs.search(mykeyword);
  29. document.getElementById('search-loading').style.display = "none";
  30. });
  31. </script>
  32. <!-- <![endif]-->

Powered by TurnKey Linux.