mirror of
https://github.com/devbridge/jQuery-Autocomplete.git
synced 2024-11-25 14:17:45 +00:00
Rev for 1.2.11 release
This commit is contained in:
parent
cf80d8e67b
commit
f73c77905a
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "devbridge-autocomplete",
|
||||
"version": "1.2.10",
|
||||
"version": "1.2.11",
|
||||
"homepage": "https://github.com/devbridge/jQuery-Autocomplete",
|
||||
"authors": [
|
||||
"Tomas Kirda"
|
||||
|
7
dist/jquery.autocomplete.js
vendored
7
dist/jquery.autocomplete.js
vendored
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Ajax Autocomplete for jQuery, version 1.2.10
|
||||
* Ajax Autocomplete for jQuery, version 1.2.11
|
||||
* (c) 2014 Tomas Kirda
|
||||
*
|
||||
* Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license.
|
||||
@ -723,9 +723,10 @@
|
||||
},
|
||||
|
||||
validateOrientation: function(orientation, fallback) {
|
||||
orientation = orientation.trim().toLowerCase();
|
||||
if(['auto', 'bottom', 'top'].indexOf(orientation) == '-1')
|
||||
orientation = $.trim(orientation || '').toLowerCase();
|
||||
if($.inArray(orientation, ['auto', 'bottom', 'top']) === -1){
|
||||
orientation = fallback;
|
||||
}
|
||||
return orientation
|
||||
},
|
||||
|
||||
|
6
dist/jquery.autocomplete.min.js
vendored
6
dist/jquery.autocomplete.min.js
vendored
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Ajax Autocomplete for jQuery, version 1.2.10
|
||||
* Ajax Autocomplete for jQuery, version 1.2.11
|
||||
* (c) 2014 Tomas Kirda
|
||||
*
|
||||
* Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license.
|
||||
@ -24,8 +24,8 @@ c.currentRequest=d.ajax({url:f,data:h,type:e.type,dataType:e.dataType}).done(fun
|
||||
this.signalHint(null)},suggest:function(){if(0===this.suggestions.length)this.options.showNoSuggestionNotice?this.noSuggestions():this.hide();else{var a=this.options,b=a.formatResult,c=this.getQuery(this.currentValue),e=this.classes.suggestion,f=this.classes.selected,h=d(this.suggestionsContainer),g=d(this.noSuggestionsContainer),k=a.beforeRender,l="",m;if(a.triggerSelectOnValidInput&&(m=this.findSuggestionIndex(c),-1!==m)){this.select(m);return}d.each(this.suggestions,function(a,d){l+='<div class="'+
|
||||
e+'" data-index="'+a+'">'+b(d,c)+"</div>"});this.adjustContainerWidth();g.detach();h.html(l);a.autoSelectFirst&&(this.selectedIndex=0,h.children().first().addClass(f));d.isFunction(k)&&k.call(this.element,h);this.fixPosition();h.show();this.visible=!0;this.findBestHint()}},noSuggestions:function(){var a=d(this.suggestionsContainer),b=d(this.noSuggestionsContainer);this.adjustContainerWidth();b.detach();a.empty();a.append(b);this.fixPosition();a.show();this.visible=!0},adjustContainerWidth:function(){var a=
|
||||
this.options,b=d(this.suggestionsContainer);"auto"===a.width&&(a=this.el.outerWidth()-2,b.width(0<a?a:300))},findBestHint:function(){var a=this.el.val().toLowerCase(),b=null;a&&(d.each(this.suggestions,function(c,d){var f=0===d.value.toLowerCase().indexOf(a);f&&(b=d);return!f}),this.signalHint(b))},signalHint:function(a){var b="";a&&(b=this.currentValue+a.value.substr(this.currentValue.length));this.hintValue!==b&&(this.hintValue=b,this.hint=a,(this.options.onHint||d.noop)(b))},verifySuggestionsFormat:function(a){return a.length&&
|
||||
"string"===typeof a[0]?d.map(a,function(a){return{value:a,data:null}}):a},validateOrientation:function(a,b){a=a.trim().toLowerCase();"-1"==["auto","bottom","top"].indexOf(a)&&(a=b);return a},processResponse:function(a,b,c){var d=this.options;a.suggestions=this.verifySuggestionsFormat(a.suggestions);d.noCache||(this.cachedResponse[c]=a,d.preventBadQueries&&0===a.suggestions.length&&this.badQueries.push(b));b===this.getQuery(this.currentValue)&&(this.suggestions=a.suggestions,this.suggest())},activate:function(a){var b=
|
||||
this.classes.selected,c=d(this.suggestionsContainer),e=c.children();c.children("."+b).removeClass(b);this.selectedIndex=a;return-1!==this.selectedIndex&&e.length>this.selectedIndex?(a=e.get(this.selectedIndex),d(a).addClass(b),a):null},selectHint:function(){var a=d.inArray(this.hint,this.suggestions);this.select(a)},select:function(a){this.hide();this.onSelect(a)},moveUp:function(){-1!==this.selectedIndex&&(0===this.selectedIndex?(d(this.suggestionsContainer).children().first().removeClass(this.classes.selected),
|
||||
"string"===typeof a[0]?d.map(a,function(a){return{value:a,data:null}}):a},validateOrientation:function(a,b){a=d.trim(a||"").toLowerCase();-1===d.inArray(a,["auto","bottom","top"])&&(a=b);return a},processResponse:function(a,b,c){var d=this.options;a.suggestions=this.verifySuggestionsFormat(a.suggestions);d.noCache||(this.cachedResponse[c]=a,d.preventBadQueries&&0===a.suggestions.length&&this.badQueries.push(b));b===this.getQuery(this.currentValue)&&(this.suggestions=a.suggestions,this.suggest())},
|
||||
activate:function(a){var b=this.classes.selected,c=d(this.suggestionsContainer),e=c.children();c.children("."+b).removeClass(b);this.selectedIndex=a;return-1!==this.selectedIndex&&e.length>this.selectedIndex?(a=e.get(this.selectedIndex),d(a).addClass(b),a):null},selectHint:function(){var a=d.inArray(this.hint,this.suggestions);this.select(a)},select:function(a){this.hide();this.onSelect(a)},moveUp:function(){-1!==this.selectedIndex&&(0===this.selectedIndex?(d(this.suggestionsContainer).children().first().removeClass(this.classes.selected),
|
||||
this.selectedIndex=-1,this.el.val(this.currentValue),this.findBestHint()):this.adjustScroll(this.selectedIndex-1))},moveDown:function(){this.selectedIndex!==this.suggestions.length-1&&this.adjustScroll(this.selectedIndex+1)},adjustScroll:function(a){var b=this.activate(a),c,e;b&&(b=b.offsetTop,c=d(this.suggestionsContainer).scrollTop(),e=c+this.options.maxHeight-25,b<c?d(this.suggestionsContainer).scrollTop(b):b>e&&d(this.suggestionsContainer).scrollTop(b-this.options.maxHeight+25),this.el.val(this.getValue(this.suggestions[a].value)),
|
||||
this.signalHint(null))},onSelect:function(a){var b=this.options.onSelect;a=this.suggestions[a];this.currentValue=this.getValue(a.value);this.currentValue!==this.el.val()&&this.el.val(this.currentValue);this.signalHint(null);this.suggestions=[];this.selection=a;d.isFunction(b)&&b.call(this.element,a)},getValue:function(a){var b=this.options.delimiter,c;if(!b)return a;c=this.currentValue;b=c.split(b);return 1===b.length?a:c.substr(0,c.length-b[b.length-1].length)+a},dispose:function(){this.el.off(".autocomplete").removeData("autocomplete");
|
||||
this.disableKillerFn();d(window).off("resize.autocomplete",this.fixPositionCapture);d(this.suggestionsContainer).remove()}};d.fn.autocomplete=function(a,b){return 0===arguments.length?this.first().data("autocomplete"):this.each(function(){var c=d(this),e=c.data("autocomplete");if("string"===typeof a){if(e&&"function"===typeof e[a])e[a](b)}else e&&e.dispose&&e.dispose(),e=new k(this,a),c.data("autocomplete",e)})}});
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Ajax Autocomplete for jQuery, version 1.2.10
|
||||
* Ajax Autocomplete for jQuery, version 1.2.11
|
||||
* (c) 2014 Tomas Kirda
|
||||
*
|
||||
* Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license.
|
||||
|
Loading…
Reference in New Issue
Block a user