diff --git a/_config.yml.example b/_config.yml.example index f85be62..21d738c 100644 --- a/_config.yml.example +++ b/_config.yml.example @@ -43,6 +43,7 @@ widgets: # Search search: + insight: true swiftype: # enter swiftype install key here baidu: false # you need to disable other search engines to use Baidu search, options: true, false diff --git a/layout/search/index-mobile.ejs b/layout/search/index-mobile.ejs index df29642..4561492 100644 --- a/layout/search/index-mobile.ejs +++ b/layout/search/index-mobile.ejs @@ -1,4 +1,8 @@ -<% if (theme.search.swiftype) { %> +<% if (theme.search.insight) { %> +
+ +
+<% } else if (theme.search.swiftype) { %>
diff --git a/layout/search/index.ejs b/layout/search/index.ejs index 5a17f9b..b112ea0 100644 --- a/layout/search/index.ejs +++ b/layout/search/index.ejs @@ -1,5 +1,11 @@
-<% if (theme.search.swiftype) { %> +<% if (theme.search.insight) { %> +
+ + +
+ <%- partial('search/insight') %> +<% } else if (theme.search.swiftype) { %>
diff --git a/layout/search/insight.ejs b/layout/search/insight.ejs new file mode 100644 index 0000000..7231368 --- /dev/null +++ b/layout/search/insight.ejs @@ -0,0 +1,201 @@ + + \ No newline at end of file diff --git a/source/css/_partial/header.styl b/source/css/_partial/header.styl index 212a8ca..e2a24e2 100644 --- a/source/css/_partial/header.styl +++ b/source/css/_partial/header.styl @@ -152,6 +152,7 @@ $nav-link color: #777 .search-form-input, +.search-form-input.ins-search-input, .search-form-input.st-ui-search-input, .search-form-input.st-default-search-input -webkit-appearance: textarea diff --git a/source/css/_partial/insight.styl b/source/css/_partial/insight.styl new file mode 100644 index 0000000..c9879ec --- /dev/null +++ b/source/css/_partial/insight.styl @@ -0,0 +1,126 @@ +// Insight Search Styles +ins-container-width = 540px +ins-text-grey = #9a9a9a +ins-border-grey = #e2e2e2 +ins-background-grey = #f7f7f7 +ins-background-blue = #006BDE + +$ins-full-screen + top: 0 + left: 0 + margin: 0 + width: 100% + height: 100% + +.ins-search + display: none + &.show + display: block + +.ins-selectable + cursor: pointer + +.ins-search-mask, +.ins-search-container + position: fixed + +.ins-search-mask + top: 0 + left: 0 + width: 100% + height: 100% + z-index: 100 + background: rgba(0,0,0,0.5) + +.ins-input-wrapper + position: relative + +.ins-search-input + width: 100% + border: none + outline: none + font-size: 16px + font-weight: 200 + background: white + line-height: 20px + box-sizing: border-box + padding: 12px 28px 12px 20px + border-bottom: 1px solid ins-border-grey + font-family: "Microsoft Yahei Light", "Microsoft Yahei", Helvetica, Arial, sans-serif + +.ins-close + top: 50% + right: 6px + width: 20px + height: 20px + font-size: 16px + margin-top: -11px + position: absolute + text-align: center + display: inline-block + &:hover + color: ins-background-blue + +.ins-search-container + left: 50% + top: 100px + z-index: 101 + bottom: 100px + box-sizing: border-box + width: ins-container-width + margin-left: -(ins-container-width/2) + @media screen and (max-width: 559px), screen and (max-height: 479px) + top: 0 + left: 0 + margin: 0 + width: 100% + height: 100% + background: ins-background-grey + +.ins-section-wrapper + left: 0 + right: 0 + top: 45px + bottom: 0 + overflow-y: auto + position: absolute + +.ins-section-container + background: ins-background-grey + +.ins-section + font-size: 14px + line-height: 16px + .ins-section-header, + .ins-search-item + padding: 8px 15px + .ins-section-header + color: ins-text-grey + border-bottom: 1px solid ins-border-grey + .ins-slug + margin-left: 5px + color: ins-text-grey + &:before + content: '(' + &:after + content: ')' + .ins-search-item + header, + .ins-search-preview + overflow: hidden + white-space: nowrap + text-overflow: ellipsis + header + .fa + margin-right: 8px + .ins-search-preview + height: 15px + font-size: 12px + color: ins-text-grey + margin: 5px 0 0 20px + &:hover + color: white + background: ins-background-blue + .ins-slug, + .ins-search-preview + color: white \ No newline at end of file diff --git a/source/css/style.styl b/source/css/style.styl index 1e72f16..ac0d691 100644 --- a/source/css/style.styl +++ b/source/css/style.styl @@ -83,6 +83,7 @@ code @import "_partial/timeline" @import "_partial/footer" @import "_partial/sidebar" +@import "_partial/insight" @import "_highlight/index" if sidebar is left