|
|
@ -286,18 +286,31 @@ $.fn.search = function(parameters) { |
|
|
|
}, |
|
|
|
|
|
|
|
setup: { |
|
|
|
api: function() { |
|
|
|
api: function(searchTerm) { |
|
|
|
var |
|
|
|
apiSettings = { |
|
|
|
debug : settings.debug, |
|
|
|
on : false, |
|
|
|
cache : 'local', |
|
|
|
action : 'search', |
|
|
|
onError : module.error |
|
|
|
debug : false, |
|
|
|
on : false, |
|
|
|
cache : true, |
|
|
|
interruptRequests : true, |
|
|
|
action : 'search', |
|
|
|
urlData : { |
|
|
|
query : searchTerm |
|
|
|
}, |
|
|
|
onSuccess : function(response) { |
|
|
|
module.parse.response.call(element, response, searchTerm); |
|
|
|
}, |
|
|
|
onAbort : function(response) { |
|
|
|
}, |
|
|
|
onFailure : function() { |
|
|
|
module.displayMessage(error.serverError); |
|
|
|
}, |
|
|
|
onError : module.error |
|
|
|
}, |
|
|
|
searchHTML |
|
|
|
; |
|
|
|
module.verbose('First request, initializing API'); |
|
|
|
$.extend(true, apiSettings, settings.apiSettings); |
|
|
|
module.verbose('Setuping up API request', apiSettings); |
|
|
|
$module.api(apiSettings); |
|
|
|
} |
|
|
|
}, |
|
|
@ -489,27 +502,11 @@ $.fn.search = function(parameters) { |
|
|
|
}); |
|
|
|
}, |
|
|
|
remote: function(searchTerm) { |
|
|
|
var |
|
|
|
apiSettings = { |
|
|
|
onSuccess : function(response) { |
|
|
|
module.parse.response.call(element, response, searchTerm); |
|
|
|
}, |
|
|
|
onFailure: function() { |
|
|
|
module.displayMessage(error.serverError); |
|
|
|
}, |
|
|
|
urlData: { |
|
|
|
query: searchTerm |
|
|
|
} |
|
|
|
} |
|
|
|
; |
|
|
|
if( !$module.api('get request') ) { |
|
|
|
module.setup.api(); |
|
|
|
if($module.api('is loading')) { |
|
|
|
$module.api('abort'); |
|
|
|
} |
|
|
|
$.extend(true, apiSettings, settings.apiSettings); |
|
|
|
module.debug('Executing search', apiSettings); |
|
|
|
module.cancel.query(); |
|
|
|
module.setup.api(searchTerm); |
|
|
|
$module |
|
|
|
.api('setting', apiSettings) |
|
|
|
.api('query') |
|
|
|
; |
|
|
|
}, |
|
|
|