summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorByron Jones <glob@mozilla.com>2015-05-07 06:49:01 +0200
committerByron Jones <glob@mozilla.com>2015-05-07 06:49:01 +0200
commit33a4bd46fd17ab28567cdeb2eb3733901f2a033e (patch)
tree2639f65e1e408482b8e1b65f73c2245ae58617ba /js
parent7a75256f5daa3b81bea0c6d47b53d2409568d7fa (diff)
downloadbugzilla-33a4bd46fd17ab28567cdeb2eb3733901f2a033e.tar.gz
bugzilla-33a4bd46fd17ab28567cdeb2eb3733901f2a033e.tar.xz
Bug 1159589: migrate autocomplete from yui to jquery
r=dylan,a=glob
Diffstat (limited to 'js')
-rw-r--r--js/comment-tagging.js55
-rw-r--r--js/field.js188
-rw-r--r--js/jquery/plugins/devbridgeAutocomplete/devbridgeAutocomplete-min.js8
-rw-r--r--js/jquery/plugins/devbridgeAutocomplete/license.txt21
4 files changed, 133 insertions, 139 deletions
diff --git a/js/comment-tagging.js b/js/comment-tagging.js
index ff0f13336..f3ec33788 100644
--- a/js/comment-tagging.js
+++ b/js/comment-tagging.js
@@ -34,40 +34,27 @@ YAHOO.bugzilla.commentTagging = {
});
if (!can_edit) return;
- var ds = new YAHOO.util.XHRDataSource("jsonrpc.cgi");
- ds.connTimeout = 30000;
- ds.connMethodPost = true;
- ds.connXhrMode = "cancelStaleRequests";
- ds.maxCacheEntries = 5;
- ds.responseSchema = {
- metaFields : { error: "error", jsonRpcId: "id"},
- resultsList : "result"
- };
-
- var ac = new YAHOO.widget.AutoComplete('bz_ctag_add', 'bz_ctag_autocomp', ds);
- ac.maxResultsDisplayed = 7;
- ac.generateRequest = function(query) {
- query = YAHOO.lang.trim(query);
- YAHOO.bugzilla.commentTagging.last_query = query;
- YAHOO.bugzilla.commentTagging.counter = YAHOO.bugzilla.commentTagging.counter + 1;
- YAHOO.util.Connect.setDefaultPostHeader('application/json', true);
- return YAHOO.lang.JSON.stringify({
- version: "1.1",
- method : "Bug.search_comment_tags",
- id : YAHOO.bugzilla.commentTagging.counter,
- params : {
- Bugzilla_api_token: BUGZILLA.api_token,
- query : query,
- limit : 10
- }
- });
- };
- ac.minQueryLength = this.min_len;
- ac.autoHighlight = false;
- ac.typeAhead = true;
- ac.queryDelay = 0.5;
- ac.dataReturnEvent.subscribe(function(type, args) {
- args[0].autoHighlight = args[2].length == 1;
+ $('#bz_ctag_add').devbridgeAutocomplete({
+ serviceUrl: function(query) {
+ return 'rest/bug/comment/tags/' + encodeURIComponent(query);
+ },
+ params: {
+ Bugzilla_api_token: BUGZILLA.api_token
+ },
+ deferRequestBy: 250,
+ minChars: 1,
+ tabDisabled: true,
+ transformResult: function(response) {
+ response = $.parseJSON(response);
+ return {
+ suggestions: $.map(response, function(dataItem) {
+ return {
+ value: dataItem,
+ data : null
+ };
+ })
+ };
+ }
});
},
diff --git a/js/field.js b/js/field.js
index 167ab492f..f55852671 100644
--- a/js/field.js
+++ b/js/field.js
@@ -805,117 +805,95 @@ function browserCanHideOptions(aSelect) {
/* (end) option hiding code */
/**
- * The Autoselect
+ * Autocompletion
*/
-YAHOO.bugzilla.userAutocomplete = {
- counter : 0,
- dataSource : null,
- generateRequest : function ( enteredText ){
- YAHOO.bugzilla.userAutocomplete.counter =
- YAHOO.bugzilla.userAutocomplete.counter + 1;
- YAHOO.util.Connect.setDefaultPostHeader('application/json', true);
- var json_object = {
- method : "User.get",
- id : YAHOO.bugzilla.userAutocomplete.counter,
- params : [ {
+
+$(function() {
+
+ // single user
+
+ function searchComplete() {
+ var that = $(this);
+ that.data('counter', that.data('counter') - 1);
+ if (that.data('counter') === 0)
+ that.removeClass('autocomplete-running');
+ if (document.activeElement != this)
+ that.autocomplete('hide');
+ };
+
+ var options_user = {
+ serviceUrl: 'rest/user',
+ params: {
Bugzilla_api_token: BUGZILLA.api_token,
- match : [ decodeURIComponent(enteredText) ],
- include_fields : [ "name", "real_name" ]
- } ]
- };
- var stringified = YAHOO.lang.JSON.stringify(json_object);
- var debug = { msg: "json-rpc obj debug info", "json obj": json_object,
- "param" : stringified}
- YAHOO.bugzilla.userAutocomplete.debug_helper( debug );
- return stringified;
- },
- resultListFormat : function(oResultData, enteredText, sResultMatch) {
- return ( YAHOO.lang.escapeHTML(oResultData.real_name) + " ("
- + YAHOO.lang.escapeHTML(oResultData.name) + ")");
- },
- debug_helper : function ( ){
- /* used to help debug any errors that might happen */
- if( typeof(console) !== 'undefined' && console != null && arguments.length > 0 ){
- console.log("debug helper info:", arguments);
- }
- return true;
- },
- init_ds : function(){
- this.dataSource = new YAHOO.util.XHRDataSource("jsonrpc.cgi");
- this.dataSource.connTimeout = 30000;
- this.dataSource.connMethodPost = true;
- this.dataSource.connXhrMode = "cancelStaleRequests";
- this.dataSource.maxCacheEntries = 5;
- this.dataSource.responseSchema = {
- resultsList : "result.users",
- metaFields : { error: "error", jsonRpcId: "id"},
- fields : [
- { key : "name" },
- { key : "real_name"}
- ]
- };
- },
- init : function( field, container, multiple ) {
- if( this.dataSource == null ){
- this.init_ds();
- }
- var userAutoComp = new YAHOO.widget.AutoComplete( field, container,
- this.dataSource );
- // other stuff we might want to do with the autocomplete goes here
- userAutoComp.maxResultsDisplayed = BUGZILLA.param.maxusermatches;
- userAutoComp.generateRequest = this.generateRequest;
- userAutoComp.formatResult = this.resultListFormat;
- userAutoComp.doBeforeLoadData = this.debug_helper;
- userAutoComp.minQueryLength = 3;
- userAutoComp.autoHighlight = false;
- // this is a throttle to determine the delay of the query from typing
- // set this higher to cause fewer calls to the server
- userAutoComp.queryDelay = 0.05;
- userAutoComp.useIFrame = true;
- userAutoComp.resultTypeList = false;
- if( multiple == true ){
- userAutoComp.delimChar = [","];
- }
-
- }
-};
+ include_fields: 'name,real_name',
+ limit: 100
+ },
+ paramName: 'match',
+ deferRequestBy: 250,
+ minChars: 3,
+ tabDisabled: true,
+ transformResult: function(response) {
+ response = $.parseJSON(response);
+ return {
+ suggestions: $.map(response.users, function(dataItem) {
+ return {
+ value: dataItem.name,
+ data : { login: dataItem.name, name: dataItem.real_name }
+ };
+ })
+ };
+ },
+ formatResult: function(suggestion, currentValue) {
+ return suggestion.data.name === '' ?
+ suggestion.data.login : suggestion.data.name + ' (' + suggestion.data.login + ')';
+ },
+ onSearchStart: function(params) {
+ var that = $(this);
+ params.match = $.trim(params.match);
+ that.addClass('autocomplete-running');
+ that.data('counter', that.data('counter') + 1);
+ },
+ onSearchComplete: searchComplete,
+ onSearchError: searchComplete
+ };
-YAHOO.bugzilla.fieldAutocomplete = {
- dataSource : [],
- init_ds : function( field ) {
- this.dataSource[field] =
- new YAHOO.util.LocalDataSource( YAHOO.bugzilla.field_array[field] );
- },
- init : function( field, container ) {
- if( this.dataSource[field] == null ) {
- this.init_ds( field );
- }
- var fieldAutoComp =
- new YAHOO.widget.AutoComplete(field, container, this.dataSource[field]);
- fieldAutoComp.maxResultsDisplayed = YAHOO.bugzilla.field_array[field].length;
- fieldAutoComp.formatResult = fieldAutoComp.formatEscapedResult;
- fieldAutoComp.minQueryLength = 0;
- fieldAutoComp.useIFrame = true;
- fieldAutoComp.delimChar = [","," "];
- fieldAutoComp.resultTypeList = false;
- fieldAutoComp.queryDelay = 0;
- /* Causes all the possibilities in the field to appear when a user
- * focuses on the textbox
- */
- fieldAutoComp.textboxFocusEvent.subscribe( function(){
- var sInputValue = YAHOO.util.Dom.get(field).value;
- if( sInputValue.length === 0
- && YAHOO.bugzilla.field_array[field].length > 0 ){
- this.sendQuery(sInputValue);
- this.collapseContainer();
- this.expandContainer();
+ // multiple users (based on single user)
+ var options_users = {
+ delimiter: /,\s*/,
+ onSelect: function() {
+ this.focus();
+ },
+ };
+ $.extend(options_users, options_user);
+
+ // init user autocomplete fields
+ $('.bz_autocomplete_user')
+ .each(function() {
+ var that = $(this);
+ that.data('counter', 0);
+ if (that.data('multiple')) {
+ that.devbridgeAutocomplete(options_users);
+ }
+ else {
+ that.devbridgeAutocomplete(options_user);
}
});
- fieldAutoComp.dataRequestEvent.subscribe( function(type, args) {
- args[0].autoHighlight = args[1] != '';
+
+ // init autocomplete fields with array of values
+ $('.bz_autocomplete_values')
+ .each(function() {
+ var that = $(this);
+ that.devbridgeAutocomplete({
+ lookup: BUGZILLA.autocomplete_values[that.data('values')],
+ tabDisabled: true,
+ delimiter: /,\s*/,
+ minChars: 0,
+ onSelect: function() {
+ this.focus();
+ }
+ });
});
- }
-};
+});
/**
* Set the disable email checkbox to true if the user has disabled text
diff --git a/js/jquery/plugins/devbridgeAutocomplete/devbridgeAutocomplete-min.js b/js/jquery/plugins/devbridgeAutocomplete/devbridgeAutocomplete-min.js
new file mode 100644
index 000000000..01623ab8c
--- /dev/null
+++ b/js/jquery/plugins/devbridgeAutocomplete/devbridgeAutocomplete-min.js
@@ -0,0 +1,8 @@
+/**
+* Ajax Autocomplete for jQuery, version 1.2.18
+* (c) 2014 Tomas Kirda
+*
+* 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
+*/
+!function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports&&"function"==typeof require?require("jquery"):jQuery)}(function(a){"use strict";function b(c,d){var e=function(){},f=this,g={ajaxSettings:{},autoSelectFirst:!1,appendTo:document.body,serviceUrl:null,lookup:null,onSelect:null,width:"auto",minChars:1,maxHeight:300,deferRequestBy:0,params:{},formatResult:b.formatResult,delimiter:null,zIndex:9999,type:"GET",noCache:!1,onSearchStart:e,onSearchComplete:e,onSearchError:e,preserveInput:!1,containerClass:"autocomplete-suggestions",tabDisabled:!1,dataType:"text",currentRequest:null,triggerSelectOnValidInput:!0,preventBadQueries:!0,lookupFilter:function(a,b,c){return-1!==a.value.toLowerCase().indexOf(c)},paramName:"query",transformResult:function(b){return"string"==typeof b?a.parseJSON(b):b},showNoSuggestionNotice:!1,noSuggestionNotice:"No results",orientation:"bottom",forceFixPosition:!1};f.element=c,f.el=a(c),f.suggestions=[],f.badQueries=[],f.selectedIndex=-1,f.currentValue=f.element.value,f.intervalId=0,f.cachedResponse={},f.onChangeInterval=null,f.onChange=null,f.isLocal=!1,f.suggestionsContainer=null,f.noSuggestionsContainer=null,f.options=a.extend({},g,d),f.classes={selected:"autocomplete-selected",suggestion:"autocomplete-suggestion"},f.hint=null,f.hintValue="",f.selection=null,f.initialize(),f.setOptions(d)}var c=function(){return{escapeRegExChars:function(a){return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},createNode:function(a){var b=document.createElement("div");return b.className=a,b.style.position="absolute",b.style.display="none",b}}}(),d={ESC:27,TAB:9,RETURN:13,LEFT:37,UP:38,RIGHT:39,DOWN:40};b.utils=c,a.Autocomplete=b,b.formatResult=function(a,b){var d="("+c.escapeRegExChars(b)+")";return a.value.replace(new RegExp(d,"gi"),"<strong>$1</strong>")},b.prototype={killerFn:null,initialize:function(){var c,d=this,e="."+d.classes.suggestion,f=d.classes.selected,g=d.options;d.element.setAttribute("autocomplete","off"),d.killerFn=function(b){0===a(b.target).closest("."+d.options.containerClass).length&&(d.killSuggestions(),d.disableKillerFn())},d.noSuggestionsContainer=a('<div class="autocomplete-no-suggestion"></div>').html(this.options.noSuggestionNotice).get(0),d.suggestionsContainer=b.utils.createNode(g.containerClass),c=a(d.suggestionsContainer),c.appendTo(g.appendTo),"auto"!==g.width&&c.width(g.width),c.on("mouseover.autocomplete",e,function(){d.activate(a(this).data("index"))}),c.on("mouseout.autocomplete",function(){d.selectedIndex=-1,c.children("."+f).removeClass(f)}),c.on("click.autocomplete",e,function(){d.select(a(this).data("index"))}),d.fixPositionCapture=function(){d.visible&&d.fixPosition()},a(window).on("resize.autocomplete",d.fixPositionCapture),d.el.on("keydown.autocomplete",function(a){d.onKeyPress(a)}),d.el.on("keyup.autocomplete",function(a){d.onKeyUp(a)}),d.el.on("blur.autocomplete",function(){d.onBlur()}),d.el.on("focus.autocomplete",function(){d.onFocus()}),d.el.on("change.autocomplete",function(a){d.onKeyUp(a)}),d.el.on("input.autocomplete",function(a){d.onKeyUp(a)})},onFocus:function(){var a=this;a.fixPosition(),a.options.minChars<=a.el.val().length&&a.onValueChange()},onBlur:function(){this.enableKillerFn()},setOptions:function(b){var c=this,d=c.options;a.extend(d,b),c.isLocal=a.isArray(d.lookup),c.isLocal&&(d.lookup=c.verifySuggestionsFormat(d.lookup)),d.orientation=c.validateOrientation(d.orientation,"bottom"),a(c.suggestionsContainer).css({"max-height":d.maxHeight+"px",width:d.width+"px","z-index":d.zIndex})},clearCache:function(){this.cachedResponse={},this.badQueries=[]},clear:function(){this.clearCache(),this.currentValue="",this.suggestions=[]},disable:function(){var a=this;a.disabled=!0,clearInterval(a.onChangeInterval),a.currentRequest&&a.currentRequest.abort()},enable:function(){this.disabled=!1},fixPosition:function(){var b=this,c=a(b.suggestionsContainer),d=c.parent().get(0);if(d===document.body||b.options.forceFixPosition){var e=b.options.orientation,f=c.outerHeight(),g=b.el.outerHeight(),h=b.el.offset(),i={top:h.top,left:h.left};if("auto"===e){var j=a(window).height(),k=a(window).scrollTop(),l=-k+h.top-f,m=k+j-(h.top+g+f);e=Math.max(l,m)===l?"top":"bottom"}if(i.top+="top"===e?-f:g,d!==document.body){var n,o=c.css("opacity");b.visible||c.css("opacity",0).show(),n=c.offsetParent().offset(),i.top-=n.top,i.left-=n.left,b.visible||c.css("opacity",o).hide()}"auto"===b.options.width&&(i.width=b.el.outerWidth()-2+"px"),c.css(i)}},enableKillerFn:function(){var b=this;a(document).on("click.autocomplete",b.killerFn)},disableKillerFn:function(){var b=this;a(document).off("click.autocomplete",b.killerFn)},killSuggestions:function(){var a=this;a.stopKillSuggestions(),a.intervalId=window.setInterval(function(){a.hide(),a.stopKillSuggestions()},50)},stopKillSuggestions:function(){window.clearInterval(this.intervalId)},isCursorAtEnd:function(){var a,b=this,c=b.el.val().length,d=b.element.selectionStart;return"number"==typeof d?d===c:document.selection?(a=document.selection.createRange(),a.moveStart("character",-c),c===a.text.length):!0},onKeyPress:function(a){var b=this;if(!b.disabled&&!b.visible&&a.which===d.DOWN&&b.currentValue)return void b.suggest();if(!b.disabled&&b.visible){switch(a.which){case d.ESC:b.el.val(b.currentValue),b.hide();break;case d.RIGHT:if(b.hint&&b.options.onHint&&b.isCursorAtEnd()){b.selectHint();break}return;case d.TAB:if(b.hint&&b.options.onHint)return void b.selectHint();if(-1===b.selectedIndex)return void b.hide();if(b.select(b.selectedIndex),b.options.tabDisabled===!1)return;break;case d.RETURN:if(-1===b.selectedIndex)return void b.hide();b.select(b.selectedIndex);break;case d.UP:b.moveUp();break;case d.DOWN:b.moveDown();break;default:return}a.stopImmediatePropagation(),a.preventDefault()}},onKeyUp:function(a){var b=this;if(!b.disabled){switch(a.which){case d.UP:case d.DOWN:return}clearInterval(b.onChangeInterval),b.currentValue!==b.el.val()&&(b.findBestHint(),b.options.deferRequestBy>0?b.onChangeInterval=setInterval(function(){b.onValueChange()},b.options.deferRequestBy):b.onValueChange())}},onValueChange:function(){var b,c=this,d=c.options,e=c.el.val(),f=c.getQuery(e);return c.selection&&c.currentValue!==f&&(c.selection=null,(d.onInvalidateSelection||a.noop).call(c.element)),clearInterval(c.onChangeInterval),c.currentValue=e,c.selectedIndex=-1,d.triggerSelectOnValidInput&&(b=c.findSuggestionIndex(f),-1!==b)?void c.select(b):void(f.length<d.minChars?c.hide():c.getSuggestions(f))},findSuggestionIndex:function(b){var c=this,d=-1,e=b.toLowerCase();return a.each(c.suggestions,function(a,b){return b.value.toLowerCase()===e?(d=a,!1):void 0}),d},getQuery:function(b){var c,d=this.options.delimiter;return d?(c=b.split(d),a.trim(c[c.length-1])):b},getSuggestionsLocal:function(b){var c,d=this,e=d.options,f=b.toLowerCase(),g=e.lookupFilter,h=parseInt(e.lookupLimit,10);return c={suggestions:a.grep(e.lookup,function(a){return g(a,b,f)})},h&&c.suggestions.length>h&&(c.suggestions=c.suggestions.slice(0,h)),c},getSuggestions:function(b){var c,d,e,f,g=this,h=g.options,i=h.serviceUrl;if(h.params[h.paramName]=b,d=h.ignoreParams?null:h.params,h.onSearchStart.call(g.element,h.params)!==!1){if(a.isFunction(h.lookup))return void h.lookup(b,function(a){g.suggestions=a.suggestions,g.suggest(),h.onSearchComplete.call(g.element,b,a.suggestions)});g.isLocal?c=g.getSuggestionsLocal(b):(a.isFunction(i)&&(i=i.call(g.element,b)),e=i+"?"+a.param(d||{}),c=g.cachedResponse[e]),c&&a.isArray(c.suggestions)?(g.suggestions=c.suggestions,g.suggest(),h.onSearchComplete.call(g.element,b,c.suggestions)):g.isBadQuery(b)?h.onSearchComplete.call(g.element,b,[]):(g.currentRequest&&g.currentRequest.abort(),f={url:i,data:d,type:h.type,dataType:h.dataType},a.extend(f,h.ajaxSettings),g.currentRequest=a.ajax(f).done(function(a){var c;g.currentRequest=null,c=h.transformResult(a),g.processResponse(c,b,e),h.onSearchComplete.call(g.element,b,c.suggestions)}).fail(function(a,c,d){h.onSearchError.call(g.element,b,a,c,d)}))}},isBadQuery:function(a){if(!this.options.preventBadQueries)return!1;for(var b=this.badQueries,c=b.length;c--;)if(0===a.indexOf(b[c]))return!0;return!1},hide:function(){var b=this,c=a(b.suggestionsContainer);a.isFunction(b.options.onHide)&&b.visible&&b.options.onHide.call(b.element,c),b.visible=!1,b.selectedIndex=-1,clearInterval(b.onChangeInterval),a(b.suggestionsContainer).hide(),b.signalHint(null)},suggest:function(){if(0===this.suggestions.length)return void(this.options.showNoSuggestionNotice?this.noSuggestions():this.hide());var b,c,d=this,e=d.options,f=e.groupBy,g=e.formatResult,h=d.getQuery(d.currentValue),i=d.classes.suggestion,j=d.classes.selected,k=a(d.suggestionsContainer),l=a(d.noSuggestionsContainer),m=e.beforeRender,n="",o=function(a){var c=a.data[f];return b===c?"":(b=c,'<div class="autocomplete-group"><strong>'+b+"</strong></div>")};return e.triggerSelectOnValidInput&&(c=d.findSuggestionIndex(h),-1!==c)?void d.select(c):(a.each(d.suggestions,function(a,b){f&&(n+=o(b,h,a)),n+='<div class="'+i+'" data-index="'+a+'">'+g(b,h)+"</div>"}),this.adjustContainerWidth(),l.detach(),k.html(n),a.isFunction(m)&&m.call(d.element,k),d.fixPosition(),k.show(),e.autoSelectFirst&&(d.selectedIndex=0,k.scrollTop(0),k.children("."+i).first().addClass(j)),d.visible=!0,void d.findBestHint())},noSuggestions:function(){var b=this,c=a(b.suggestionsContainer),d=a(b.noSuggestionsContainer);this.adjustContainerWidth(),d.detach(),c.empty(),c.append(d),b.fixPosition(),c.show(),b.visible=!0},adjustContainerWidth:function(){var b,c=this,d=c.options,e=a(c.suggestionsContainer);"auto"===d.width&&(b=c.el.outerWidth()-2,e.width(b>0?b:300))},findBestHint:function(){var b=this,c=b.el.val().toLowerCase(),d=null;c&&(a.each(b.suggestions,function(a,b){var e=0===b.value.toLowerCase().indexOf(c);return e&&(d=b),!e}),b.signalHint(d))},signalHint:function(b){var c="",d=this;b&&(c=d.currentValue+b.value.substr(d.currentValue.length)),d.hintValue!==c&&(d.hintValue=c,d.hint=b,(this.options.onHint||a.noop)(c))},verifySuggestionsFormat:function(b){return b.length&&"string"==typeof b[0]?a.map(b,function(a){return{value:a,data:null}}):b},validateOrientation:function(b,c){return b=a.trim(b||"").toLowerCase(),-1===a.inArray(b,["auto","bottom","top"])&&(b=c),b},processResponse:function(a,b,c){var d=this,e=d.options;a.suggestions=d.verifySuggestionsFormat(a.suggestions),e.noCache||(d.cachedResponse[c]=a,e.preventBadQueries&&0===a.suggestions.length&&d.badQueries.push(b)),b===d.getQuery(d.currentValue)&&(d.suggestions=a.suggestions,d.suggest())},activate:function(b){var c,d=this,e=d.classes.selected,f=a(d.suggestionsContainer),g=f.find("."+d.classes.suggestion);return f.find("."+e).removeClass(e),d.selectedIndex=b,-1!==d.selectedIndex&&g.length>d.selectedIndex?(c=g.get(d.selectedIndex),a(c).addClass(e),c):null},selectHint:function(){var b=this,c=a.inArray(b.hint,b.suggestions);b.select(c)},select:function(a){var b=this;b.hide(),b.onSelect(a)},moveUp:function(){var b=this;if(-1!==b.selectedIndex)return 0===b.selectedIndex?(a(b.suggestionsContainer).children().first().removeClass(b.classes.selected),b.selectedIndex=-1,b.el.val(b.currentValue),void b.findBestHint()):void b.adjustScroll(b.selectedIndex-1)},moveDown:function(){var a=this;a.selectedIndex!==a.suggestions.length-1&&a.adjustScroll(a.selectedIndex+1)},adjustScroll:function(b){var c=this,d=c.activate(b);if(d){var e,f,g,h=a(d).outerHeight();e=d.offsetTop,f=a(c.suggestionsContainer).scrollTop(),g=f+c.options.maxHeight-h,f>e?a(c.suggestionsContainer).scrollTop(e):e>g&&a(c.suggestionsContainer).scrollTop(e-c.options.maxHeight+h),c.options.preserveInput||c.el.val(c.getValue(c.suggestions[b].value)),c.signalHint(null)}},onSelect:function(b){var c=this,d=c.options.onSelect,e=c.suggestions[b];c.currentValue=c.getValue(e.value),c.currentValue===c.el.val()||c.options.preserveInput||c.el.val(c.currentValue),c.signalHint(null),c.suggestions=[],c.selection=e,a.isFunction(d)&&d.call(c.element,e)},getValue:function(a){var b,c,d=this,e=d.options.delimiter;return e?(b=d.currentValue,c=b.split(e),1===c.length?a:b.substr(0,b.length-c[c.length-1].length)+a):a},dispose:function(){var b=this;b.el.off(".autocomplete").removeData("autocomplete"),b.disableKillerFn(),a(window).off("resize.autocomplete",b.fixPositionCapture),a(b.suggestionsContainer).remove()}},a.fn.autocomplete=a.fn.devbridgeAutocomplete=function(c,d){var e="autocomplete";return 0===arguments.length?this.first().data(e):this.each(function(){var f=a(this),g=f.data(e);"string"==typeof c?g&&"function"==typeof g[c]&&g[c](d):(g&&g.dispose&&g.dispose(),g=new b(this,c),f.data(e,g))})}}); \ No newline at end of file
diff --git a/js/jquery/plugins/devbridgeAutocomplete/license.txt b/js/jquery/plugins/devbridgeAutocomplete/license.txt
new file mode 100644
index 000000000..11b3ff11a
--- /dev/null
+++ b/js/jquery/plugins/devbridgeAutocomplete/license.txt
@@ -0,0 +1,21 @@
+Copyright 2012 DevBridge and other contributors
+http://www.devbridge.com/projects/autocomplete/jquery/
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.