mirror of
https://github.com/devbridge/jQuery-Autocomplete.git
synced 2024-11-25 22:27:39 +00:00
Fix spacing and jslint code
This commit is contained in:
parent
b31504a027
commit
b4de69f24f
@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Ajax Autocomplete for jQuery, version 1.1.5
|
||||
* (c) 2010 Tomas Kirda, Vytautas Pranskunas
|
||||
* (c) 2012 Tomas Kirda, Vytautas Pranskunas
|
||||
*
|
||||
* Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license.
|
||||
* For details, see the web site: http://www.devbridge.com/projects/autocomplete/jquery/
|
||||
@ -8,10 +8,11 @@
|
||||
* Last Review: 07/24/2012
|
||||
*/
|
||||
|
||||
/*jslint onevar: true, evil: true, nomen: true, eqeqeq: true, bitwise: true, regexp: true, newcap: true, immed: true */
|
||||
/*jslint browser: true, white: true, plusplus: true */
|
||||
/*global window: true, document: true, clearInterval: true, setInterval: true, jQuery: true */
|
||||
|
||||
(function ($) {
|
||||
'use strict';
|
||||
|
||||
var reEscape = new RegExp('(\\' + ['/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\'].join('|\\') + ')', 'g');
|
||||
|
||||
@ -56,9 +57,9 @@
|
||||
|
||||
var autocompleteControl;
|
||||
|
||||
if (typeof options == 'string') {
|
||||
if (typeof options === 'string') {
|
||||
autocompleteControl = this.data('autocomplete');
|
||||
if (typeof autocompleteControl[options] == 'function') {
|
||||
if (typeof autocompleteControl[options] === 'function') {
|
||||
autocompleteControl[options](optionName);
|
||||
}
|
||||
} else {
|
||||
@ -307,6 +308,7 @@
|
||||
},
|
||||
|
||||
processResponse: function (text) {
|
||||
/*jslint evil: true */
|
||||
var response;
|
||||
try {
|
||||
response = eval('(' + text + ')');
|
||||
@ -330,12 +332,16 @@
|
||||
if (this.selectedIndex !== -1 && divs.length > this.selectedIndex) {
|
||||
$(divs.get(this.selectedIndex)).removeClass();
|
||||
}
|
||||
|
||||
this.selectedIndex = index;
|
||||
|
||||
if (this.selectedIndex !== -1 && divs.length > this.selectedIndex) {
|
||||
activeItem = divs.get(this.selectedIndex);
|
||||
$(activeItem).addClass('selected');
|
||||
}
|
||||
return activeItem;
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
|
||||
deactivate: function (div, index) {
|
||||
@ -359,11 +365,10 @@
|
||||
},
|
||||
|
||||
change: function (i) {
|
||||
var selectedValue, fn, me;
|
||||
var selectedValue, fn, me, s, d;
|
||||
me = this;
|
||||
selectedValue = this.suggestions[i];
|
||||
if (selectedValue) {
|
||||
var s, d;
|
||||
s = me.suggestions[i];
|
||||
d = me.data[i];
|
||||
me.el.val(me.getValue(s));
|
||||
@ -427,7 +432,6 @@
|
||||
if (arr.length === 1) { return value; }
|
||||
return currVal.substr(0, currVal.length - arr[arr.length - 1].length) + value;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}(jQuery));
|
||||
|
Loading…
Reference in New Issue
Block a user