-
-
Notifications
You must be signed in to change notification settings - Fork 29.2k
/
search.html
30 lines (29 loc) · 1.33 KB
/
search.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{% extends "!search.html" %}
{% block extrahead %}
{{ super() }}
<script type="text/javascript">
jQuery(function() {
$.getJSON("_static/glossary.json", function(glossary) {
var RESULT_TEMPLATE = '<div style="display: none" class="admonition seealso" id="glossary-result">' +
' <p class="glossary-title topic-title"></p>' +
' <div class="glossary-body"></div>' +
'</div>';
$("#search-results").prepend(RESULT_TEMPLATE);
var params = $.getQueryParameters();
if (params.q) {
var search_param = params.q[0].toLowerCase();
var glossary_item = glossary[search_param];
if (glossary_item) {
var resultDiv = $("#glossary-result");
var body = $(glossary_item.body).children();
resultDiv.find(".glossary-body").html(body);
resultDiv.find(".glossary-title").text(glossary_item.title);
resultDiv.show();
} else {
$("#glossary-result").hide('');
}
}
});
});
</script>
{% endblock %}