Tutti: Check if algoliaIndex is defined
This commit is contained in:
parent
30215bf87c
commit
dfe398458b
@ -4,10 +4,13 @@
|
||||
*/
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
if (typeof algoliaIndex === 'undefined') return;
|
||||
|
||||
var searchInput = $('#cloud-search');
|
||||
|
||||
var tu = searchInput.typeahead({hint: true}, {
|
||||
source: index.ttAdapter(),
|
||||
source: algoliaIndex.ttAdapter(),
|
||||
displayKey: 'name',
|
||||
limit: 10,
|
||||
minLength: 0,
|
||||
@ -47,7 +50,6 @@ $(document).ready(function() {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$('.search-site-result.advanced, .search-icon').on('click', function(e){
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
@ -31,7 +31,7 @@ html(lang="en")
|
||||
|
||||
script.
|
||||
var algolia = algoliasearch("{{config['ALGOLIA_USER']}}", "{{config['ALGOLIA_PUBLIC_KEY']}}");
|
||||
var index = algolia.initIndex("{{config['ALGOLIA_INDEX_NODES']}}");
|
||||
var algoliaIndex = algolia.initIndex("{{config['ALGOLIA_INDEX_NODES']}}");
|
||||
|
||||
!function(e){"use strict";e.loadCSS=function(t,n,o){var r,i=e.document,l=i.createElement("link");if(n)r=n;else{var d=(i.body||i.getElementsByTagName("head")[0]).childNodes;r=d[d.length-1]}var a=i.styleSheets;l.rel="stylesheet",l.href=t,l.media="only x",r.parentNode.insertBefore(l,n?r:r.nextSibling);var f=function(e){for(var t=l.href,n=a.length;n--;)if(a[n].href===t)return e();setTimeout(function(){f(e)})};return l.onloadcssdefined=f,f(function(){l.media=o||"all"}),l},"undefined"!=typeof module&&(module.exports=e.loadCSS)}(this);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user