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.0 KiB

  1. ---
  2. layout: default
  3. title: 搜索
  4. ---
  5. <h1>搜索</h1>
  6. <!--[if IE]>
  7. <p>很遗憾,IE搜不了捏~</p>
  8. <![endif]-->
  9. <!--[if !IE]> -->
  10. <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>
  11. <ul id="results-container"></ul>
  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: '<p><li>{date} - <a href="{url}?kw={query}">{title}</a></li></p>',
  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.