Source

sphinx-techtonik-mq / 322.improve-search-responsiveness.diff

# HG changeset patch
# Parent 3cc7871001e50efa79671fb816b5044f2d6cc938
# User anatoly techtonik <techtonik@gmail.com>

diff -r 3cc7871001e5 sphinx/themes/basic/search.html
--- a/sphinx/themes/basic/search.html	Sun Jun 20 14:23:59 2010 +0200
+++ b/sphinx/themes/basic/search.html	Mon Jun 21 01:30:35 2010 +0300
@@ -2,6 +2,12 @@
 {% set title = _('Search') %}
 {% set script_files = script_files + ['_static/searchtools.js'] %}
 {% block body %}
+  <script type="text/javascript">
+    jQuery(function($) {
+      Search.loadIndex("{{ pathto('searchindex.js', 1) }}");
+    })
+  </script>
+
   <h1 id="search-documentation">{{ _('Search') }}</h1>
   <div id="fallback" class="admonition warning">
   <script type="text/javascript">$('#fallback').hide();</script>
@@ -41,5 +47,4 @@
 {% endblock %}
 {% block footer %}
   {{ super() }}
-  <script type="text/javascript" src="{{ pathto('searchindex.js', 1) }}"></script>
 {% endblock %}
diff -r 3cc7871001e5 sphinx/themes/basic/static/searchtools.js
--- a/sphinx/themes/basic/static/searchtools.js	Sun Jun 20 14:23:59 2010 +0200
+++ b/sphinx/themes/basic/static/searchtools.js	Mon Jun 21 01:30:35 2010 +0300
@@ -241,6 +241,10 @@
   hasIndex : function() {
       return this._index !== null;
   },
+  
+  loadIndex : function(url) {
+      jQuery.getScript(url);
+  },
 
   deferQuery : function(query) {
       this._queued_query = query;