2
0
mirror of https://github.com/devbridge/jQuery-Autocomplete.git synced 2024-12-23 03:18:55 +00:00

Rev for 1.2.15 release

This commit is contained in:
Tomas Kirda 2014-11-24 19:41:25 -06:00
parent 805b45ccb7
commit 2c6bb918f3
5 changed files with 22 additions and 16 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "devbridge-autocomplete", "name": "devbridge-autocomplete",
"version": "1.2.14", "version": "1.2.15",
"homepage": "https://github.com/devbridge/jQuery-Autocomplete", "homepage": "https://github.com/devbridge/jQuery-Autocomplete",
"authors": [ "authors": [
"Tomas Kirda" "Tomas Kirda"

View File

@ -6,7 +6,7 @@
"ajax", "ajax",
"autocomplete" "autocomplete"
], ],
"version": "1.2.14", "version": "1.2.15",
"author": { "author": {
"name": "Tomas Kirda", "name": "Tomas Kirda",
"url": "https://github.com/tkirda" "url": "https://github.com/tkirda"

View File

@ -1,13 +1,13 @@
/** /**
* Ajax Autocomplete for jQuery, version 1.2.14 * Ajax Autocomplete for jQuery, version 1.2.15
* (c) 2014 Tomas Kirda * (c) 2014 Tomas Kirda
* *
* Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license. * Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license.
* For details, see the web site: https://github.com/devbridge/jQuery-Autocomplete * For details, see the web site: https://github.com/devbridge/jQuery-Autocomplete
*/ */
/*jslint browser: true, white: true, plusplus: true */ /*jslint browser: true, white: true, plusplus: true, vars: true */
/*global define, window, document, jQuery, exports */ /*global define, window, document, jQuery, exports, require */
// Expose plugin as an AMD module if AMD loader is present: // Expose plugin as an AMD module if AMD loader is present:
(function (factory) { (function (factory) {
@ -265,8 +265,9 @@
containerParent = $container.parent().get(0); containerParent = $container.parent().get(0);
// Fix position automatically when appended to body. // Fix position automatically when appended to body.
// In other cases force parameter must be given. // In other cases force parameter must be given.
if (containerParent !== document.body && !that.options.forceFixPosition) if (containerParent !== document.body && !that.options.forceFixPosition) {
return; return;
}
// Choose orientation // Choose orientation
var orientation = that.options.orientation, var orientation = that.options.orientation,
@ -275,7 +276,7 @@
offset = that.el.offset(), offset = that.el.offset(),
styles = { 'top': offset.top, 'left': offset.left }; styles = { 'top': offset.top, 'left': offset.left };
if (orientation == 'auto') { if (orientation === 'auto') {
var viewPortHeight = $(window).height(), var viewPortHeight = $(window).height(),
scrollTop = $(window).scrollTop(), scrollTop = $(window).scrollTop(),
topOverflow = -scrollTop + offset.top - containerHeight, topOverflow = -scrollTop + offset.top - containerHeight,
@ -386,16 +387,21 @@
that.selectHint(); that.selectHint();
return; return;
} }
/* falls through */ if (that.selectedIndex === -1) {
that.hide();
return;
}
that.select(that.selectedIndex);
if (that.options.tabDisabled === false) {
return;
}
break;
case keys.RETURN: case keys.RETURN:
if (that.selectedIndex === -1) { if (that.selectedIndex === -1) {
that.hide(); that.hide();
return; return;
} }
that.select(that.selectedIndex); that.select(that.selectedIndex);
if (e.which === keys.TAB && that.options.tabDisabled === false) {
return;
}
break; break;
case keys.UP: case keys.UP:
that.moveUp(); that.moveUp();
@ -535,8 +541,8 @@
return; return;
} }
if ($.isFunction(that.lookup)){ if ($.isFunction(options.lookup)){
that.lookup(q, function (data) { options.lookup(q, function (data) {
that.suggestions = data.suggestions; that.suggestions = data.suggestions;
that.suggest(); that.suggest();
options.onSearchComplete.call(that.element, q, data.suggestions); options.onSearchComplete.call(that.element, q, data.suggestions);

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "devbridge-autocomplete", "name": "devbridge-autocomplete",
"version": "1.2.14", "version": "1.2.15",
"description": "Autocomplete provides suggestions while you type into the text field.", "description": "Autocomplete provides suggestions while you type into the text field.",
"homepage": "https://github.com/devbridge/jQuery-Autocomplete", "homepage": "https://github.com/devbridge/jQuery-Autocomplete",
"author": "Tomas Kirda (https://twitter.com/tkirda)", "author": "Tomas Kirda (https://twitter.com/tkirda)",