#322: Improve responsiveness of search page by loading the search index asynchronously.

This commit is contained in:
Georg Brandl 2010-05-30 15:49:00 +02:00
parent 327516f0ed
commit f3e6c80204
2 changed files with 11 additions and 7 deletions

View File

@ -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 %}

View File

@ -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;