Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Replace Google search by Algolia docsearch #6710

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions doc/themes/scikit-learn/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
</ul>

<div class="search_form">
<div id="cse" style="width: 100%;"></div>
<input type="text" id='docsearch-input' placeholder="Search docs...">
</div>
</div> <!-- end navbar -->

Expand Down Expand Up @@ -336,14 +336,13 @@ <h2>Machine Learning in Python</h2>
</script>
{% endif %}

<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript"> google.load('search', '1',
{language : 'en'}); google.setOnLoadCallback(function() {
var customSearchControl = new
google.search.CustomSearchControl('016639176250731907682:tjtqbvtvij0');
customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
var options = new google.search.DrawOptions();
options.setAutoComplete(true);
customSearchControl.draw('cse', options); }, true);
<link rel="stylesheet" href="//cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css" />
<script type="text/javascript" src="//cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script>
<script type="text/javascript">
docsearch({
apiKey: 'd1eea247ba648e6a42e72a961a615ab2',
indexName: 'sklearn',
inputSelector: '#docsearch-input'
});
</script>
{%- endblock %}
66 changes: 51 additions & 15 deletions doc/themes/scikit-learn/static/nature.css_t
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ div.navbar ul {
border-radius: 5px;
-moz-border-radius: 5px;
list-style: none;
float: left;
}

div.navbar ul, div.navbar li {
Expand All @@ -95,29 +96,64 @@ div.navbar ul li a:hover {
}

/*-------------------------------------------------------------*/
/* The next few elements have to do with the gsc (referring to */
/* Google's custom search bar */
/* The next elements have to do with the Algolia docsearch input */

.gsc-input {
.search_form {
margin-left: 10px;
float: left;
width: 180px;
float: right;
}

.search_form {
margin-top: -23px;
/*The min-height is added here, to prevent the element from shrinking
too much, while the scripts are still loading the search-bar.
Without it, layout glitches occur, as the element keeps dynamically
changing its size while its loading-contents adjusts into position.*/
min-height: 42px;
/* Make the dropdown menu aligned on its right side */
.aa-dropdown-menu {
right: 0px !important;
left: auto !important;
}

#cse .gsc-clear-button {
width: 50px;
/* Bottom border of each suggestion */
.algolia-docsearch-suggestion {
border-bottom-color: #3A3DD1 !important;
}

.gsc-branding {
display: none;
/* Main category headers */
.algolia-docsearch-suggestion--category-header {
background-color: #3499CD !important;
font-weight: normal !important;
}

/* Highlighted search terms in the main category headers */
.algolia-docsearch-suggestion--highlight {
color: inherit !important;
background: rgba(187, 223, 241, 0.6) !important;
}

.algolia-docsearch-suggestion--category-header .algolia-docsearch-suggestion--highlight {
color: inherit !important;
border-bottom: 2px solid rgba(187, 223, 241, 0.6);
background: none !important;
}

/* Currently selected suggestion */
.aa-cursor .algolia-docsearch-suggestion--content {
color: #3499CD !important;
}

.aa-cursor .algolia-docsearch-suggestion {
background: #EBEBFB;
}

/* For bigger screens, when displaying results in two columns */
@media (min-width: 768px) {
/* Bottom border of each suggestion */
.algolia-docsearch-suggestion {
border-bottom-color: #7671df;
}
/* Left column, with secondary category header */
.algolia-docsearch-suggestion--subcategory-column {
border-right-color: #7671df;
background-color: #F2F2FF;
color: #4E4726;
}
}

/*---------------------------------------------------------------*/
Expand Down