From b1d0990d7ec6e1c6e49f5e15c72993691e9d1f4f Mon Sep 17 00:00:00 2001 From: Maxime Locqueville Date: Fri, 12 Feb 2016 11:18:01 +0100 Subject: [PATCH] add algolia docsearch --- themes/vue/layout/layout.ejs | 2 ++ themes/vue/source/css/_common.styl | 28 ++++++++++++++++++++++++++++ themes/vue/source/js/common.js | 11 +++++------ 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/themes/vue/layout/layout.ejs b/themes/vue/layout/layout.ejs index 6de14b2b1..894b1a16c 100644 --- a/themes/vue/layout/layout.ejs +++ b/themes/vue/layout/layout.ejs @@ -8,12 +8,14 @@ + <%- css(isIndex ? 'css/index' : 'css/page') %> <%- partial('partials/ga') %> + diff --git a/themes/vue/source/css/_common.styl b/themes/vue/source/css/_common.styl index dedb10a32..5d4f7abd9 100644 --- a/themes/vue/source/css/_common.styl +++ b/themes/vue/source/css/_common.styl @@ -166,6 +166,34 @@ a.button border-right 4px solid transparent border-top 5px solid #ccc + .algolia-autocomplete + line-height: normal + + @media (min-width: 768px) + .aa-dropdown-menu + min-width: 515px + + .algolia-docsearch-suggestion + border-color: #42b983 + + .algolia-docsearch-suggestion--subcategory-column + border-color: #42b983 + + .algolia-docsearch-suggestion--category-header + background: #42b983 + + .algolia-docsearch-footer + border-color: #42b983 + + .algolia-docsearch-suggestion--category-header .algolia-docsearch-suggestion--highlight + background rgba(255, 255, 255, 0.6) + + .algolia-docsearch-suggestion--highlight + color: #2c815b + + .aa-cursor .algolia-docsearch-suggestion--content + color: #000 + #donate height 24px .wrapper diff --git a/themes/vue/source/js/common.js b/themes/vue/source/js/common.js index 85c29077c..7517300fa 100644 --- a/themes/vue/source/js/common.js +++ b/themes/vue/source/js/common.js @@ -20,12 +20,11 @@ */ function initSearch () { - (function(w,d,t,u,n,s,e){w['SwiftypeObject']=n;w[n]=w[n]||function(){ - (w[n].q=w[n].q||[]).push(arguments);};s=d.createElement(t); - e=d.getElementsByTagName(t)[0];s.async=1;s.src=u;e.parentNode.insertBefore(s,e); - })(window,document,'script','//s.swiftypecdn.com/install/v2/st.js','_st'); - - _st('install','HgpxvBc7pUaPUWmG9sgv','2.0.0'); + docsearch({ + apiKey: '0a75952972806d9ad07e387d08e9cc4c', + indexName: 'vuejs_jp', + inputSelector: '.st-default-search-input' + }); } /**