Welcome to mirror list, hosted at ThFree Co, Russian Federation.

search.html « partials « layouts - github.com/yanlinlin82/simple-style.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 81ff2b6ccc381a1cb733bec80ec41e8e9e8d1e86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{{ if .Site.Params.Search -}}
{{ if .Site.Params.Search -}}
<div class="search">
  <script>
    function check_search() {
      var s = document.getElementById('keyword').value;
      s = s.replace(/(^\s*)|(\s*$)/g, '');
      if (s == '' || s == undefined || s == null) {
        document.getElementById('keyword').focus();
        return false;
      }
      document.getElementById('wd').value = s + " site:{{ .Site.BaseURL }}";
      return true;
    }
  </script>
  <form class="search" action="https://www.baidu.com/s" target="_blank" onsubmit="return check_search()">
    <input id="keyword" type="text" placeholder="Search.." name="keyword">
    <input id="wd" type="hidden" name="wd">
    <button type="submit"><svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="width:20px;height:20px;color:#333">
        <path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path>
      </svg></button>
  </form>
</div>
{{ end -}}