2
0
mirror of https://github.com/devbridge/jQuery-Autocomplete.git synced 2024-11-09 14:50:57 +00:00

Minify source during build. Fixes #255.

This commit is contained in:
Tomas Kirda 2014-10-08 10:25:30 -05:00
parent 75879a89c1
commit 587414b143
3 changed files with 35 additions and 22 deletions

View File

@ -281,9 +281,7 @@
topOverflow = -scrollTop + offset.top - containerHeight,
bottomOverflow = scrollTop + viewPortHeight - (offset.top + height + containerHeight);
orientation = (Math.max(topOverflow, bottomOverflow) === topOverflow)
? 'top'
: 'bottom';
orientation = (Math.max(topOverflow, bottomOverflow) === topOverflow) ? 'top' : 'bottom';
}
if (orientation === 'top') {
@ -388,7 +386,7 @@
that.selectHint();
return;
}
// Fall through to RETURN
/* falls through */
case keys.RETURN:
if (that.selectedIndex === -1) {
that.hide();
@ -537,6 +535,15 @@
return;
}
if ($.isFunction(that.lookup)){
that.lookup(q, function (data) {
that.suggestions = data.suggestions;
that.suggest();
options.onSearchComplete.call(that.element, q, data.suggestions);
});
return;
}
if (that.isLocal) {
response = that.getSuggestionsLocal(q);
} else {
@ -607,7 +614,11 @@
suggest: function () {
if (this.suggestions.length === 0) {
this.options.showNoSuggestionNotice ? this.noSuggestions() : this.hide();
if (this.options.showNoSuggestionNotice) {
this.noSuggestions();
} else {
this.hide();
}
return;
}
@ -658,21 +669,21 @@
noSuggestionsContainer.detach();
container.html(html);
// Select first value by default:
if (options.autoSelectFirst) {
that.selectedIndex = 0;
container.children().first().addClass(classSelected);
}
if ($.isFunction(beforeRender)) {
beforeRender.call(that.element, container);
}
that.fixPosition();
container.show();
that.visible = true;
// Select first value by default:
if (options.autoSelectFirst) {
that.selectedIndex = 0;
container.scrollTop(0);
container.children().first().addClass(classSelected);
}
that.visible = true;
that.findBestHint();
},
@ -851,16 +862,17 @@
adjustScroll: function (index) {
var that = this,
activeItem = that.activate(index),
offsetTop,
upperBound,
lowerBound,
heightDelta = 25;
activeItem = that.activate(index);
if (!activeItem) {
return;
}
var offsetTop,
upperBound,
lowerBound,
heightDelta = $(activeItem).outerHeight();
offsetTop = activeItem.offsetTop;
upperBound = $(that.suggestionsContainer).scrollTop();
lowerBound = upperBound + that.options.maxHeight - heightDelta;

File diff suppressed because one or more lines are too long

View File

@ -40,6 +40,9 @@ module.exports = function(grunt) {
console.log('Updating: ' + filePath);
grunt.file.write(filePath, src);
// Minify latest version:
grunt.task.run('uglify');
// Update plugin version:
filePath = 'devbridge-autocomplete.jquery.json';
src = grunt.file.readJSON(filePath);
@ -63,7 +66,5 @@ module.exports = function(grunt) {
} else {
console.log('No updates for: ' + filePath);
}
});
};