Skip to content

Commit 17f8a5a

Browse files
ktosorkuhn
authored andcommitted
+doc introduce algolia search box
1 parent bcbfbab commit 17f8a5a

File tree

3 files changed

+57
-174
lines changed

3 files changed

+57
-174
lines changed

akka-docs/_sphinx/themes/akka/layout.html

Lines changed: 38 additions & 173 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@
1313
{% set script_files = script_files + ['_static/contentsFix.js'] %}
1414
{% set script_files = script_files + ['_static/ga.js'] %}
1515
{% set script_files = script_files + ['_static/warnOldDocs.js'] %}
16+
{% set script_files = script_files + ['https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js'] %}
1617
{% set css_files = css_files + ['_static/prettify.css'] %}
1718
{% set css_files = css_files + ['_static/base.css'] %}
1819
{% set css_files = css_files + ['_static/docs.css'] %}
1920
{% set css_files = css_files + ['http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700'] %}
21+
{% set css_files = css_files + ['https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css'] %}
2022

2123
{# do not display relbars #}
2224
{% block relbar1 %}{% endblock %}
@@ -70,6 +72,7 @@
7072
})();
7173
</script>
7274
{%- endif %}
75+
7376
{% endblock %}
7477

7578
{% block content %}
@@ -116,18 +119,16 @@
116119
<span class="divider">«</span> <a href="{{ prev.link|e }}">{{ prev.title }}</a> <span class="divider">|</span>
117120
{%- endif %}
118121
</li>
119-
<li>
122+
<li style="float: left">
120123
Version {{ release|e }}
121124
</li>
125+
<li style="float: left">
126+
<input type="search" id="q" class="form-control" />
127+
</li>
122128
</ul>
123129
</div>
124130
</div>
125131
<div class="row">
126-
{%- if include_analytics %}
127-
<div class="span9">
128-
<div id="cse">Loading</div>
129-
</div>
130-
{%- endif -%}
131132
<div class="span9">
132133
{% block body %}{% endblock %}
133134
</div>
@@ -184,173 +185,7 @@
184185
</div>
185186
</div>
186187
{%- if include_analytics %}
187-
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
188-
<script type="text/javascript">
189-
google.load('search', '1', {language : 'en', style : google.loader.themes.MINIMALIST});
190-
google.setOnLoadCallback(function() {
191-
var customSearchOptions = {}; var customSearchControl = new google.search.CustomSearchControl(
192-
'003065520604945464838:izzukx8-qba', customSearchOptions);
193-
customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
194-
customSearchControl.draw('cse');
195-
var path = window.location.pathname.split('/').slice(0,4);
196-
if(window.location.hostname && path.length >= 4) {
197-
var site = "site:" + window.location.hostname + path.join('/').toString();
198-
customSearchControl.setSearchStartingCallback(this, function(c, s, q) { s.setQueryAddition(site); });
199-
}
200-
}, true);
201-
</script>
202-
<style type="text/css">
203-
.gsc-control-cse {
204-
font-family: Arial, sans-serif;
205-
border-color: rgb(242, 242, 235);
206-
background-color: rgb(242, 242, 235);
207-
}
208-
.gsc-control-cse .gsc-table-result {
209-
font-family: Arial, sans-serif;
210-
display: block;
211-
}
212-
input.gsc-input {
213-
border-color: #BBBBBB;
214-
}
215-
input.gsc-search-button {
216-
border-color: rgb(34, 57, 64);
217-
background-color: rgb(68, 114, 129);
218-
color: #FFFFFF;
219-
}
220-
.gsc-tabHeader.gsc-tabhInactive {
221-
border-color: #777777;
222-
background-color: #777777;
223-
}
224-
.gsc-tabHeader.gsc-tabhActive {
225-
border-color: #333333;
226-
background-color: #333333;
227-
}
228-
.gsc-tabsArea {
229-
border-color: #333333;
230-
}
231-
.gsc-webResult.gsc-result,
232-
.gsc-results .gsc-imageResult {
233-
border-color: #666666;
234-
background-color: #FFFFFF;
235-
padding: 0.5em 0.5em;
236-
}
237-
.gsc-webResult.gsc-result:hover,
238-
.gsc-imageResult:hover {
239-
border-color: #AAAAAA;
240-
background-color: #FFFFFF;
241-
padding: 0.5em 0.5em;
242-
}
243-
.gsc-webResult.gsc-result.gsc-promotion:hover {
244-
border-color: #AAAAAA;
245-
background-color: #FFFFFF;
246-
}
247-
.gs-webResult.gs-result a.gs-title:link,
248-
.gs-webResult.gs-result a.gs-title:link b,
249-
.gs-imageResult a.gs-title:link,
250-
.gs-imageResult a.gs-title:link b {
251-
color: #444444;
252-
}
253-
.gs-webResult.gs-result a.gs-title:visited,
254-
.gs-webResult.gs-result a.gs-title:visited b,
255-
.gs-imageResult a.gs-title:visited,
256-
.gs-imageResult a.gs-title:visited b {
257-
color: #444444;
258-
}
259-
.gs-webResult.gs-result a.gs-title:hover,
260-
.gs-webResult.gs-result a.gs-title:hover b,
261-
.gs-imageResult a.gs-title:hover,
262-
.gs-imageResult a.gs-title:hover b {
263-
color: #444444;
264-
}
265-
.gs-webResult.gs-result a.gs-title:active,
266-
.gs-webResult.gs-result a.gs-title:active b,
267-
.gs-imageResult a.gs-title:active,
268-
.gs-imageResult a.gs-title:active b {
269-
color: #777777;
270-
}
271-
.gsc-cursor-page {
272-
color: #444444;
273-
}
274-
a.gsc-trailing-more-results:link {
275-
color: #444444;
276-
}
277-
.gs-webResult .gs-snippet,
278-
.gs-imageResult .gs-snippet,
279-
.gs-fileFormatType {
280-
color: #333333;
281-
}
282-
.gs-webResult div.gs-visibleUrl,
283-
.gs-imageResult div.gs-visibleUrl {
284-
color: #000000;
285-
}
286-
.gs-webResult div.gs-visibleUrl-short {
287-
color: #000000;
288-
}
289-
.gs-webResult div.gs-visibleUrl-short {
290-
display: none;
291-
}
292-
.gs-webResult div.gs-visibleUrl-long {
293-
display: block;
294-
}
295-
.gs-promotion div.gs-visibleUrl-short {
296-
display: none;
297-
}
298-
.gs-promotion div.gs-visibleUrl-long {
299-
display: block;
300-
}
301-
.gsc-cursor-box {
302-
border-color: #FFFFFF;
303-
}
304-
.gsc-results .gsc-cursor-box .gsc-cursor-page {
305-
border-color: #777777;
306-
background-color: #FFFFFF;
307-
color: #444444;
308-
}
309-
.gsc-results .gsc-cursor-box .gsc-cursor-current-page {
310-
border-color: #333333;
311-
background-color: #333333;
312-
color: #444444;
313-
}
314-
.gsc-webResult.gsc-result.gsc-promotion {
315-
border-color: #CCCCCC;
316-
background-color: #E6E6E6;
317-
}
318-
.gsc-completion-title {
319-
color: #444444;
320-
}
321-
.gsc-completion-snippet {
322-
color: #333333;
323-
}
324-
.gs-promotion a.gs-title:link,
325-
.gs-promotion a.gs-title:link *,
326-
.gs-promotion .gs-snippet a:link {
327-
color: #0000CC;
328-
}
329-
.gs-promotion a.gs-title:visited,
330-
.gs-promotion a.gs-title:visited *,
331-
.gs-promotion .gs-snippet a:visited {
332-
color: #0000CC;
333-
}
334-
.gs-promotion a.gs-title:hover,
335-
.gs-promotion a.gs-title:hover *,
336-
.gs-promotion .gs-snippet a:hover {
337-
color: #444444;
338-
}
339-
.gs-promotion a.gs-title:active,
340-
.gs-promotion a.gs-title:active *,
341-
.gs-promotion .gs-snippet a:active {
342-
color: #00CC00;
343-
}
344-
.gs-promotion .gs-snippet,
345-
.gs-promotion .gs-title .gs-promotion-title-right,
346-
.gs-promotion .gs-title .gs-promotion-title-right * {
347-
color: #333333;
348-
}
349-
.gs-promotion .gs-visibleUrl,
350-
.gs-promotion .gs-visibleUrl-short {
351-
color: #00CC00;
352-
}
353-
</style>
188+
354189
{%- endif %}
355190
<script type="text/javascript">
356191
var $toc = $('#toc');
@@ -362,6 +197,36 @@
362197
$el.prepend($("<a class='section-marker' href='#" + $el.attr("id") + "'>&sect;</a>"))
363198
});
364199
</script>
200+
201+
<!-- Algolia docs search -->
202+
<script type="text/javascript">
203+
var version = DOCUMENTATION_OPTIONS.VERSION;
204+
205+
var lang = "scala";
206+
var path = window.location.pathname;
207+
if (path.includes("/java/") || path.includes("java.html")) lang = "java";
208+
209+
console.log("Search configured for:", lang, "@", version);
210+
211+
docsearch({
212+
apiKey: '543bad5ad786495d9ccd445ed34ed082',
213+
indexName: 'akka_io',
214+
inputSelector: '#q',
215+
algoliaOptions: {
216+
hitsPerPage: 10,
217+
facetFilters: '["language:' + lang + '","version:' + version + '"]'
218+
}
219+
});
220+
221+
// set up "/" as global shortcut for focusing on search
222+
$(document).keypress(function (event) {
223+
if (event.keyCode == 47) {
224+
$("#q").focus();
225+
return false; // swallow key event, otherwise the / char would be input into the search box
226+
}
227+
});
228+
</script>
229+
365230
{% block footer %}{% endblock %}
366231
{%- endblock %}
367232
{% endblock %}

akka-docs/_sphinx/themes/akka/static/docs.css

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,4 +224,22 @@ p.caption { width: 80%; text-align: justify; font-size: 0.95em; font-style: ital
224224
color: white;
225225
font-weight: normal;
226226
text-decoration: none;
227-
}
227+
}
228+
229+
/* fancy searchbox */
230+
#q {
231+
background: url('search.jpg') 5px center no-repeat #FFF;
232+
border: 1px solid #AAA;
233+
float: right;
234+
font-size: 11px;
235+
margin: -4px 32px 0 12px;
236+
opacity: 0.6;
237+
outline: none;
238+
padding: 3px 5px 3px 20px;
239+
width: 180px;
240+
border-radius: 5px;
241+
-webkit-transition: 0.3s;
242+
-moz-transition: 0.3s;
243+
-o-transition: 0.3s;
244+
transition: 0.3s;
245+
}
646 Bytes
Loading

0 commit comments

Comments
 (0)