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.

28 lines
951 B

  1. ---
  2. layout: default
  3. title: 搜索
  4. ---
  5. <h1>搜索</h1>
  6. <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>
  7. <ul id="results-container"></ul>
  8. <script src="/assets/js/simple-jekyll-search.min.js"></script>
  9. <script>
  10. const urlParams = new URLSearchParams(window.location.search);
  11. const mykeyword = urlParams.get('keyword')?.trim();
  12. const sbox = document.getElementById('search-input');
  13. if (mykeyword) {
  14. sbox.value = mykeyword;
  15. }
  16. getSearchJSON(function(json){
  17. var sjs = SimpleJekyllSearch({
  18. searchInput: sbox,
  19. resultsContainer: document.getElementById('results-container'),
  20. json: json,
  21. searchResultTemplate: '<p><li>{date} - <a href="{url}?kw={query}">{title}</a></li></p>',
  22. limit: 20
  23. });
  24. sjs.search(mykeyword);
  25. document.getElementById('search-loading').style.display = "none";
  26. });
  27. </script>

Powered by TurnKey Linux.