fixe @koala-prepend

This commit is contained in:
Bachir Soussi Chiadmi 2013-12-06 12:46:57 +01:00
parent e1a04d9b8e
commit 90c6d5e6e9
2 changed files with 722 additions and 6 deletions

View File

@ -1,5 +1,5 @@
// @codekit-prepend "gui.js"
// @koala-prepend "gui.js"
// @koala-prepend "gui_ck_fw/gui.js"
(function($) {
@ -35,7 +35,10 @@ MaterioSearchApiAjax = function(){
// /!\ AUTOCOMPLETE SELECT EVENT need a patch http://drupal.org/node/365241#comment-5374686
$("#edit-searchfield")
.bind('autocompleteSelect', function(event) {
$(this).parents('.form').trigger('submit');
// $(this).parents('.form').trigger('submit');
setTimeout(function(){
loadResults(getSearchKeys(), "taxonomy");
},10);
})
.bind('focus', function(event){
$(this).select();
@ -63,11 +66,15 @@ MaterioSearchApiAjax = function(){
return $('#materio-search-api-search-form').find('input[name*="searchfield"]').val();
};
function loadResults(keys){
trace('keys', keys);
function loadResults(keys, searchmode){
//trace('keys', keys);
if(keys !== undefined && keys !== '' && keys.length >= 2){
keys = keys.replace('/', ' ');
// define mode
searchmode = searchmode || "fulltext";
// record the "node type filter" form item
var types = {}, stringTypes = [];
$('#edit-bundles-filter', '#materio-search-api-search-form').find('input[type*="checkbox"]').each(function(i){
$this = $(this);
@ -85,7 +92,7 @@ MaterioSearchApiAjax = function(){
// 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/',
{'types':types,'current_path':document.location.href, keys:keys},
{'types':types,'current_path':document.location.href, 'keys':keys, 'searchmode':searchmode},
function(json){
//trace('json', json);

711
js/materio_search_api_ajax.min.js vendored Normal file → Executable file

File diff suppressed because one or more lines are too long