8000 [MRG+1] Added v2 Custom Search API and fixed css placement for search… · jwjohnson314/scikit-learn@d109255 · GitHub
[go: up one dir, main page]

Skip to content

Commit d109255

Browse files
Trion129Jeremiah Johnson
authored andcommitted
[MRG+1] Added v2 Custom Search API and fixed css placement for search box (scikit-learn#8542)
* Added v2 Custom Search API and fixed css placement for search box * Tweaked CSS and hid the branding section * Button made cute and override some css to make it look good for old api and new api alike * Better button placement * Colored the search results and pagination section
1 parent f1a58ec commit d109255

File tree

2 files changed

+34
-17
lines changed

2 files changed

+34
-17
lines changed

doc/themes/scikit-learn/layout.html

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
</div>
103103
</a>
104104
<div class="search_form">
105-
<div id="cse" style="width: 100%;"></div>
105+
<div class="gcse-search" id="cse" style="width: 100%;"></div>
106106
</div>
107107
</div> <!-- end navbar -->
108108

@@ -346,15 +346,12 @@ <h2>Machine Learning in Python</h2>
346346
})();
347347
</script>
348348
{% endif %}
349-
350-
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
351-
<script type="text/javascript"> google.load('search', '1',
352-
{language : 'en'}); google.setOnLoadCallback(function() {
353-
var customSearchControl = new
354-
google.search.CustomSearchControl('016639176250731907682:tjtqbvtvij0');
355-
customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
356-
var options = new google.search.DrawOptions();
357-
options.setAutoComplete(true);
358-
customSearchControl.draw('cse', options); }, true);
349+
<script>
350+
(function() {
351+
var cx = '016639176250731907682:tjtqbvtvij0';
352+
var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true;
353+
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
354+
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s);
355+
})();
359356
</script>
360357
{%- endblock %}

doc/themes/scikit-learn/static/nature.css_t

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,20 +207,40 @@ div.navbar div.nav-icon {
207207
}
208208

209209
.search_form {
210-
margin-top: -23px;
211-
/*The min-height is added here, to prevent the element from shrinking
212-
too much, while the scripts are still loading the search-bar.
213-
Without it, layout glitches occur, as the element keeps dynamically
214-
changing its size while its loading-contents adjusts into position.*/
210+
margin-top: -40px;
215211
min-height: 42px;
216212
}
217213

218214
#cse .gsc-clear-button {
219215
width: 50px;
216+
position: relative;
217+
top: -2px;
220218
}
221219

222220
.gsc-branding {
223-
display: none;
221+
display: none !important;
222+
}
223+
224+
form.gsc-search-box {
225+
padding: 0 !important;
226+
}
227+
228+
input.gsc-search-button {
229+
position: relative;
230+
top: -4px;
231+
border-radius: 5px !important;
232+
border-color: #FFFFFF !important;
233+
background-color: #ff9c34 !important;
234+
}
235+
236+
a.gs-title, a.gs-title > b{
237+
color: blue !important;
238+
}
239+
240+
.gsc-results .gsc-cursor-box .gsc-cursor-current-page {
241+
border-color: white !important;
242+
background-color: #ff9c34 !important;
243+
color: white !important;
224244
}
225245

226246
/*---------------------------------------------------------------*/

0 commit comments

Comments
 (0)
0