Sha256: 44f200a760c0ca8eccf83d82c25cb1b4d7d2358525ba6ff649f28e4518b1db91

Contents?: true

Size: 1.25 KB

Versions: 12

Compression:

Stored size: 1.25 KB

Contents

/*
 * jQuery UI Autocomplete HTML Extension
 *
 * Copyright 2010, Scott González (http://scottgonzalez.com)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 *
 * http://github.com/scottgonzalez/jquery-ui-extensions
 */
(function( $ ) {

    var proto = $.ui.autocomplete.prototype,
        initSource = proto._initSource;

    function filter( array, term ) {
        var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" );
        return $.grep( array, function(value) {
            return matcher.test( $( "<div>" ).html( value.label || value.value || value ).text() );
        });
    }

    $.extend( proto, {
        _initSource: function() {
            if ( this.options.html && $.isArray(this.options.source) ) {
                this.source = function( request, response ) {
                    response( filter( this.options.source, request.term ) );
                };
            } else {
                initSource.call( this );
            }
        },

        _renderItem: function( ul, item) {
            return $( "<li></li>" )
                .data( "item.autocomplete", item )
                .append( $( "<a></a>" )[ this.options.html ? "html" : "text" ]( item.label ) )
                .appendTo( ul );
        }
    });

})( jQuery );

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
card-mod-format-0.18.1 assets/script/jquery/jquery.ui.autocomplete.html.js
card-mod-format-0.18.0 assets/script/jquery/jquery.ui.autocomplete.html.js
card-mod-format-0.17.0 assets/script/jquery/jquery.ui.autocomplete.html.js
card-mod-format-0.16.0 assets/script/jquery/jquery.ui.autocomplete.html.js
card-mod-format-0.15.6 assets/script/jquery/jquery.ui.autocomplete.html.js
card-mod-format-0.15.5 assets/script/jquery/jquery.ui.autocomplete.html.js
card-mod-format-0.15.4 assets/script/jquery/jquery.ui.autocomplete.html.js
card-mod-format-0.15.3 assets/script/jquery/jquery.ui.autocomplete.html.js
card-mod-format-0.15.2.pre1 assets/script/jquery/jquery.ui.autocomplete.html.js
card-mod-format-0.15.1.1 assets/script/jquery/jquery.ui.autocomplete.html.js
card-mod-format-0.15.1 assets/script/jquery/jquery.ui.autocomplete.html.js
card-mod-format-0.15.0 assets/script/jquery/jquery.ui.autocomplete.html.js