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.

40 lines
1.4 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><center><input name="q" 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" /> <input type="submit" value="谷歌搜索" style="margin-left: 5px;" /></center></p>
  9. </form>
  10. <ul id="results-container"></ul>
  11. <script>
  12. function getQueryVariable(variable){
  13. var query = window.location.search.substring(1);
  14. var vars = query.split("&");
  15. for (var i=0;i<vars.length;i++) {
  16. var pair = vars[i].split("=");
  17. if(pair[0] == variable){return pair[1];}
  18. }
  19. return('');
  20. }
  21. var mykeyword = decodeURI(getQueryVariable("keyword"));
  22. var sbox = document.getElementById('search-input');
  23. if (mykeyword) {
  24. sbox.value = mykeyword;
  25. }
  26. </script>
  27. <script src="/assets/js/simple-jekyll-search.min.js"></script>
  28. <script>
  29. getSearchJSON(function(json){
  30. var sjs = SimpleJekyllSearch({
  31. searchInput: sbox,
  32. resultsContainer: document.getElementById('results-container'),
  33. json: json,
  34. searchResultTemplate: '<li><p>{date} - <a href="{url}?kw={query}">{title}</a></p></li>',
  35. limit: 20
  36. });
  37. sjs.search(mykeyword);
  38. document.getElementById('search-loading').style.display = "none";
  39. });
  40. </script>

Powered by TurnKey Linux.