Skip to content
Snippets Groups Projects
Commit 2c22327b authored by Demian Katz's avatar Demian Katz
Browse files

Allow autocomplete to be disabled.

- Fixes VUFIND-1249.
parent aeb4603b
Branches
Tags
No related merge requests found
...@@ -241,8 +241,13 @@ function setupOffcanvas() { ...@@ -241,8 +241,13 @@ function setupOffcanvas() {
} }
function setupAutocomplete() { function setupAutocomplete() {
// If .autocomplete class is missing, autocomplete is disabled and we should bail out.
var searchbox = $('#searchForm_lookfor.autocomplete');
if (searchbox.length < 1) {
return;
}
// Search autocomplete // Search autocomplete
$('#searchForm_lookfor').autocomplete({ searchbox.autocomplete({
maxResults: 10, maxResults: 10,
loadingString: VuFind.translate('loading') + '...', loadingString: VuFind.translate('loading') + '...',
handler: function vufindACHandler(input, cb) { handler: function vufindACHandler(input, cb) {
...@@ -278,7 +283,7 @@ function setupAutocomplete() { ...@@ -278,7 +283,7 @@ function setupAutocomplete() {
}); });
// Update autocomplete on type change // Update autocomplete on type change
$('#searchForm_type').change(function searchTypeChange() { $('#searchForm_type').change(function searchTypeChange() {
$('#searchForm_lookfor').autocomplete('clear cache'); searchbox.autocomplete('clear cache');
}); });
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment