mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
#322: Improve responsiveness of search page by loading the search index asynchronously.
This commit is contained in:
parent
327516f0ed
commit
f3e6c80204
@ -10,6 +10,12 @@
|
||||
{% extends "layout.html" %}
|
||||
{% set title = _('Search') %}
|
||||
{% set script_files = script_files + ['_static/searchtools.js'] %}
|
||||
{% block extrahead %}
|
||||
<script type="text/javascript">
|
||||
jQuery(function() { Search.loadIndex("{{ pathto('searchindex.js', 1) }}"); });
|
||||
</script>
|
||||
{{ super() }}
|
||||
{% endblock %}
|
||||
{% block body %}
|
||||
<h1 id="search-documentation">{{ _('Search') }}</h1>
|
||||
<div id="fallback" class="admonition warning">
|
||||
@ -48,7 +54,3 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block footer %}
|
||||
{{ super() }}
|
||||
<script type="text/javascript" src="{{ pathto('searchindex.js', 1) }}"></script>
|
||||
{% endblock %}
|
||||
|
@ -237,9 +237,11 @@ var Search = {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the index
|
||||
*/
|
||||
loadIndex : function(url) {
|
||||
$.ajax({type: "GET", url: url, data: null, success: null,
|
||||
dataType: "script", cache: true});
|
||||
},
|
||||
|
||||
setIndex : function(index) {
|
||||
var q;
|
||||
this._index = index;
|
||||
|
Loading…
Reference in New Issue
Block a user