add marks to terms coming from autocompletion
This commit is contained in:
parent
847eb41741
commit
8aabfe2592
@ -6,7 +6,7 @@
|
||||
MaterioSearchApiAjax = function(){
|
||||
var _isloadingresults = false;
|
||||
var _$content = $('#content');
|
||||
// TODO: define $content by module settings
|
||||
// TODO: define $content by module settings
|
||||
/**
|
||||
* init()
|
||||
*/
|
||||
@ -51,17 +51,17 @@ MaterioSearchApiAjax = function(){
|
||||
.bind('view-mode-changed', onViewModeChanged)
|
||||
.bind('history-state-change', onHistoryStateChange);
|
||||
};
|
||||
|
||||
|
||||
function onThemeReady(event){
|
||||
// trace('MaterioSearchApiAjax :: onThemeReady');
|
||||
if( isActuality() || isExplore() ){
|
||||
$.event.trigger({
|
||||
type : 'resultschanged',
|
||||
container : isActuality() ? '#content .actuality-items' : '#content .search-results'
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function getSearchKeys(){
|
||||
return $('#materio-search-api-search-form').find('input[name*="searchfield"]').val();
|
||||
};
|
||||
@ -91,11 +91,11 @@ MaterioSearchApiAjax = function(){
|
||||
$('#materio-search-api-search-form').addClass('loading');
|
||||
// trace('window.location.href',window.location.href);
|
||||
// TODO: record ajax path in a variable from materio_search_api_ajax_init
|
||||
$.getJSON(Drupal.settings.basePath+Drupal.settings.pathPrefix+'materio_search_api_ajax/search/',
|
||||
$.getJSON(Drupal.settings.basePath+Drupal.settings.pathPrefix+'materio_search_api_ajax/search/',
|
||||
{'types':types,'current_path':document.location.href, 'keys':keys, 'searchmode':searchmode},
|
||||
function(json){
|
||||
//trace('json', json);
|
||||
|
||||
|
||||
// google analytics
|
||||
$.event.trigger({
|
||||
type : "record-stat",
|
||||
@ -108,12 +108,12 @@ MaterioSearchApiAjax = function(){
|
||||
if(json.redirect){
|
||||
window.location = json.redirect;
|
||||
}else{
|
||||
$.event.trigger('loaded-content');
|
||||
$.event.trigger('loaded-content');
|
||||
_isloadingresults = false;
|
||||
$('#materio-search-api-search-form').removeClass('loading');
|
||||
changeContent(json);
|
||||
changeContent(json);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -126,10 +126,10 @@ MaterioSearchApiAjax = function(){
|
||||
$('#materio-search-api-search-form').addClass('loading');
|
||||
|
||||
var url = Drupal.settings.basePath+Drupal.settings.pathPrefix+'materio_search_api_ajax/actuality';
|
||||
$.getJSON(url,
|
||||
$.getJSON(url,
|
||||
function(json){
|
||||
//trace('json', json);
|
||||
$.event.trigger('loaded-content');
|
||||
$.event.trigger('loaded-content');
|
||||
_isloadingresults = false;
|
||||
$('#materio-search-api-search-form').removeClass('loading');
|
||||
changeContent(json);
|
||||
@ -154,10 +154,10 @@ MaterioSearchApiAjax = function(){
|
||||
title : json.title,
|
||||
content : json.returned
|
||||
});
|
||||
|
||||
|
||||
for (language in Drupal.settings.materio_search_api_ajax.languages) {
|
||||
var l = Drupal.settings.materio_search_api_ajax.languages[language];
|
||||
$('#block-locale-language li.'+language+' a').attr('href', Drupal.settings.basePath + l.prefix+'/' + json.search_path + '/' + json.keys)
|
||||
$('#block-locale-language li.'+language+' a').attr('href', Drupal.settings.basePath + l.prefix+'/' + json.search_path + '/' + json.keys)
|
||||
};
|
||||
};
|
||||
|
||||
@ -191,7 +191,7 @@ MaterioSearchApiAjax = function(){
|
||||
var keys = href.match(/explore\/([^\/|\?]+)/);
|
||||
var page = href.match(/\?page=([0-9]+)/);
|
||||
var url = Drupal.settings.basePath+Drupal.settings.pathPrefix+'materio_search_api_ajax/search/'+page[1];
|
||||
|
||||
|
||||
loadNextPage(url, keys[1], $('.materiobase-results', _$content), '.search-results');
|
||||
};
|
||||
|
||||
@ -241,7 +241,7 @@ MaterioSearchApiAjax = function(){
|
||||
_isloadingresults = false;
|
||||
};
|
||||
|
||||
// TEST not used
|
||||
// TEST not used
|
||||
function addNextpageItemByItem($newcontent, container_class){
|
||||
//trace('MaterioSearchApiAjax :: addNextpageItemByItem()');
|
||||
$('ul.pager', _$content).remove();
|
||||
@ -257,9 +257,9 @@ MaterioSearchApiAjax = function(){
|
||||
$.event.trigger({
|
||||
type : 'resultscompleted',
|
||||
container : $(container_class, _$content)
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* viewmode
|
||||
@ -284,7 +284,7 @@ MaterioSearchApiAjax = function(){
|
||||
//trace('viewmode json', json);
|
||||
_isloadingresults = false;
|
||||
if (json.statut == "saved"){
|
||||
|
||||
|
||||
// google analytics
|
||||
$.event.trigger({
|
||||
type : "record-stat",
|
||||
@ -297,7 +297,7 @@ MaterioSearchApiAjax = function(){
|
||||
$('.viewmode-link, .viewmode-link i').removeClass('active');
|
||||
$btn.addClass('active').find('i').addClass('active');
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
};
|
||||
@ -316,7 +316,7 @@ MaterioSearchApiAjax = function(){
|
||||
function onHistoryStateChange(event){
|
||||
if(isExplore() || isActuality())
|
||||
triggerContentChanged();
|
||||
// TODO: pushstate trogger state change, so we have a retriggerring here on loading new results … how to avoid this
|
||||
// TODO: pushstate trogger state change, so we have a retriggerring here on loading new results … how to avoid this
|
||||
};
|
||||
|
||||
/**
|
||||
@ -329,12 +329,12 @@ MaterioSearchApiAjax = function(){
|
||||
function isActuality(){
|
||||
return $('.actuality-items', '#content').length;
|
||||
};
|
||||
|
||||
|
||||
init();
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
var materiosearchapiajax = new MaterioSearchApiAjax();
|
||||
});
|
||||
|
||||
|
||||
})(jQuery);
|
@ -97,7 +97,7 @@ function materio_search_api_autocomplete_searchapi($typed = ''){
|
||||
//$term_matches[$item->tid] = check_plain($item->name);
|
||||
// $term_matches[check_plain($item->name)] = check_plain($item->name);
|
||||
// TODO: leave tags with nodes
|
||||
$term_matches[ trim(implode(' ', $adv_search_q[0]).' '.$last[1].$item->name)] = check_plain($item->name);
|
||||
$term_matches[ '"'.trim(implode(' ', $adv_search_q[0]).' '.$last[1].$item->name).'"'] = check_plain($item->name);
|
||||
|
||||
$delta++;
|
||||
if($delta > 15)
|
||||
|
Loading…
x
Reference in New Issue
Block a user