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" %}
|
{% extends "layout.html" %}
|
||||||
{% set title = _('Search') %}
|
{% set title = _('Search') %}
|
||||||
{% set script_files = script_files + ['_static/searchtools.js'] %}
|
{% 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 %}
|
{% block body %}
|
||||||
<h1 id="search-documentation">{{ _('Search') }}</h1>
|
<h1 id="search-documentation">{{ _('Search') }}</h1>
|
||||||
<div id="fallback" class="admonition warning">
|
<div id="fallback" class="admonition warning">
|
||||||
@ -48,7 +54,3 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block footer %}
|
|
||||||
{{ super() }}
|
|
||||||
<script type="text/javascript" src="{{ pathto('searchindex.js', 1) }}"></script>
|
|
||||||
{% endblock %}
|
|
||||||
|
@ -237,9 +237,11 @@ var Search = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
loadIndex : function(url) {
|
||||||
* Sets the index
|
$.ajax({type: "GET", url: url, data: null, success: null,
|
||||||
*/
|
dataType: "script", cache: true});
|
||||||
|
},
|
||||||
|
|
||||||
setIndex : function(index) {
|
setIndex : function(index) {
|
||||||
var q;
|
var q;
|
||||||
this._index = index;
|
this._index = index;
|
||||||
|
Loading…
Reference in New Issue
Block a user