Skip to content

Commit

Permalink
支持 tinysou/Swiftype 站内搜索,自定义tinysou搜索框样式使其与swiftype一致
Browse files Browse the repository at this point in the history
  • Loading branch information
lizhuolun committed Apr 5, 2015
1 parent 1422776 commit 3afb544
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
25 changes: 23 additions & 2 deletions layout/_partials/header.swig
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

{% if theme.menu %}
<ul id="menu" class="menu">
{% if config.swiftype_key %}
{% if config.swiftype_key %}
<!--增加swiftype搜索功能-->
<form class="menu-item menu-item-{{ itemName }}">
<input type="text" id="st-search-input" class="st-search-input" style="width:80px;" />
Expand All @@ -26,7 +26,28 @@
_st('install','{{swiftype_key}}');
</script>
<!--增加swiftype搜索功能end-->
{% endif %}
{% elseif config.tinysou_Key %}
{% set engineKey = config.tinysou_Key %}
<!--增加“tinysou”站内搜索功能start-->
<form class="menu-item" ><input type="text" id="ts-search-input" class="menu-search-input"></form>
<script>
var option = {
engineKey: '{{engineKey}}'
};
(function(w,d,t,u,n,s,e){
s = d.createElement(t);
s.src = u;
s.async = 1;
w[n] = function(r){
w[n].opts = r;
};
e = d.getElementsByTagName(t)[0];
e.parentNode.insertBefore(s, e);
})(window,document,'script','//tinysou-cdn.b0.upaiyun.com/ts.js','_ts');
_ts(option);
</script>
<!--增加“tinysou”站内搜索功能end-->
{% endif %}
{% for name, path in theme.menu %}
{% set itemName = name.toLowerCase() %}
<li class="menu-item menu-item-{{ itemName }}">
Expand Down
16 changes: 16 additions & 0 deletions source/css/_section/header.styl
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,19 @@
&:hover { border-bottom-color: $menu-link-hover-border; }
}
}

//searchbar
input.menu-search-input {
background-repeat: no-repeat;
background-position: 5px center;
width:70px;
height:20px;
padding:3px 9px 3px 23px;
border-radius:25px;
border:1px solid #C4C4C4;
box-shadow:inset 1px 1px 1px 1px rgba(0,0,0,0.17);
color:#555555;
font-size: 13px;
background-image: url(/images/searchicon.png);
background-size: 15px 15px;
}
Binary file added source/images/searchicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3afb544

Please sign in to comment.