'
},
suggestion: function(hit) {
//if (hit.language === language) {
return '
';
//}
}
}
}
]).on('autocomplete:selected', function(ev, suggestion) {
var selected = jqS4com('#'+suggestion.slug);
selected.show();
selected.siblings('a').addClass('s4com-active');
var selectedQuestion = jqS4com('#'+suggestion.slug+'-question');
selectedQuestion.parents('.s4com-section-body').show();
jqS4com('html,body').animate({
scrollTop: selectedQuestion.offset().top - 0
});
});
if (location.hash && location.hash.indexOf('#q=') === 0) {
var q = decodeURIComponent(location.hash.substring(3));
$inputfield.val(q).trigger('keyup');
}
jqS4com('.s4com-articles > a').click(function(e){
e.preventDefault();
var id = jqS4com(this).attr('href');
jqS4com(this).toggleClass('s4com-active');
history.pushState(null, null, '#!'+id.substr(1));
});
if((window.location.hash != "") && (window.location.hash.indexOf('#q') == -1)) {
jqS4com(window).trigger('hashchange');
}
});
jqS4com(window).on('hashchange', function() {
var target = jqS4com('a[href="#' + window.location.hash.slice(1).substring(1, window.location.hash.slice(1).length) + '"]');
var carretToChange = target.parent().parent().parent().find('.fas.fa-chevron-down');
carretToChange.removeClass('fa-chevron-down');
carretToChange.addClass('fa-chevron-up');
if (target.parents('.s4com-section-body').length) {
target.parents('.s4com-section-body:first').show();
}
if (target.length) {
target.addClass('s4com-active');
jqS4com('html, body').animate({
scrollTop: target.offset().top - 0
});
}
});
jqS4com("#language-switcher").on('change', (function(){
var route = window.location.href.split('?')[0];
route = route.split('#')[0]
console.log(route);
window.location = route + '?language='+ this.value;
}))