From 200167c7c7913aee2ec883efee8ed886c738d98c Mon Sep 17 00:00:00 2001 From: Maxime Locqueville Date: Wed, 3 Feb 2016 12:16:20 +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 | 12 ++++++------ 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/themes/vue/layout/layout.ejs b/themes/vue/layout/layout.ejs index 5ca71b5787..6699fa966a 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 e90cf99ca2..bff501ab9f 100644 --- a/themes/vue/source/css/_common.styl +++ b/themes/vue/source/css/_common.styl @@ -165,6 +165,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 b810adf6ca..6a3c3bcd8b 100644 --- a/themes/vue/source/js/common.js +++ b/themes/vue/source/js/common.js @@ -12,12 +12,12 @@ */ 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({ + appId: 'BH4D9OD16A', + apiKey: '85cc3221c9f23bfbaa4e3913dd7625ea', + indexName: 'vuejs', + inputSelector: '#search-query' + }); } /**