diff options
author | Reed Loden <reed@reedloden.com> | 2010-07-05 02:42:01 -0500 |
---|---|---|
committer | Reed Loden <reed@reedloden.com> | 2010-07-05 02:42:01 -0500 |
commit | bf3e63a75b8fbc9d613ec3fd6289a178731692e4 (patch) | |
tree | e2e063f03682f85368cb462d525b35e3114053db /js | |
parent | e598bc84cff9a281d312651332465c3899e3f49d (diff) | |
download | bugs-bf3e63a75b8fbc9d613ec3fd6289a178731692e4.tar bugs-bf3e63a75b8fbc9d613ec3fd6289a178731692e4.tar.gz bugs-bf3e63a75b8fbc9d613ec3fd6289a178731692e4.tar.bz2 bugs-bf3e63a75b8fbc9d613ec3fd6289a178731692e4.tar.xz bugs-bf3e63a75b8fbc9d613ec3fd6289a178731692e4.zip |
Bug 455810 - Add autocomplete support to the keywords field
* Special thanks to Guy Pyrzak for the original patch
[r=mkanat a=mkanat]
Diffstat (limited to 'js')
-rw-r--r-- | js/field.js | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/js/field.js b/js/field.js index 39b272f92..20485bcc8 100644 --- a/js/field.js +++ b/js/field.js @@ -16,6 +16,7 @@ * * Contributor(s): Max Kanat-Alexander <mkanat@bugzilla.org> * Guy Pyrzak <guy.pyrzak@gmail.com> + * Reed Loden <reed@reedloden.com> */ /* This library assumes that the needed YUI libraries have been loaded @@ -621,8 +622,8 @@ YAHOO.bugzilla.userAutocomplete = { 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.queryDelay = 0.05; + userAutoComp.useIFrame = true; userAutoComp.resultTypeList = false; if( multiple == true ){ userAutoComp.delimChar = [","," "]; @@ -631,3 +632,32 @@ YAHOO.bugzilla.userAutocomplete = { } }; +YAHOO.bugzilla.keywordAutocomplete = { + dataSource : null, + init_ds : function(){ + this.dataSource = new YAHOO.util.LocalDataSource( YAHOO.bugzilla.keyword_array ); + }, + init : function( field, container ) { + if( this.dataSource == null ){ + this.init_ds(); + } + var keywordAutoComp = new YAHOO.widget.AutoComplete(field, container, this.dataSource); + keywordAutoComp.maxResultsDisplayed = YAHOO.bugzilla.keyword_array.length; + keywordAutoComp.minQueryLength = 0; + keywordAutoComp.useIFrame = true; + keywordAutoComp.delimChar = [","," "]; + keywordAutoComp.resultTypeList = false; + keywordAutoComp.queryDelay = 0; + /* Causes all the possibilities in the keyword to appear when a user + * focuses on the textbox + */ + keywordAutoComp.textboxFocusEvent.subscribe( function(){ + var sInputValue = YAHOO.util.Dom.get('keywords').value; + if( sInputValue.length === 0 ){ + this.sendQuery(sInputValue); + this.collapseContainer(); + this.expandContainer(); + } + }); + } +}; |