소스 검색

Add support for JSON and Live mode searches

Talha Mansoor 11 년 전
부모
커밋
a3816b96fa
1개의 변경된 파일13개의 추가작업 그리고 4개의 파일을 삭제
  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>