|
@@ -788,13 +788,37 @@ function autocomplete()
|
|
$(this).attr('autocomplete', 'new-password');
|
|
$(this).attr('autocomplete', 'new-password');
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ $.widget( "custom.catcomplete", $.ui.autocomplete, {
|
|
|
|
+ _create: function() {
|
|
|
|
+ this._super();
|
|
|
|
+ this.widget().menu( "option", "items", "> :not(.ui-autocomplete-category)" );
|
|
|
|
+ },
|
|
|
|
+ _renderMenu: function( ul, items ) {
|
|
|
|
+ var that = this,
|
|
|
|
+ currentCategory = "";
|
|
|
|
+ $.each( items, function( index, item ) {
|
|
|
|
+ var li;
|
|
|
|
+ if ( item.category != currentCategory ) {
|
|
|
|
+ ul.append( "<li class='ui-autocomplete-category' style='font-weight: bold;padding: .2em .4em;margin: .8em 0 .2em;line-height: 1.5;'>" + item.category + "</li>" );
|
|
|
|
+ currentCategory = item.category;
|
|
|
|
+ }
|
|
|
|
+ li = that._renderItemData( ul, item );
|
|
|
|
+ if ( item.category ) {
|
|
|
|
+ li.attr( "aria-label", item.category + " : " + item.label );
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
if($("input[complete]").length)
|
|
if($("input[complete]").length)
|
|
{
|
|
{
|
|
$("input[complete]").each(function()
|
|
$("input[complete]").each(function()
|
|
{
|
|
{
|
|
var cache = {};
|
|
var cache = {};
|
|
var self = $(this);
|
|
var self = $(this);
|
|
- self.autocomplete(
|
|
|
|
|
|
+ //autocomplete
|
|
|
|
+ self.catcomplete(
|
|
{
|
|
{
|
|
minLength: 2,
|
|
minLength: 2,
|
|
source: function( request, response )
|
|
source: function( request, response )
|