Explorar el Código

Add support for JSON and Live mode searches

Talha Mansoor hace 11 años
padre
commit
a3816b96fa
Se han modificado 1 ficheros con 13 adiciones y 4 borrados
  1. 13 4
      templates/search.html

+ 13 - 4
templates/search.html

@@ -21,10 +21,19 @@ Search results for {{ SITENAME|striptags }} blog.
 <script>
 $(document).ready(function() {
      $('#tipue_search_input').tipuesearch({
-          'mode': 'live',
-          'show': 10,
-          'newWindow': true,
-          'liveDescription': '.article-content'
+         {% if 'content_in_json' in PLUGINS %}
+             'mode' : 'json',
+         {% else %}
+             'mode': 'live',
+         {% endif %}
+         'show': 10,
+         'newWindow': true,
+         {# I cannot place following statements in the conditionals above because then Tipue Search fails to work. Possibly a bug in Tipue Search. #}
+         {% if 'content_in_json' in PLUGINS %}
+             'contentLocation': '{{ SITEURL }}/tipuesearch_content.json'
+         {% else %}
+             'liveDescription': '.article-content'
+         {% endif %}
      });
 });
 </script>